Skip to content

Commit

Permalink
Build: remove shelljs-nodecli (refs #9533) (#9588)
Browse files Browse the repository at this point in the history
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
#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.
  • Loading branch information
not-an-aardvark authored and aladdin-add committed Nov 7, 2017
1 parent 7e3bf6a commit 1073bc5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
25 changes: 16 additions & 9 deletions Makefile.js
Expand Up @@ -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"),
Expand Down Expand Up @@ -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
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -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++;
}
Expand All @@ -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");
};

Expand Down Expand Up @@ -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`);
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -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",
Expand All @@ -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"
Expand Down

0 comments on commit 1073bc5

Please sign in to comment.