Skip to content

Commit

Permalink
inflate-shrinkwrap: Treat shrinkwrap as canonical
Browse files Browse the repository at this point in the history
That is, don't try to fill in for partial shrinkwraps.  Partial shrinkwraps
should produce partial installs.

Credit: @iarna
Reviewed-By: @zkat
PR-URL: npm/npm#14327
  • Loading branch information
iarna committed Oct 20, 2016
1 parent b7dfae8 commit 0ae1f4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/install/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ exports.loadDevDeps = function (tree, log, next) {
}, andForEachChild(loadDeps, andFinishTracker(log, next)))
}

exports.loadExtraneous = function loadExtraneous (tree, log, next) {
var loadExtraneous = exports.loadExtraneous = function (tree, log, next) {
var seen = {}
function loadExtraneous (tree, log, next) {
validate('OOF', arguments)
Expand All @@ -429,6 +429,9 @@ exports.loadExtraneous = function loadExtraneous (tree, log, next) {

exports.loadExtraneous.andResolveDeps = function (tree, log, next) {
validate('OOF', arguments)
// For canonicalized trees (eg from shrinkwrap) we don't want to bother
// resolving the dependencies of extraneous deps.
if (tree.loaded) return loadExtraneous(tree, log, next)
asyncMap(tree.children.filter(function (child) { return !child.loaded }), function (child, done) {
resolveWithExistingModule(child, tree, log, done)
}, andForEachChild(loadDeps, andFinishTracker(log, next)))
Expand Down
3 changes: 2 additions & 1 deletion lib/install/inflate-shrinkwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var childPath = require('../utils/child-path.js')

module.exports = function (tree, swdeps, finishInflating) {
if (!npm.config.get('shrinkwrap')) return finishInflating()
tree.loaded = true
return inflateShrinkwrap(tree.path, tree, swdeps, finishInflating)
}

Expand Down Expand Up @@ -67,7 +68,7 @@ function inflateShrinkwrap (topPath, tree, swdeps, finishInflating) {
return function () {
var child = createChild({
package: pkg,
loaded: false,
loaded: true,
parent: tree,
fromShrinkwrap: pkg._from,
path: childPath(tree.path, pkg),
Expand Down

0 comments on commit 0ae1f4b

Please sign in to comment.