mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-19 17:58:43 -05:00
feat: show a message to upgrade node when needed (#999)
This commit is contained in:
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@@ -27,7 +27,7 @@ If the proposal includes new designs or bigger changes, please be prepared to di
|
|||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
- [Node.js](https://nodejs.org/) 10+ and [yarn](https://yarnpkg.com) 1.9.4 installed
|
- [Node.js](https://nodejs.org/) 18.10.0+ and [yarn](https://yarnpkg.com) 1+ installed
|
||||||
|
|
||||||
### Project structure
|
### Project structure
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
const yargs = require('yargs');
|
const yargs = require('yargs');
|
||||||
const importCwd = require('import-cwd');
|
const importCwd = require('import-cwd');
|
||||||
|
const checkNodeVersion = require('../utils/checkNodeVersion');
|
||||||
|
const pkg = require('../package.json');
|
||||||
|
|
||||||
// const build = require('@nebula.js/cli-build/command');
|
checkNodeVersion(pkg);
|
||||||
// const create = require('@nebula.js/cli-create/command');
|
|
||||||
// const serve = require('@nebula.js/cli-serve/command');
|
|
||||||
// const sense = require('@nebula.js/cli-sense/command');
|
|
||||||
|
|
||||||
yargs.usage('nebula <command> [options]');
|
yargs.usage('nebula <command> [options]');
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.10.0"
|
||||||
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"nebula": "lib/index.js"
|
"nebula": "lib/index.js"
|
||||||
},
|
},
|
||||||
|
|||||||
28
commands/cli/utils/checkNodeVersion.js
Normal file
28
commands/cli/utils/checkNodeVersion.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
function checkNodeVersion(pkg) {
|
||||||
|
if (pkg.engines && pkg.engines.node) {
|
||||||
|
const minVersion = pkg.engines.node.replace('>=', '');
|
||||||
|
const [minMajor, minMinor, minPatch] = minVersion.split('.').map(Number);
|
||||||
|
const currentVersion = process.versions.node;
|
||||||
|
const [currentMajor, currentMinor, currentPatch] = currentVersion.split('.').map(Number);
|
||||||
|
|
||||||
|
let validVersion = true;
|
||||||
|
if (currentMajor < minMajor) {
|
||||||
|
validVersion = false;
|
||||||
|
} else if (currentMajor === minMajor) {
|
||||||
|
if (currentMinor < minMinor) {
|
||||||
|
validVersion = false;
|
||||||
|
}
|
||||||
|
if (currentMinor === minMinor && currentPatch < minPatch) {
|
||||||
|
validVersion = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!validVersion) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(`${pkg.name} requires NodeJS >= ${minVersion}, but you are using NodeJS ${currentVersion}.`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = checkNodeVersion;
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"keywords": ["qlik", "nebula", "stardust"],
|
"keywords": ["qlik", "nebula", "stardust"],
|
||||||
"files": ["dist"],
|
"files": ["dist"],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18.10.0"
|
||||||
},
|
},
|
||||||
"main": "dist/<%= name %>.js",
|
"main": "dist/<%= name %>.js",
|
||||||
"module": "dist/<%= name %>.esm.js",
|
"module": "dist/<%= name %>.esm.js",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"keywords": ["qlik", "nebula", "stardust"],
|
"keywords": ["qlik", "nebula", "stardust"],
|
||||||
"files": ["dist"],
|
"files": ["dist"],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18.10.0"
|
||||||
},
|
},
|
||||||
"main": "dist/<%= name %>.js",
|
"main": "dist/<%= name %>.js",
|
||||||
"module": "dist/<%= name %>.esm.js",
|
"module": "dist/<%= name %>.esm.js",
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
"dist",
|
"dist",
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.10.0"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "cross-env NODE_ENV=production DEFAULTS=true webpack --config ./lib/webpack.build.js",
|
"build": "cross-env NODE_ENV=production DEFAULTS=true webpack --config ./lib/webpack.build.js",
|
||||||
"build:dev": "cross-env NODE_ENV=development DEFAULTS=true webpack --config ./lib/webpack.build.js",
|
"build:dev": "cross-env NODE_ENV=development DEFAULTS=true webpack --config ./lib/webpack.build.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user