diff options
author | isaacs <i@izs.me> | 2012-02-29 05:25:18 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-02-29 05:30:45 +0400 |
commit | 4bb884d2f8a30701c05ed81f7ace62be53147cae (patch) | |
tree | 18ae1af2ec1c9d61d7cc649dc810d3a3a66ea10c | |
parent | 50142da84aadf59c49361e9399720173c11b8948 (diff) |
shrinkwrap: Behave properly with url-installed deps
-rw-r--r-- | lib/install.js | 14 | ||||
-rw-r--r-- | lib/ls.js | 6 |
2 files changed, 15 insertions, 5 deletions
diff --git a/lib/install.js b/lib/install.js index 690f213b8..eab314ffd 100644 --- a/lib/install.js +++ b/lib/install.js @@ -183,7 +183,9 @@ function readDependencies (context, where, opts, cb) { }) rv.dependencies = {} Object.keys(wrap).forEach(function (key) { - rv.dependencies[key] = wrap[key].version + log.warn([key, wrap[key]], "from wrap") + var w = wrap[key] + rv.dependencies[key] = w.from || w.version }) log.verbose([rv.dependencies], "readDependencies: returned deps") return cb(null, rv, wrap) @@ -210,7 +212,8 @@ function readDependencies (context, where, opts, cb) { }) rv.dependencies = {} Object.keys(newwrap.dependencies).forEach(function (key) { - rv.dependencies[key] = newwrap.dependencies[key].version + var w = newwrap.dependencies[key] + rv.dependencies[key] = w.from || w.version }) log.verbose([rv.dependencies], "readDependencies: returned deps") return cb(null, rv, newwrap.dependencies) @@ -504,10 +507,11 @@ function targetResolver (where, context, deps) { if (wrap) { name = what.split(/@/).shift() if (wrap[name]) { - log.verbose("shrinkwrap: resolving "+what+" to "+wrap[name].version) - what = name + "@" + wrap[name].version + var wrapTarget = wrap[name].from || wrap[name].version + log.verbose("resolving "+what+" to "+wrapTarget, "shrinkwrap") + what = name + "@" + wrapTarget } else { - log.verbose("shrinkwrap: skipping "+what+" (not in shrinkwrap)") + log.verbose("skipping "+what+" (not in shrinkwrap)", "shrinkwrap") } } else if (deps[what]) { what = what + "@" + deps[what] @@ -53,6 +53,7 @@ function ls (args, silent, cb) { function getLite (data, noname) { var lite = {} , maxDepth = npm.config.get("depth") + , url = require("url") if (!noname && data.name) lite.name = data.name if (data.version) lite.version = data.version @@ -64,6 +65,11 @@ function getLite (data, noname) { + " " + (data.path || "") ) } + if (data._from) { + var u = url.parse(data._from) + if (u.protocol) lite.from = data._from + } + if (data.invalid) { lite.invalid = true lite.problems = lite.problems || [] |