Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
install: Prefer rawSpec over spec when saving
Browse files Browse the repository at this point in the history
This is necessary because npa mangles spec in ways that are not
compatible npa itself. For reasons. Specifically, `git+ssh` urls have
their `git+` stripped from the front, which, for reasons, is then
fed BACK into npa, which then explodes.

Relatedly, we can't just use rawSpec because it's not available when someone
doesn't include a version at all, where as spec will be '*'.

PR-URL: #9174
Fixes: #9077
  • Loading branch information
iarna committed Aug 8, 2015
1 parent ac9391f commit 05f0226
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/install/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,12 @@ exports.loadRequestedDeps = function (args, tree, saveToDependencies, log, next)
child.isGlobal = true
}
if (saveToDependencies) {
tree.package[saveToDependencies][child.package.name] = child.package._requested.spec
tree.package[saveToDependencies][child.package.name] =
child.package._requested.rawSpec || child.package._requested.spec
}
if (saveToDependencies && saveToDependencies !== 'devDependencies') {
tree.package.dependencies[child.package.name] = child.package._requested.spec
tree.package.dependencies[child.package.name] =
child.package._requested.rawSpec || child.package._requested.spec
}
child.directlyRequested = true
child.save = saveToDependencies
Expand Down

0 comments on commit 05f0226

Please sign in to comment.