Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2017-05-12 02:40:29 +0300
committerRebecca Turner <me@re-becca.org>2017-05-26 04:55:14 +0300
commite6d2eb258a85ccafe2a67aaefb4165b147c041d1 (patch)
tree553aa909f6c4e86d56c2d08a6f27cd373626ff24 /lib
parent7963e98505565efdd50e2a9b138f399da2afcb84 (diff)
fix(shrinkwrap): reuse sw resolved for diff-registry children
Diffstat (limited to 'lib')
-rw-r--r--lib/install/action/refresh-package-json.js3
-rw-r--r--lib/install/inflate-shrinkwrap.js2
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/install/action/refresh-package-json.js b/lib/install/action/refresh-package-json.js
index 0bc19a07e..16989876c 100644
--- a/lib/install/action/refresh-package-json.js
+++ b/lib/install/action/refresh-package-json.js
@@ -12,6 +12,9 @@ module.exports = function (staging, pkg, log) {
Object.keys(pkg.package).forEach(function (key) {
if (key !== '_injectedFromShrinkwrap' && !isEmpty(pkg.package[key])) {
metadata[key] = pkg.package[key]
+ if (key === '_resolved' && metadata[key] == null && pkg.package._injectedFromShrinkwrap) {
+ metadata[key] = pkg.package._injectedFromShrinkwrap.resolved
+ }
}
})
// These two sneak in and it's awful
diff --git a/lib/install/inflate-shrinkwrap.js b/lib/install/inflate-shrinkwrap.js
index c7a80b7da..9878b0f19 100644
--- a/lib/install/inflate-shrinkwrap.js
+++ b/lib/install/inflate-shrinkwrap.js
@@ -137,7 +137,7 @@ function adaptResolved (requested, resolved) {
const registry = requested.scope
? npm.config.get(`${requested.scope}:registry`) || npm.config.get('registry')
: npm.config.get('registry')
- if (!requested.registry || resolved.indexOf(registry) === 0) {
+ if (!requested.registry || (resolved && resolved.indexOf(registry) === 0)) {
// Nothing to worry about here. Pass it through.
return resolved
} else {