Skip to content

Commit

Permalink
add node version check (alibaba#44)
Browse files Browse the repository at this point in the history
* add node version check
  • Loading branch information
tanhe123 authored and vangie committed Jun 29, 2018
1 parent 99f5d4a commit 1bd74eb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
11 changes: 11 additions & 0 deletions lib/check-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

var semver = require('semver');
var pkg = require('../package');


var version = pkg.engines.node;
if (!semver.satisfies(process.version, version)) {
console.error(`\x1b[31m@alicloud/fun required node version ${version} not satisfied with current version ${process.version}.\x1b[0m\n`);
process.exit(1);
}
19 changes: 5 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
"name": "@alicloud/fun",
"version": "1.6.3",
"description": "(have)Fun with Serverless",
"engines": {
"node": ">=8.0.0"
},
"bin": {
"fun": "bin/fun.js"
},
"scripts": {
"test": "make test"
"test": "make test",
"postinstall": "node ./lib/check-version.js"
},
"author": "Jackson Tian",
"license": "MIT",
Expand All @@ -29,7 +33,8 @@
"jszip": "^3.1.5",
"kitx": "^1.2.1",
"mkdirp-promise": "^5.0.1",
"rimraf": "^2.6.2"
"rimraf": "^2.6.2",
"semver": "^5.5.0"
},
"files": [
"bin",
Expand Down

0 comments on commit 1bd74eb

Please sign in to comment.