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:
authorGar <gar+gh@danger.computer>2022-08-24 17:19:31 +0300
committerLuke Karrys <luke@lukekarrys.com>2022-08-24 20:52:33 +0300
commit1e841029917817556207c39d25be1ea91e2959e7 (patch)
treed6daa4ac6b071b99a88823fa3133fb6c455c6647 /workspaces/arborist/lib
parentea5e3a319a7c1b5f7f2a66284227a34b79b2c831 (diff)
fix: create links relative to the target
Added link deps need to be relative to the package they're being added to, not the project root. In the past the project root was the only place you could add things but workspaces changed this.
Diffstat (limited to 'workspaces/arborist/lib')
-rw-r--r--workspaces/arborist/lib/arborist/build-ideal-tree.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/workspaces/arborist/lib/arborist/build-ideal-tree.js b/workspaces/arborist/lib/arborist/build-ideal-tree.js
index 64d72beda..e9a8720d7 100644
--- a/workspaces/arborist/lib/arborist/build-ideal-tree.js
+++ b/workspaces/arborist/lib/arborist/build-ideal-tree.js
@@ -511,17 +511,18 @@ Try using the package name instead, e.g:
this[_depsQueue].push(tree)
}
- // This returns a promise because we might not have the name yet,
- // and need to call pacote.manifest to find the name.
+ // This returns a promise because we might not have the name yet, and need to
+ // call pacote.manifest to find the name.
async [_add] (tree, { add, saveType = null, saveBundle = false }) {
- const path = this.idealTree.target.path
+ // If we have a link it will need to be added relative to the target's path
+ const path = tree.target.path
+
// get the name for each of the specs in the list.
- // ie, doing `foo@bar` we just return foo
- // but if it's a url or git, we don't know the name until we
- // fetch it and look in its manifest.
+ // ie, doing `foo@bar` we just return foo but if it's a url or git, we
+ // don't know the name until we fetch it and look in its manifest.
await Promise.all(add.map(async rawSpec => {
- // We do NOT provide the path to npa here, because user-additions
- // need to be resolved relative to the CWD the user is in.
+ // We do NOT provide the path to npa here, because user-additions need to
+ // be resolved relative to the tree being added to.
let spec = npa(rawSpec)
// if it's just @'' then we reload whatever's there, or get latest