diff options
author | Rebecca Turner <me@re-becca.org> | 2017-05-24 22:02:36 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-05-26 04:55:28 +0300 |
commit | cd7a5d044ae7ebfd2632b45dbc49acb63232153f (patch) | |
tree | 316b3ac52d698dc6ccb76e37f2b35e923fb02146 | |
parent | 864a4d9a9e9bffc37e6ba927036637939e703a49 (diff) |
fix(shrinkwrap): clarify reuse of sw resolved for diff-registry children
-rw-r--r-- | lib/install/action/refresh-package-json.js | 8 | ||||
-rw-r--r-- | lib/install/inflate-shrinkwrap.js | 5 | ||||
-rw-r--r-- | lib/shrinkwrap.js | 4 |
3 files changed, 8 insertions, 9 deletions
diff --git a/lib/install/action/refresh-package-json.js b/lib/install/action/refresh-package-json.js index 16989876c..ca74c683d 100644 --- a/lib/install/action/refresh-package-json.js +++ b/lib/install/action/refresh-package-json.js @@ -10,13 +10,13 @@ module.exports = function (staging, pkg, log) { return readJson(path.join(pkg.path, 'package.json'), false).then((metadata) => { Object.keys(pkg.package).forEach(function (key) { - if (key !== '_injectedFromShrinkwrap' && !isEmpty(pkg.package[key])) { + if (!isEmpty(pkg.package[key])) { metadata[key] = pkg.package[key] - if (key === '_resolved' && metadata[key] == null && pkg.package._injectedFromShrinkwrap) { - metadata[key] = pkg.package._injectedFromShrinkwrap.resolved - } } }) + if (metadata._resolved == null && pkg.fakeChild) { + metadata._resolved = pkg.fakeChild.resolved + } // These two sneak in and it's awful delete metadata.readme delete metadata.readmeFilename diff --git a/lib/install/inflate-shrinkwrap.js b/lib/install/inflate-shrinkwrap.js index d9f455517..8514f00dd 100644 --- a/lib/install/inflate-shrinkwrap.js +++ b/lib/install/inflate-shrinkwrap.js @@ -101,8 +101,7 @@ function makeFakeChild (name, topPath, tree, sw, requested) { _from: from, _spec: requested.rawSpec, _where: topPath, - _args: [[requested.toString(), topPath]], - _injectedFromShrinkwrap: sw + _args: [[requested.toString(), topPath]] } let bundleAdded = BB.resolve() if (Object.keys(sw.dependencies || {}).some((d) => { @@ -118,7 +117,7 @@ function makeFakeChild (name, topPath, tree, sw, requested) { parent: tree, children: pkg._bundled || [], fromShrinkwrap: true, - fakeChild: true, + fakeChild: sw, fromBundle: sw.bundled ? tree.fromBundle || tree : null, path: childPath(tree.path, pkg), realpath: childPath(tree.realpath, pkg), diff --git a/lib/shrinkwrap.js b/lib/shrinkwrap.js index 338973cc7..b12e63c91 100644 --- a/lib/shrinkwrap.js +++ b/lib/shrinkwrap.js @@ -103,8 +103,8 @@ function shrinkwrapDeps (deps, top, tree, seen) { seen[tree.path] = true tree.children.sort(function (aa, bb) { return moduleName(aa).localeCompare(moduleName(bb)) }).forEach(function (child) { var childIsOnlyDev = isOnlyDev(child) - if (child.package._injectedFromShrinkwrap) { - deps[moduleName(child)] = child.package._injectedFromShrinkwrap + if (child.fakeChild) { + deps[moduleName(child)] = child.fakeChild return } var pkginfo = deps[moduleName(child)] = {} |