build(npm): short-circuit npm install if node_modules are healthy
Closes #8627
This commit is contained in:
@ -4,13 +4,9 @@ var checkNpm = require('./check-node-modules.js');
|
||||
|
||||
var purgeIfStale = (process.argv.indexOf('--purge') !== -1);
|
||||
|
||||
if (process.env.TRAVIS && !purgeIfStale) {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// check-node-modules will exit(1) if we don't need to install to short-circuit `npm install`
|
||||
// see .travis.yml's `install` block to see the reason for this
|
||||
var nodeModulesOK = checkNpm(true, purgeIfStale);
|
||||
|
||||
process.exit( nodeModulesOK || purgeIfStale ? 0 : 1);
|
||||
process.exit( nodeModulesOK ? 0 : 1);
|
||||
|
||||
|
@ -18,12 +18,7 @@ function checkNodeModules(logOutput, purgeIfStale) {
|
||||
if (logOutput) console.error(':-( npm dependencies are stale or in an in unknown state!');
|
||||
if (purgeIfStale) {
|
||||
if (logOutput) console.log(' purging...');
|
||||
|
||||
var nodeModulesPath = path.join(PROJECT_ROOT, 'node_modules');
|
||||
|
||||
if (fs.existsSync(nodeModulesPath)) {
|
||||
_deleteDir(nodeModulesPath);
|
||||
}
|
||||
_deleteDir(path.join(PROJECT_ROOT, 'node_modules'));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user