Linter fixes
[e-mobility-charging-stations-simulator.git] / build-requirements.js
index ebcd5ef04680f340c030b7d84c2f1c7d70a13d52..63c471312cdf8c1445ac5aa497b90867c47ff021 100644 (file)
@@ -1,15 +1,24 @@
 const chalk = require('chalk');
-// eslint-disable-next-line node/no-unpublished-require
+// eslint-disable-next-line n/no-unpublished-require
 const SemVer = require('semver');
 
 const enginesNodeVersion = require('./package.json').engines.node;
 
-if (SemVer.satisfies(process.version, enginesNodeVersion) === false) {
-  console.error(
-    chalk.red(
-      `Required node version ${enginesNodeVersion} not satisfied with current version ${process.version}.`
-    )
-  );
-  // eslint-disable-next-line no-process-exit
-  process.exit(1);
+/**
+ * Check if the current node version match the required engines version.
+ */
+function checkNodeVersion() {
+  if (SemVer.satisfies(process.version, enginesNodeVersion) === false) {
+    console.error(
+      chalk.red(
+        `Required node version ${enginesNodeVersion} not satisfied with current version ${process.version}.`
+      )
+    );
+    // eslint-disable-next-line n/no-process-exit
+    process.exit(1);
+  }
 }
+
+checkNodeVersion();
+
+module.exports = { checkNodeVersion };