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

Commit

Permalink
shrinkwrap: Upgrade all requires to ranges
Browse files Browse the repository at this point in the history
Credit: @iarna
  • Loading branch information
iarna committed Apr 10, 2018
1 parent fe867aa commit 49d18b4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/shrinkwrap.js
Expand Up @@ -135,7 +135,7 @@ function shrinkwrapDeps (deps, top, tree, seen) {
pkginfo.requires = {}
sortModules(child.requires).forEach((required) => {
var requested = getRequested(required, child) || required.package._requested || {}
pkginfo.requires[moduleName(required)] = childRequested(top, child, required, requested)
pkginfo.requires[moduleName(required)] = childRequested(top, required, requested)
})
}
if (child.children.length) {
Expand Down Expand Up @@ -163,10 +163,8 @@ function childVersion (top, child, req) {
}
}

function childRequested (top, parent, child, requested) {
if (parent.swRequires && parent.swRequires[moduleName(child)] === child.package.version) {
return child.package.version
} else if (requested.type === 'directory' || requested.type === 'file') {
function childRequested (top, child, requested) {
if (requested.type === 'directory' || requested.type === 'file') {
return 'file:' + unixFormatPath(path.relative(top.path, child.package._resolved || requested.fetchSpec))
} else if (!isRegistry(requested) && !child.fromBundle) {
return child.package._resolved || requested.saveSpec || requested.rawSpec
Expand Down

0 comments on commit 49d18b4

Please sign in to comment.