Skip to content

Commit 3276aa4

Browse files
larixermerceyz
authored andcommitted
fix(pnpm): pnpm linker no longer removes node_modules when nm linker is active (#4206)
* Fix: pnpm linker no longer removes node_modules when nm linker is active * Updates artifact cleanup code
1 parent 24a1724 commit 3276aa4

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

.yarn/versions/dafa68fb.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
releases:
2+
"@yarnpkg/cli": patch
3+
"@yarnpkg/plugin-pnpm": patch
4+
5+
declined:
6+
- "@yarnpkg/plugin-compat"
7+
- "@yarnpkg/plugin-constraints"
8+
- "@yarnpkg/plugin-dlx"
9+
- "@yarnpkg/plugin-essentials"
10+
- "@yarnpkg/plugin-init"
11+
- "@yarnpkg/plugin-interactive-tools"
12+
- "@yarnpkg/plugin-nm"
13+
- "@yarnpkg/plugin-npm-cli"
14+
- "@yarnpkg/plugin-pack"
15+
- "@yarnpkg/plugin-patch"
16+
- "@yarnpkg/plugin-pnp"
17+
- "@yarnpkg/plugin-stage"
18+
- "@yarnpkg/plugin-typescript"
19+
- "@yarnpkg/plugin-version"
20+
- "@yarnpkg/plugin-workspace-tools"
21+
- "@yarnpkg/builder"
22+
- "@yarnpkg/core"
23+
- "@yarnpkg/doctor"

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Yarn now accepts sponsorships! Please give a look at our [OpenCollective](https:
66

77
## Master
88

9+
### Installs
10+
- The pnpm linker no longer tries to remove `node_modules` directory, when `node-modules` linker is active
11+
912
**Note:** features in `master` can be tried out by running `yarn set version from sources` in your project (existing contrib plugins are updated automatically, while new contrib plugins can be added by running `yarn plugin import from sources <name>`).
1013

1114
### Installs

packages/plugin-pnpm/sources/PnpmLinker.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,11 @@ class PnpmInstaller implements Installer {
274274
}
275275

276276
// Wait for the package installs to catch up
277-
await this.asyncActions.wait(),
277+
await this.asyncActions.wait();
278278

279279
await removeIfEmpty(storeLocation);
280-
await removeIfEmpty(getNodeModulesLocation(this.opts.project));
280+
if (this.opts.project.configuration.get(`nodeLinker`) !== `node-modules`)
281+
await removeIfEmpty(getNodeModulesLocation(this.opts.project));
281282

282283
return {
283284
customData: this.customData,

0 commit comments

Comments
 (0)