From 56c093e32e01e41995b68d7d7d0f33812e55aa50 Mon Sep 17 00:00:00 2001 From: Sander van der Burg Date: Thu, 4 Jan 2018 23:05:15 +0100 Subject: [PATCH] Only include development dependencies when we requested development mode when generating from a lock file --- lib/Package.js | 4 +++- lib/node2nix.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Package.js b/lib/Package.js index bf39e10..df201e1 100644 --- a/lib/Package.js +++ b/lib/Package.js @@ -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([ diff --git a/lib/node2nix.js b/lib/node2nix.js index ecb5e54..dc8b19c 100644 --- a/lib/node2nix.js +++ b/lib/node2nix.js @@ -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);