Skip to content

fix: Correct path resolution for file dependencies in linked install strategy #8282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: latest
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions workspaces/arborist/lib/arborist/isolated-reifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
const { join } = require('node:path')
const { depth } = require('treeverse')
const crypto = require('node:crypto')
const path = require('node:path')

Check failure on line 9 in workspaces/arborist/lib/arborist/isolated-reifier.js

View workflow job for this annotation

GitHub Actions / Lint

'path' is assigned a value but never used

// cache complicated function results
const memoize = (fn) => {
Expand Down Expand Up @@ -96,6 +97,7 @@
result.localPath = node.path
result.isWorkspace = true
result.resolved = node.resolved
result.isLink = node.isLink || false
await this.assignCommonProperties(node, result)
}

Expand Down Expand Up @@ -136,6 +138,7 @@
result.optional = node.optional
result.resolved = node.resolved
result.version = node.version
result.isLink = node.isLink || false
}

async assignCommonProperties (node, result) {
Expand Down Expand Up @@ -317,11 +320,15 @@
hasShrinkwrap: false,
inDepBundle: false,
integrity: null,
isLink: false,
isLink: node.isLink || false,
isRoot: false,
isInStore: inStore,
path: join(proxiedIdealTree.root.localPath, location),
realpath: join(proxiedIdealTree.root.localPath, location),
path: node.isLink ?
join(proxiedIdealTree.root.localPath, node.locationPath || '', location) :

Check failure on line 327 in workspaces/arborist/lib/arborist/isolated-reifier.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 10 spaces but found 8
join(proxiedIdealTree.root.localPath, location),

Check failure on line 328 in workspaces/arborist/lib/arborist/isolated-reifier.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 10 spaces but found 8
realpath: node.isLink ?
join(proxiedIdealTree.root.localPath, node.locationPath || '', location) :

Check failure on line 330 in workspaces/arborist/lib/arborist/isolated-reifier.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 10 spaces but found 8
join(proxiedIdealTree.root.localPath, location),

Check failure on line 331 in workspaces/arborist/lib/arborist/isolated-reifier.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 10 spaces but found 8
resolved: node.resolved,
version: pkg.version,
package: pkg,
Expand Down Expand Up @@ -367,14 +374,19 @@
nmFolder = join('node_modules', '.store', key, 'node_modules')
} else {
from = node.isProjectRoot ? root : root.fsChildren.find(c => c.location === node.localLocation)
nmFolder = join(node.localLocation, 'node_modules')
nmFolder = node.isLink ?
join(proxiedIdealTree.root.localPath, node.localLocation || '', 'node_modules') :

Check failure on line 378 in workspaces/arborist/lib/arborist/isolated-reifier.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 10 spaces but found 11
join(node.localLocation, 'node_modules')

Check failure on line 379 in workspaces/arborist/lib/arborist/isolated-reifier.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 10 spaces but found 11
}

const processDeps = (dep, optional, external) => {
optional = !!optional
external = !!external

const location = join(nmFolder, dep.name)
const location = dep.isLink ?
join(proxiedIdealTree.root.localPath, dep.localLocation || '', 'node_modules', dep.name) :
join(nmFolder, dep.name)

const binNames = dep.package.bin && Object.keys(dep.package.bin) || []
const toKey = getKey(dep)

Expand All @@ -388,7 +400,10 @@
// TODO: we should no-op is an edge has already been created with the same fromKey and toKey

binNames.forEach(bn => {
target.binPaths.push(join(from.realpath, 'node_modules', '.bin', bn))
const binPath = dep.isLink ?

Check failure on line 403 in workspaces/arborist/lib/arborist/isolated-reifier.js

View workflow job for this annotation

GitHub Actions / Lint

'binPath' is assigned a value but never used
join(proxiedIdealTree.root.localPath, from.realpath, 'node_modules', '.bin' , bn) :

Check failure on line 404 in workspaces/arborist/lib/arborist/isolated-reifier.js

View workflow job for this annotation

GitHub Actions / Lint

There should be no space before ','
join(from.realpath, 'node_modules', 'bin', bn)
target.binpaths.push(binpath)

Check failure on line 406 in workspaces/arborist/lib/arborist/isolated-reifier.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 10 spaces but found 12
})

const link = {
Expand Down
Loading