Skip to content

Commit

Permalink
fix: don't symlink the autoinstalled peers to the root of node_modules
Browse files Browse the repository at this point in the history
close #4988
  • Loading branch information
zkochan committed Jul 8, 2022
1 parent 716a29a commit a842013
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
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

0 comments on commit a842013

Please sign in to comment.