Skip to content

Commit be15934

Browse files
Always run npm install
Checking if package.json exists is pointless. Performing this check through `fs` only makes sense when using the simple runner. Also, it should be safe to assume that a package.json exists in a Node project.
1 parent 45dd3f8 commit be15934

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

worker.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,27 @@ module.exports = {
3232
],
3333

3434
prepare: function (context, done) {
35-
var npmInstall = fs.existsSync(path.join(projectDir, 'package.json'));
36-
var global = config.globals && config.globals.length;
35+
// Did the user specify any packages to be globally insalled?
36+
var installGlobalPackages = config.globals && config.globals.length;
3737

3838
if (config.test && config.test !== '<none>') {
3939
context.data({doTest: true}, 'extend');
4040
}
4141

42-
if (!npmInstall && !global) {
43-
return done(null, false);
44-
}
45-
4642
var tasks = [];
4743
var nocache = config.caching !== 'strict' && config.caching !== 'loose';
4844

49-
if (npmInstall) {
50-
tasks.push(function (next) {
51-
installPackages(config, context, function (err, exact) {
52-
if (err || exact === true || nocache) {
53-
return next(err);
54-
}
45+
tasks.push(function (next) {
46+
installPackages(config, context, function (err, exact) {
47+
if (err || exact === true || nocache) {
48+
return next(err);
49+
}
5550

56-
updateCache(context, projectDir, next);
57-
});
51+
updateCache(context, projectDir, next);
5852
});
59-
}
53+
});
6054

61-
if (global) {
55+
if (installGlobalPackages) {
6256
tasks.push(function (next) {
6357
installGlobals(config, context, globalsDir, function (err, cached) {
6458
if (err || nocache || cached) {

0 commit comments

Comments
 (0)