Skip to content

Commit ac2fabb

Browse files
lukekarryswraithgar
authored andcommitted
deps: @npmcli/[email protected]
PR-URL: #3990 Credit: @lukekarrys Close: #3990 Reviewed-by: @wraithgar
1 parent 32ccd3c commit ac2fabb

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

node_modules/@npmcli/arborist/lib/arborist/reify.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,10 @@ module.exports = cls => class Reifier extends cls {
11731173
}
11741174

11751175
let newSpec
1176+
// True if the dependency is getting installed from a local file path
1177+
// In this case it is not possible to do the normal version comparisons
1178+
// as the new version will be a file path
1179+
const isLocalDep = req.type === 'directory' || req.type === 'file'
11761180
if (req.registry) {
11771181
const version = child.version
11781182
const prefixRange = version ? this[_savePrefix] + version : '*'
@@ -1204,7 +1208,7 @@ module.exports = cls => class Reifier extends cls {
12041208
} else {
12051209
newSpec = h.shortcut(opt)
12061210
}
1207-
} else if (req.type === 'directory' || req.type === 'file') {
1211+
} else if (isLocalDep) {
12081212
// save the relative path in package.json
12091213
// Normally saveSpec is updated with the proper relative
12101214
// path already, but it's possible to specify a full absolute
@@ -1233,11 +1237,11 @@ module.exports = cls => class Reifier extends cls {
12331237
if (hasSubKey(pkg, 'devDependencies', name)) {
12341238
pkg.devDependencies[name] = newSpec
12351239
// don't update peer or optional if we don't have to
1236-
if (hasSubKey(pkg, 'peerDependencies', name) && !intersects(newSpec, pkg.peerDependencies[name])) {
1240+
if (hasSubKey(pkg, 'peerDependencies', name) && (isLocalDep || !intersects(newSpec, pkg.peerDependencies[name]))) {
12371241
pkg.peerDependencies[name] = newSpec
12381242
}
12391243

1240-
if (hasSubKey(pkg, 'optionalDependencies', name) && !intersects(newSpec, pkg.optionalDependencies[name])) {
1244+
if (hasSubKey(pkg, 'optionalDependencies', name) && (isLocalDep || !intersects(newSpec, pkg.optionalDependencies[name]))) {
12411245
pkg.optionalDependencies[name] = newSpec
12421246
}
12431247
} else {

node_modules/@npmcli/arborist/lib/place-dep.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,12 @@ class PlaceDep {
407407
for (const entryEdge of peerEntrySets(edge.from).keys()) {
408408
// either this one needs to be pruned and re-evaluated, or marked
409409
// as peerConflicted and warned about. If the entryEdge comes in from
410-
// the root, then we have to leave it alone, and in that case, it
411-
// will have already warned or crashed by getting to this point.
410+
// the root or a workspace, then we have to leave it alone, and in that
411+
// case, it will have already warned or crashed by getting to this point
412412
const entryNode = entryEdge.to
413413
const deepestTarget = deepestNestingTarget(entryNode)
414-
if (deepestTarget !== target && !entryEdge.from.isRoot) {
414+
if (deepestTarget !== target &&
415+
!(entryEdge.from.isProjectRoot || entryEdge.from.isWorkspace)) {
415416
prunePeerSets.push(...gatherDepSet([entryNode], e => {
416417
return e.to !== entryNode && !e.peerConflicted
417418
}))

node_modules/@npmcli/arborist/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@npmcli/arborist",
3-
"version": "4.0.3",
3+
"version": "4.0.4",
44
"description": "Manage node_modules trees",
55
"dependencies": {
66
"@isaacs/string-locale-compare": "^1.0.1",

package-lock.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
],
8787
"dependencies": {
8888
"@isaacs/string-locale-compare": "^1.1.0",
89-
"@npmcli/arborist": "^4.0.3",
89+
"@npmcli/arborist": "^4.0.4",
9090
"@npmcli/ci-detect": "^1.4.0",
9191
"@npmcli/config": "^2.3.0",
9292
"@npmcli/map-workspaces": "^2.0.0",
@@ -772,9 +772,9 @@
772772
}
773773
},
774774
"node_modules/@npmcli/arborist": {
775-
"version": "4.0.3",
776-
"resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.3.tgz",
777-
"integrity": "sha512-gFz/dNJtpv2bYXlupcUpEaWlFDRUNmvVnQNbE6dY4ild6beZ2SkG4R5/CM4GZZwj9HD2TyfGjO350Ja+xlLzuA==",
775+
"version": "4.0.4",
776+
"resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.4.tgz",
777+
"integrity": "sha512-5hRkiHF9zu62z6a7CJqhVG5CFUVnbYqvrrcxxEmhxFgyH2ovICyULOrj7nF4VBlfzp7OPu/rveV2ts9iYrn74g==",
778778
"inBundle": true,
779779
"dependencies": {
780780
"@isaacs/string-locale-compare": "^1.0.1",
@@ -11082,9 +11082,9 @@
1108211082
"dev": true
1108311083
},
1108411084
"@npmcli/arborist": {
11085-
"version": "4.0.3",
11086-
"resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.3.tgz",
11087-
"integrity": "sha512-gFz/dNJtpv2bYXlupcUpEaWlFDRUNmvVnQNbE6dY4ild6beZ2SkG4R5/CM4GZZwj9HD2TyfGjO350Ja+xlLzuA==",
11085+
"version": "4.0.4",
11086+
"resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.4.tgz",
11087+
"integrity": "sha512-5hRkiHF9zu62z6a7CJqhVG5CFUVnbYqvrrcxxEmhxFgyH2ovICyULOrj7nF4VBlfzp7OPu/rveV2ts9iYrn74g==",
1108811088
"requires": {
1108911089
"@isaacs/string-locale-compare": "^1.0.1",
1109011090
"@npmcli/installed-package-contents": "^1.0.7",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
},
5656
"dependencies": {
5757
"@isaacs/string-locale-compare": "^1.1.0",
58-
"@npmcli/arborist": "^4.0.3",
58+
"@npmcli/arborist": "^4.0.4",
5959
"@npmcli/ci-detect": "^1.4.0",
6060
"@npmcli/config": "^2.3.0",
6161
"@npmcli/map-workspaces": "^2.0.0",

0 commit comments

Comments
 (0)