mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-55856 grunt: fail gracefully when node version too old
Unfortunately the engine requirement in packages.json is not a fatal error, so you can get unhelpful errors with grunt if using an unsupported version.
This commit is contained in:
parent
1f2744851f
commit
d2c7175a34
10
Gruntfile.js
10
Gruntfile.js
@ -30,7 +30,15 @@ module.exports = function(grunt) {
|
||||
cwd = process.env.PWD || process.cwd(),
|
||||
async = require('async'),
|
||||
DOMParser = require('xmldom').DOMParser,
|
||||
xpath = require('xpath');
|
||||
xpath = require('xpath'),
|
||||
semver = require('semver');
|
||||
|
||||
// Verify the node version is new enough.
|
||||
var expected = semver.validRange(grunt.file.readJSON('package.json').engines.node);
|
||||
var actual = semver.valid(process.version);
|
||||
if (!semver.satisfies(actual, expected)) {
|
||||
grunt.fail.fatal('Node version too old. Require ' + expected + ', version installed: ' + actual);
|
||||
}
|
||||
|
||||
// Windows users can't run grunt in a subdirectory, so allow them to set
|
||||
// the root by passing --root=path/to/dir.
|
||||
|
938
npm-shrinkwrap.json
generated
938
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,7 @@
|
||||
"grunt-contrib-watch": "1.0.0",
|
||||
"grunt-eslint": "19.0.0",
|
||||
"grunt-stylelint": "0.6.0",
|
||||
"semver": "5.3.0",
|
||||
"shifter": "0.5.0",
|
||||
"stylelint-checkstyle-formatter": "0.1.0",
|
||||
"xmldom": "0.1.22",
|
||||
|
Loading…
x
Reference in New Issue
Block a user