-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(deploy): preserve relative paths to linked internal dependencies #9677
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
base: main
Are you sure you want to change the base?
fix(deploy): preserve relative paths to linked internal dependencies #9677
Conversation
NotesResults of the
The bug was suspected to be caused by the following lines: projectDir: (
options.currentDepth > 0 &&
!wantedDependency.bareSpecifier.startsWith('file:')
)
? ctx.lockfileDir
: options.parentPkg.rootDir, But adding I added another modification to diff --git a/pkg-manager/resolve-dependencies/src/resolvePeers.ts b/pkg-manager/resolve-dependencies/src/resolvePeers.ts
index 07830ddd1..6bb42549a 100644
--- a/pkg-manager/resolve-dependencies/src/resolvePeers.ts
+++ b/pkg-manager/resolve-dependencies/src/resolvePeers.ts
@@ -387,7 +387,7 @@ async function resolvePeersOfNode<T extends PartialResolvedPackage> (
}
): Promise<PeersResolution & { finishing?: FinishingResolutionPromise, calculateDepPath?: CalculateDepPath }> {
const node = ctx.dependenciesTree.get(nodeId)!
- if (node.depth === -1) return { resolvedPeers: new Map<string, NodeId>(), missingPeers: new Map<string, MissingPeerInfo>() }
+ if (!node || node.depth === -1) return { resolvedPeers: new Map<string, NodeId>(), missingPeers: new Map<string, MissingPeerInfo>() }
const resolvedPackage = node.resolvedPackage as T
if (
ctx.purePkgs.has(resolvedPackage.pkgIdWithPatchHash) &&
I injected const _resolve = path.resolve
path.resolve = (...paths: string[]) => {
const last = paths.at(-1)!
if (
paths.length > 1 &&
(last === 'c' || last.endsWith('/c')) &&
!paths.at(-2)?.endsWith('node_modules') &&
paths.at(-2) !== 'a' &&
!paths.at(-2)?.endsWith('/a')
) {
console.trace('PATH RESOLVE', paths)
}
return _resolve(...paths)
} This trace appears (also in the file
I investigated for (const node of Object.values(graph)) {
const pkgSnapshot = lockfile.packages![node.depPath]
const allDeps = {
...pkgSnapshot.dependencies,
...(opts.include.optionalDependencies ? pkgSnapshot.optionalDependencies : {}),
}
const peerDeps = pkgSnapshot.peerDependencies ? new Set(Object.keys(pkgSnapshot.peerDependencies)) : null
node.children = _getChildrenPaths(allDeps, peerDeps, '.')
} It turns out that Seeing that it would take far more effort than initially estimated to fix this bug, I decided to abandon this. The above notes may be helpful for anyone who wants to continue. |
Fixes #9575