diff options
author | Rebecca Turner <me@re-becca.org> | 2015-06-15 17:32:36 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-06-26 03:27:12 +0300 |
commit | 2dd5a324311da23a426a364797847fddb722e979 (patch) | |
tree | b13aa760165a2145aef2f57fa4f10dcf7c10ed2d | |
parent | 3db206ee0dd1f9f5a35dd21427024629351246da (diff) |
shrinkwrap: Don't view missing/bad dev deps as a problem in prod mode as shrinkwrap is prod by default.
-rw-r--r-- | lib/install/deps.js | 8 | ||||
-rw-r--r-- | lib/shrinkwrap.js | 1 | ||||
-rw-r--r-- | test/tap/shrinkwrap-dev-dependency.js | 4 |
3 files changed, 6 insertions, 7 deletions
diff --git a/lib/install/deps.js b/lib/install/deps.js index 04af3ba49..9a4dc4f61 100644 --- a/lib/install/deps.js +++ b/lib/install/deps.js @@ -90,10 +90,10 @@ var recalculateMetadata = exports.recalculateMetadata = function (tree, log, nex function specs (deps) { return Object.keys(deps).map(function (depname) { return depname + '@' + deps[depname] }) } - var tomark = union( - specs(tree.package.dependencies), - specs(tree.package.devDependencies) - ) + var tomark = specs(tree.package.dependencies) + if (npm.config.get('dev') || !npm.config.get('production')) { + tomark = union(tomark, specs(tree.package.devDependencies)) + } tree.children = tree.children.filter(function (child) { return !child.failed }) chain([ [asyncMap, tomark, markDeps], diff --git a/lib/shrinkwrap.js b/lib/shrinkwrap.js index 12a641926..776e0a615 100644 --- a/lib/shrinkwrap.js +++ b/lib/shrinkwrap.js @@ -28,6 +28,7 @@ function shrinkwrap (args, silent, cb) { } var dir = path.resolve(npm.dir, '..') + npm.config.set('production', true) readPackageTree(dir, andRecalculateMetadata(iferr(cb, function (tree) { var pkginfo = treeToShrinkwrap(tree, !!npm.config.get('dev')) shrinkwrap_(pkginfo, silent, cb) diff --git a/test/tap/shrinkwrap-dev-dependency.js b/test/tap/shrinkwrap-dev-dependency.js index a124c2b7f..0a239e97c 100644 --- a/test/tap/shrinkwrap-dev-dependency.js +++ b/test/tap/shrinkwrap-dev-dependency.js @@ -77,9 +77,7 @@ function setup (cb) { var opts = { cache: path.resolve(pkg, 'cache'), - registry: common.registry, - // important to make sure devDependencies don't get stripped - dev: true + registry: common.registry } npm.load(opts, cb) } |