Skip to content
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

fix: don't symlink the autoinstalled peers to the root of node_modules #4998

Merged
merged 1 commit into from Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/early-bats-sell.md
@@ -0,0 +1,6 @@
---
"@pnpm/core": patch
"pnpm": patch
---

Don't symlink the autoinstalled peer dependencies to the root of `node_modules` [#4988](https://github.com/pnpm/pnpm/issues/4988).
2 changes: 2 additions & 0 deletions packages/core/src/install/link.ts
Expand Up @@ -160,8 +160,10 @@ export default async function linkPackages (
if (opts.symlink) {
await Promise.all(projects.map(async ({ id, manifest, modulesDir, rootDir }) => {
const deps = opts.dependenciesByProjectId[id]
const importerFromLockfile = newCurrentLockfile.importers[id]
await Promise.all([
...Object.entries(deps)
.filter(([rootAlias]) => importerFromLockfile.specifiers[rootAlias])
.map(([rootAlias, depPath]) => ({ rootAlias, depGraphNode: depGraph[depPath] }))
.filter(({ depGraphNode }) => depGraphNode)
.map(async ({ rootAlias, depGraphNode }) => {
Expand Down
1 change: 1 addition & 0 deletions packages/core/test/install/autoInstallPeers.ts
Expand Up @@ -12,6 +12,7 @@ test('auto install non-optional peer dependencies', async () => {
'/abc-optional-peers/1.0.0_peer-a@1.0.0',
'/peer-a/1.0.0',
])
await project.hasNot('peer-a')
})

test('auto install the common peer dependency', async () => {
Expand Down