1
0
mirror of https://github.com/sasjs/lint.git synced 2025-12-10 09:34:34 +00:00

chore(ci): add node version check

This commit is contained in:
Krishna Acondy
2021-09-13 08:41:58 +01:00
parent cd91780cf5
commit 31cee0af91
3 changed files with 19 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [12.x] node-version: [14.17.5]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

16
checkNodeVersion.js Normal file
View File

@@ -0,0 +1,16 @@
const result = process.versions
if (result && result.node) {
if (parseInt(result.node) < 14) {
console.log(
'\x1b[31m%s\x1b[0m',
`❌ Process failed due to Node Version,\nPlease install and use Node Version >= 14\nYour current Node Version is: ${result.node}`
)
process.exit(1)
}
} else {
console.log(
'\x1b[31m%s\x1b[0m',
'Something went wrong while checking Node version'
)
process.exit(1)
}

View File

@@ -4,6 +4,8 @@
"scripts": { "scripts": {
"test": "jest --coverage", "test": "jest --coverage",
"build": "rimraf build && tsc", "build": "rimraf build && tsc",
"preinstall": "node checkNodeVersion",
"prebuild": "node checkNodeVersion",
"prepublishOnly": "cp -r ./build/* . && rm -rf ./build && rm -rf ./src && rm tsconfig.json", "prepublishOnly": "cp -r ./build/* . && rm -rf ./build && rm -rf ./src && rm tsconfig.json",
"postpublish": "git clean -fd", "postpublish": "git clean -fd",
"package:lib": "npm run build && cp ./package.json build && cp README.md build && cd build && npm version \"5.0.0\" && npm pack", "package:lib": "npm run build && cp ./package.json build && cp README.md build && cd build && npm version \"5.0.0\" && npm pack",