@nebula.js/cli 3.1.0-alpha.1 → 3.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ function checkNodeVersion(pkg) {
2
+ if (pkg.engines && pkg.engines.node) {
3
+ const minVersion = pkg.engines.node.replace('>=', '');
4
+ const [minMajor, minMinor, minPatch] = minVersion.split('.').map(Number);
5
+ const currentVersion = process.versions.node;
6
+ const [currentMajor, currentMinor, currentPatch] = currentVersion.split('.').map(Number);
7
+
8
+ let validVersion = true;
9
+ if (currentMajor < minMajor) {
10
+ validVersion = false;
11
+ } else if (currentMajor === minMajor) {
12
+ if (currentMinor < minMinor) {
13
+ validVersion = false;
14
+ }
15
+ if (currentMinor === minMinor && currentPatch < minPatch) {
16
+ validVersion = false;
17
+ }
18
+ }
19
+
20
+ if (!validVersion) {
21
+ // eslint-disable-next-line no-console
22
+ console.error(`${pkg.name} requires NodeJS >= ${minVersion}, but you are using NodeJS ${currentVersion}.`);
23
+ process.exit(1);
24
+ }
25
+ }
26
+ }
27
+
28
+ module.exports = checkNodeVersion;
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  const yargs = require('yargs');
3
3
  const importCwd = require('import-cwd');
4
- const checkNodeVersion = require('../utils/checkNodeVersion');
4
+ const checkNodeVersion = require('./checkNodeVersion');
5
5
  const pkg = require('../package.json');
6
6
 
7
7
  checkNodeVersion(pkg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebula.js/cli",
3
- "version": "3.1.0-alpha.1",
3
+ "version": "3.1.0-alpha.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "QlikTech International AB",
@@ -30,9 +30,9 @@
30
30
  "@nebula.js/cli-serve": "^3.0.0"
31
31
  },
32
32
  "dependencies": {
33
- "@nebula.js/cli-create": "^3.1.0-alpha.1",
33
+ "@nebula.js/cli-create": "^3.1.0-alpha.2",
34
34
  "import-cwd": "3.0.0",
35
- "yargs": "17.6.0"
35
+ "yargs": "17.6.2"
36
36
  },
37
- "gitHead": "62d1862cc80fca13ab2753702ce2c396fed4b9d8"
37
+ "gitHead": "363faf5d8b9fd925fad73e9fe36da3d9d57d5b4b"
38
38
  }