diff --git a/checkNodeVersion.js b/checkNodeVersion.js index 48a4db8..76316c6 100644 --- a/checkNodeVersion.js +++ b/checkNodeVersion.js @@ -1,14 +1,9 @@ const result = process.versions if (result && result.node) { - if (parseInt(result.node) >= 14) { - console.log( - '\x1b[32m%s\x1b[0m', - `Good to Go with your Node Version: ${result.node}` - ) - } else { + if (parseInt(result.node) < 14) { console.log( '\x1b[31m%s\x1b[0m', - `Package installation(npm install) failed due to Node Version,\nPlease install and use Node Version >=14\nYour current Node Version is: ${result.node}` + `Process failed due to Node Version,\nPlease install and use Node Version >= 14\nYour current Node Version is: ${result.node}` ) process.exit(1) } diff --git a/package.json b/package.json index b0eb87d..728baa2 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "homepage": "https://adapter.sasjs.io", "scripts": { "preinstall": "node checkNodeVersion", + "prebuild": "node checkNodeVersion", "build": "rimraf build && rimraf node && mkdir node && copyfiles -u 1 \"./src/**/*\" ./node && webpack && rimraf build/src && rimraf node", "package:lib": "npm run build && copyfiles ./package.json ./checkNodeVersion.js build && cd build && npm version \"5.0.0\" && npm pack", "publish:lib": "npm run build && cd build && npm publish",