Commit 5b4debd2 authored by Andrew Nicols's avatar Andrew Nicols
Browse files

MDL-66109 js: Upgrade Node dependencies

This change updates most libraries used in our Grunt build stack and
applies necessary changes to Grunt and Gherkin-lint configuration to
ensure that they continue to work.

The grunt-sass plugin has been updated to support alternative
'implementations' of sass compilers, and the chosen sass compiler must
now be specified in the grunt configuration. We continue to use the
`node-sass` package for this.

Our gherkin-lintrc included two rules which were renamed from
'no-unamed-*' to 'no-unnamed-*'. This change occurred in version 2.0.0
of Gherkin-lint and has no other effect.
parent 9b7e6e9c
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"no-multiple-empty-lines": "on", "no-multiple-empty-lines": "on",
"no-partially-commented-tag-lines": "on", "no-partially-commented-tag-lines": "on",
"no-trailing-spaces": "on", "no-trailing-spaces": "on",
"no-unamed-features": "on", "no-unnamed-features": "on",
"no-unamed-scenarios": "on", "no-unnamed-scenarios": "on",
"no-scenario-outlines-without-examples": "on" "no-scenario-outlines-without-examples": "on"
} }
...@@ -149,6 +149,7 @@ module.exports = function(grunt) { ...@@ -149,6 +149,7 @@ module.exports = function(grunt) {
const watchmanClient = new watchman.Client(); const watchmanClient = new watchman.Client();
const fs = require('fs'); const fs = require('fs');
const ComponentList = require(path.resolve('GruntfileComponents.js')); const ComponentList = require(path.resolve('GruntfileComponents.js'));
const sass = require('node-sass');
// Verify the node version is new enough. // Verify the node version is new enough.
var expected = semver.validRange(grunt.file.readJSON('package.json').engines.node); var expected = semver.validRange(grunt.file.readJSON('package.json').engines.node);
...@@ -358,6 +359,7 @@ module.exports = function(grunt) { ...@@ -358,6 +359,7 @@ module.exports = function(grunt) {
} }
}, },
options: { options: {
implementation: sass,
includePaths: ["theme/boost/scss/", "theme/classic/scss/"] includePaths: ["theme/boost/scss/", "theme/classic/scss/"]
} }
}, },
...@@ -527,23 +529,28 @@ module.exports = function(grunt) { ...@@ -527,23 +529,28 @@ module.exports = function(grunt) {
const options = grunt.config('gherkinlint.options'); const options = grunt.config('gherkinlint.options');
// Grab the gherkin-lint linter and required scaffolding. // Grab the gherkin-lint linter and required scaffolding.
const linter = require('gherkin-lint/src/linter.js'); const linter = require('gherkin-lint/dist/linter.js');
const featureFinder = require('gherkin-lint/src/feature-finder.js'); const featureFinder = require('gherkin-lint/dist/feature-finder.js');
const configParser = require('gherkin-lint/src/config-parser.js'); const configParser = require('gherkin-lint/dist/config-parser.js');
const formatter = require('gherkin-lint/src/formatters/stylish.js'); const formatter = require('gherkin-lint/dist/formatters/stylish.js');
// Run the linter. // Run the linter.
const results = linter.lint( return linter.lint(
featureFinder.getFeatureFiles(grunt.file.expand(options.files)), featureFinder.getFeatureFiles(grunt.file.expand(options.files)),
configParser.getConfiguration(configParser.defaultConfigFileName) configParser.getConfiguration(configParser.defaultConfigFileName)
); )
.then(results => {
// Print the results out uncondtionally. // Print the results out uncondtionally.
formatter.printResults(results); formatter.printResults(results);
// Report on the results. return results;
// The done function takes a bool whereby a falsey statement causes the task to fail. })
done(results.every(result => result.errors.length === 0)); .then(results => {
// Report on the results.
// The done function takes a bool whereby a falsey statement causes the task to fail.
return results.every(result => result.errors.length === 0);
})
.then(done); // eslint-disable-line promise/no-callback-in-promise
}; };
tasks.startup = function() { tasks.startup = function() {
......
This diff is collapsed.
...@@ -3,40 +3,40 @@ ...@@ -3,40 +3,40 @@
"private": true, "private": true,
"description": "Moodle", "description": "Moodle",
"devDependencies": { "devDependencies": {
"@babel/core": "7.4.5", "@babel/core": "7.9.0",
"@babel/plugin-proposal-class-properties": "7.4.4", "@babel/plugin-proposal-class-properties": "7.8.3",
"@babel/plugin-proposal-json-strings": "7.2.0", "@babel/plugin-proposal-json-strings": "7.8.3",
"@babel/plugin-syntax-dynamic-import": "7.2.0", "@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-syntax-import-meta": "7.2.0", "@babel/plugin-syntax-import-meta": "7.8.3",
"@babel/preset-env": "7.4.5", "@babel/preset-env": "7.9.5",
"ajv": "6.9.1", "ajv": "6.12.2",
"async": "1.5.2", "async": "3.2.0",
"babel-eslint": "10.0.1", "babel-eslint": "10.1.0",
"babel-plugin-system-import-transformer": "^4.0.0", "babel-plugin-system-import-transformer": "^4.0.0",
"babel-plugin-transform-es2015-modules-amd-lazy": "2.0.1", "babel-plugin-transform-es2015-modules-amd-lazy": "2.0.1",
"babel-preset-minify": "0.5.0", "babel-preset-minify": "0.5.1",
"eslint": "4.12.1", "eslint": "6.8.0",
"eslint-plugin-babel": "5.3.0", "eslint-plugin-babel": "5.3.0",
"eslint-plugin-promise": "3.5.0", "eslint-plugin-promise": "4.2.1",
"fb-watchman": "2.0.0", "fb-watchman": "2.0.1",
"gherkin-lint": "1.1.3", "gherkin-lint": "4.0.1",
"glob": "7.1.3", "glob": "7.1.6",
"grunt": "1.0.1", "grunt": "1.1.0",
"grunt-babel": "8.0.0", "grunt-babel": "8.0.0",
"grunt-contrib-uglify": "1.0.1", "grunt-contrib-uglify": "4.0.1",
"grunt-contrib-watch": "1.0.0", "grunt-contrib-watch": "1.1.0",
"grunt-eslint": "20.1.0", "grunt-eslint": "22.0.0",
"grunt-sass": "2.1.0", "grunt-sass": "3.1.0",
"grunt-stylelint": "0.6.0", "grunt-stylelint": "0.15.0",
"jshint": "^2.11.0", "jshint": "^2.11.0",
"node-sass": "^4.14.0", "node-sass": "^4.14.0",
"semver": "5.3.0", "semver": "7.3.2",
"shifter": "https://github.com/andrewnicols/shifter/archive/v0.5.0_moodle-0.tar.gz", "shifter": "https://github.com/andrewnicols/shifter/archive/v0.5.0_moodle-0.tar.gz",
"stylelint": "8.0.0", "stylelint": "13.3.3",
"stylelint-checkstyle-formatter": "0.1.0", "stylelint-checkstyle-formatter": "0.1.2",
"stylelint-csstree-validator": "1.1.1", "stylelint-csstree-validator": "1.8.0",
"xmldom": "0.1.22", "xmldom": "0.3.0",
"xpath": "0.0.23" "xpath": "0.0.27"
}, },
"engines": { "engines": {
"node": ">=14.0.0 <15" "node": ">=14.0.0 <15"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment