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-06-08 02:20:04 +0300
committerKat Marchán <kzm@sykosomatic.org>2017-06-08 03:40:22 +0300
commit800cb2b4e2d0bd00b5c9082a896f2110e907eb0b (patch)
treef866da8594a70838bb0849e144a8e798d0185923 /lib
parentd2969c80e4178faebf0f7c4cab6eb610dd953cc6 (diff)
shrinkwrap: lean on from field for better forward-compat (#17076)
PR-URL: https://github.com/npm/npm/pull/17076 Credit: @zkat Reviewed-By: @iarna
Diffstat (limited to 'lib')
-rw-r--r--lib/install/realize-shrinkwrap-specifier.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/install/realize-shrinkwrap-specifier.js b/lib/install/realize-shrinkwrap-specifier.js
index 91030bfa8..ac700278f 100644
--- a/lib/install/realize-shrinkwrap-specifier.js
+++ b/lib/install/realize-shrinkwrap-specifier.js
@@ -5,14 +5,17 @@ module.exports = function (name, sw, where) {
try {
if (sw.version && sw.integrity) {
return npa.resolve(name, sw.version, where)
+ } else if (sw.from) {
+ const spec = npa(sw.from, where)
+ if (spec.registry && sw.version) {
+ return npa.resolve(name, sw.version, where)
+ } else if (!sw.resolved) {
+ return spec
+ }
}
if (sw.resolved) {
return npa.resolve(name, sw.resolved, where)
}
- if (sw.from) {
- var spec = npa(sw.from, where)
- if (!spec.registry) return spec
- }
} catch (_) { }
return npa.resolve(name, sw.version, where)
}