Skip to content

Commit 7c8872f

Browse files
saas-1568 - node version check (#267)
* version check * proper package.json for check
1 parent 9a97ca4 commit 7c8872f

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ RUN apk add --update git curl jq py-pip && pip install yq
55
WORKDIR /cf-cli
66

77
COPY package.json /cf-cli
8+
COPY check-version.js /cf-cli
89

910
RUN yarn --prod install
1011

check-version.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const semver = require('semver');
2+
const { engines } = require('./package');
3+
4+
const version = engines.node;
5+
if (!semver.satisfies(process.version, version)) {
6+
throw new Error(`Required node version ${version} not satisfied with current version ${process.version}.`);
7+
}
8+

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.13.0",
3+
"version": "0.13.1",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,
@@ -13,7 +13,9 @@
1313
"serve-docs": "yarn build-local-docs && cd temp && hugo server -D",
1414
"serve-docs-beta": "ALLOW_BETA_COMMANDS=true yarn build-local-docs && cd temp && hugo server -D",
1515
"build-local-docs": "node ./docs/index.js",
16-
"build-public-docs": "node ./docs/index.js && cd temp && hugo"
16+
"build-public-docs": "node ./docs/index.js && cd temp && hugo",
17+
"check-node-version": "node check-version.js",
18+
"postinstall": "npm run check-node-version"
1719
},
1820
"bin": {
1921
"codefresh": "./lib/interface/cli/codefresh"
@@ -60,6 +62,7 @@
6062
"request-promise": "^4.2.2",
6163
"requestretry": "^3.1.0",
6264
"rimraf": "^2.6.2",
65+
"semver": "^5.6.0",
6366
"tty-table": "^2.5.5",
6467
"uuid": "^3.1.0",
6568
"yargs": "^10.0.3"
@@ -81,7 +84,7 @@
8184
"author": "Codefresh",
8285
"license": "ISC",
8386
"engines": {
84-
"node": ">8.0.0"
87+
"node": ">=8.0.0"
8588
},
8689
"yargs": {
8790
"boolean-negation": false

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4568,6 +4568,11 @@ semver@5.3.0:
45684568
version "5.3.0"
45694569
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
45704570

4571+
semver@^5.6.0:
4572+
version "5.6.0"
4573+
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
4574+
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
4575+
45714576
semver@~5.0.1:
45724577
version "5.0.3"
45734578
resolved "https://registry.yarnpkg.com/semver/-/semver-5.0.3.tgz#77466de589cd5d3c95f138aa78bc569a3cb5d27a"

0 commit comments

Comments
 (0)