Skip to content

Commit

Permalink
feat: check node engine requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
cpselvis committed Sep 9, 2017
1 parent 3fff39c commit 499358d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/feflow.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict';

const Feflow = require('./core');
const pkg = require('../package.json');
const figlet = require('figlet');
const chalk = require('chalk');
const minimist = require('minimist');
const semver = require('semver');

/**
* Entrance file, parse user input and call a command.
Expand Down Expand Up @@ -49,6 +51,13 @@ function entry(args) {
});
}

log.debug('process.version', process.version);
log.debug('pkg.engines.node', pkg.engines.node);

if (!semver.satisfies(process.version, pkg.engines.node)) {
return log.error(`运行feflow所需Node.js版本为${pkg.engines.node},当前版本为${process.version},请升级到最新版本Node.js(https://nodejs.org/en/).`);
}

return feflow.init().then(function() {
let cmd = '';

Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"commandline",
"front-end"
],
"engines": {
"node": ">=6.0.0"
},
"author": "cpselvis (cpselvis@gmail.com)",
"license": "MIT",
"bin": {
Expand All @@ -41,6 +44,7 @@
"osenv": "^0.1.4",
"request": "^2.81.0",
"request-promise": "^4.2.1",
"semver": "^5.4.1",
"yeoman-environment": "^1.6.6"
},
"devDependencies": {
Expand Down

0 comments on commit 499358d

Please sign in to comment.