Skip to content

Commit

Permalink
Only include development dependencies when we requested development m…
Browse files Browse the repository at this point in the history
…ode when generating from a lock file
  • Loading branch information
svanderburg committed Jan 4, 2018
1 parent c6ed5bc commit 56c093e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/Package.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,10 @@ Package.prototype.resolveDependenciesFromLockedDependencies = function(dependenc

if(dependency.bundled) { // Bundled dependencies should not be included
callback();
} else if(self.production && dependency.dev) { // Development dependencies should not be included in production mode
callback();
} else {
var pkg = new Package(self.deploymentConfig, self.lock, self, dependencyName, dependency.version, self.source.baseDir, true /* Never include development dependencies of transitive dependencies */, self.sourcesCache);
var pkg = new Package(self.deploymentConfig, self.lock, self, dependencyName, dependency.version, self.source.baseDir, self.production, self.sourcesCache);
self.providedDependencies[dependencyName] = pkg;

slasp.sequence([
Expand Down
2 changes: 1 addition & 1 deletion lib/node2nix.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function npmToNix(inputJSON, outputNix, compositionNix, nodeEnvNix, lockJSON, su
expr = new PackageExpression(deploymentConfig, lock, baseDir, obj.name, baseDir);

// Display a warning if we expect a lock file to be used, but the user does not specify it
displayLockWarning = bypassCache && fs.existsSync(path.join(path.dirname(inputJSON), path.basename(inputJSON, ".json")) + "-lock.json");
displayLockWarning = bypassCache && !lockJSON && fs.existsSync(path.join(path.dirname(inputJSON), path.basename(inputJSON, ".json")) + "-lock.json");
}

expr.resolveDependencies(callback);
Expand Down

0 comments on commit 56c093e

Please sign in to comment.