Skip to content

Commit

Permalink
fix: update npx cache if possible when spec is a range
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Jan 30, 2025
1 parent d17b35a commit 32ba17f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion workspaces/libnpmexec/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const missingFromTree = async ({ spec, tree, flatOptions, isNpxTree, shallow })
// - In local or global mode go with anything in the tree that matches
// - If looking in the npx cache check if a newer version is available
const npxByNameOnly = isNpxTree && spec.name === spec.raw
// If they gave a range and not a tag we still need to check if it's outdated.
if (spec.registry && spec.type !== 'tag' && !npxByNameOnly) {
// registry spec that is not a specific tag.
const nodesBySpec = tree.inventory.query('packageName', spec.name)
Expand All @@ -54,7 +55,8 @@ const missingFromTree = async ({ spec, tree, flatOptions, isNpxTree, shallow })
return { node }
}
// package requested by version range, only remaining registry type
if (semver.satisfies(node.package.version, spec.rawSpec)) {
// the npx tree shouldn't be ok w/ an outdated version
if (!isNpxTree && semver.satisfies(node.package.version, spec.rawSpec)) {
return { node }
}
}
Expand Down

0 comments on commit 32ba17f

Please sign in to comment.