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
diff options
context:
space:
mode:
authorForrest L Norvell <forrest@npmjs.com>2015-04-10 13:20:07 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-04-10 13:24:08 +0300
commit9220e59f8def8c82c6d331a39ba29ad4c44e3a9b (patch)
tree41e3c07305e46fd0ccde82aceba1ff048dfa7b04
parenta05e99360c54336263de68c7cfb34d8fe8087f72 (diff)
git: save non-normalized shorthand to package.json
Instead of checking if from is just a URL, use npm-package-arg to figure out what kind of URL or shorthand it might be, and save that to package.json.
-rw-r--r--lib/install.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/install.js b/lib/install.js
index 7d3840644..6e94f15b5 100644
--- a/lib/install.js
+++ b/lib/install.js
@@ -423,9 +423,9 @@ function save (where, installed, tree, pretty, hasArguments, cb) {
var saveTarget = path.resolve(where, "package.json")
asyncMap(Object.keys(tree), function (k, cb) {
- // if "what" was a url, then save that instead.
+ // if "from" is remote, git, or hosted, then save that instead.
var t = tree[k]
- , u = url.parse(t.from)
+ , f = npa(t.from)
, a = npa(t.what)
, w = [a.name, a.spec]
@@ -433,7 +433,7 @@ function save (where, installed, tree, pretty, hasArguments, cb) {
fs.stat(t.from, function (er){
if (!er) {
w[1] = "file:" + t.from
- } else if (u && u.protocol) {
+ } else if (['hosted', 'git', 'remote'].indexOf(f.type) !== -1) {
w[1] = t.from
}
cb(null, [w])