diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2015-03-17 03:53:11 +0300 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2015-03-17 03:53:11 +0300 |
commit | 1549106f518000633915686f5f1ccc6afcf77f8f (patch) | |
tree | 04286f1b420957706afe6ad83d92ddca03dd4b25 /lib | |
parent | 61915a8ff37ca8e42b9e99e62e7020ceea3a48eb (diff) |
shrinkwrap: npm shrinkwrap --dev means prod too
Due to 448efd0eaa6f97af0889bf47efc543a1ea2f8d7e, running `npm shrinkwrap
--dev` caused production dependencies to no longer be included in
npm-shrinkwrap-.json. Whoopsie! Added a regression test to go with the
fix.
Fixes #7641.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/shrinkwrap.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/shrinkwrap.js b/lib/shrinkwrap.js index a5783837c..03192a3fa 100644 --- a/lib/shrinkwrap.js +++ b/lib/shrinkwrap.js @@ -20,6 +20,12 @@ function shrinkwrap (args, silent, cb) { log.warn("shrinkwrap", "doesn't take positional args") } + // https://github.com/npm/npm/issues/7641 + // introduced because `npm ls` can now show dev and prod depenednecy + // trees separately + if (npm.config.get("dev")) { + npm.config.set("production", true) + } npm.commands.ls([], true, function (er, _, pkginfo) { if (er) return cb(er) shrinkwrap_(pkginfo, silent, npm.config.get("dev"), cb) @@ -45,7 +51,7 @@ function shrinkwrap_ (pkginfo, silent, dev, cb) { return } - log.warn("shrinkwrap", "Excluding devDependency: %s", dep) + log.warn("shrinkwrap", "Excluding devDependency: %s", dep, data.dependencies) delete pkginfo.dependencies[dep] }) } |