From 1073bc5a5af087c89d63e4a07f8ee690817d6dc8 Mon Sep 17 00:00:00 2001 From: Teddy Katz Date: Tue, 7 Nov 2017 10:11:53 -0500 Subject: [PATCH] Build: remove shelljs-nodecli (refs #9533) (#9588) This removes the `shelljs-nodecli` module from the build process. `shelljs-nodecli` relies on a very old version of the `shelljs` module, which might be causing a flaky build on Appveyor (see https://github.com/eslint/eslint/issues/9533 for details). In any case, removing `shelljs-cli` seem to make `npm test` run 40% faster anyway, so it should be an improvement even if it doesn't fix the Appveyor build. --- Makefile.js | 25 ++++++++++++++++--------- package.json | 3 +-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Makefile.js b/Makefile.js index 544ee8fc647..1dd5947c3b8 100644 --- a/Makefile.js +++ b/Makefile.js @@ -20,7 +20,6 @@ const lodash = require("lodash"), fs = require("fs"), glob = require("glob"), markdownlint = require("markdownlint"), - nodeCLI = require("shelljs-nodecli"), os = require("os"), path = require("path"), semver = require("semver"), @@ -468,6 +467,15 @@ function getFormatterResults() { }, { formatterResults: {} }); } +/** + * Gets a path to an executable in node_modules/.bin + * @param {string} command The executable name + * @returns {string} The executable path + */ +function getBinFile(command) { + return path.join("node_modules", ".bin", command); +} + //------------------------------------------------------------------------------ // Tasks //------------------------------------------------------------------------------ @@ -560,21 +568,20 @@ target.test = function() { let errors = 0, lastReturn; - // exec(ISTANBUL + " cover " + MOCHA + "-- -c " + TEST_FILES); - lastReturn = nodeCLI.exec("istanbul", "cover", MOCHA, `-- -R progress -t ${MOCHA_TIMEOUT}`, "-c", TEST_FILES); + lastReturn = exec(`${getBinFile("istanbul")} cover ${MOCHA} -- -R progress -t ${MOCHA_TIMEOUT} -c ${TEST_FILES}`); if (lastReturn.code !== 0) { errors++; } - // exec(ISTANBUL + "check-coverage --statement 99 --branch 98 --function 99 --lines 99"); - lastReturn = nodeCLI.exec("istanbul", "check-coverage", "--statement 99 --branch 98 --function 99 --lines 99"); + lastReturn = exec(`${getBinFile("istanbul")} check-coverage --statement 99 --branch 98 --function 99 --lines 99`); + if (lastReturn.code !== 0) { errors++; } target.browserify(); - lastReturn = nodeCLI.exec("karma", "start karma.conf.js"); + lastReturn = exec(`${getBinFile("karma")} start karma.conf.js`); if (lastReturn.code !== 0) { errors++; } @@ -588,7 +595,7 @@ target.test = function() { target.docs = function() { echo("Generating documentation"); - nodeCLI.exec("jsdoc", "-d jsdoc lib"); + exec(`${getBinFile("jsdoc")} -d jsdoc lib`); echo("Documentation has been output to /jsdoc"); }; @@ -799,10 +806,10 @@ target.browserify = function() { generateRulesIndex(TEMP_DIR); // 5. browserify the temp directory - nodeCLI.exec("browserify", "-x espree", `${TEMP_DIR}linter.js`, "-o", `${BUILD_DIR}eslint.js`, "-s eslint", "--global-transform [ babelify --presets [ es2015 ] ]"); + exec(`${getBinFile("browserify")} -x espree ${TEMP_DIR}linter.js -o ${BUILD_DIR}eslint.js -s eslint --global-transform [ babelify --presets [ es2015 ] ]`); // 6. Browserify espree - nodeCLI.exec("browserify", "-r espree", "-o", `${TEMP_DIR}espree.js`); + exec(`${getBinFile("browserify")} -r espree -o ${TEMP_DIR}espree.js`); // 7. Concatenate Babel polyfill, Espree, and ESLint files together cat("./node_modules/babel-polyfill/dist/polyfill.js", `${TEMP_DIR}espree.js`, `${BUILD_DIR}eslint.js`).to(`${BUILD_DIR}eslint.js`); diff --git a/package.json b/package.json index da71cf6d0ea..2dee4719037 100644 --- a/package.json +++ b/package.json @@ -84,11 +84,11 @@ "coveralls": "^2.13.1", "dateformat": "^2.0.0", "ejs": "^2.5.6", - "eslint-rule-composer": "^0.1.0", "eslint-plugin-eslint-plugin": "^1.2.0", "eslint-plugin-node": "^5.1.0", "eslint-plugin-rulesdir": "^0.1.0", "eslint-release": "^0.10.1", + "eslint-rule-composer": "^0.1.0", "eslump": "1.6.0", "esprima": "^4.0.0", "esprima-fb": "^15001.1001.0-dev-harmony-fb", @@ -108,7 +108,6 @@ "phantomjs-prebuilt": "^2.1.14", "proxyquire": "^1.8.0", "shelljs": "^0.7.7", - "shelljs-nodecli": "~0.1.1", "sinon": "^3.2.1", "temp": "^0.8.3", "through": "^2.3.8"