Skip to content

Commit 2577eed

Browse files
Optimise dedupe command
1 parent f4897aa commit 2577eed

File tree

2 files changed

+46
-10
lines changed

2 files changed

+46
-10
lines changed

.yarn/versions/5c3d25bd.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
releases:
2+
"@yarnpkg/builder": patch
3+
"@yarnpkg/cli": patch
4+
"@yarnpkg/core": patch
5+
"@yarnpkg/doctor": patch
6+
"@yarnpkg/extensions": patch
7+
"@yarnpkg/nm": patch
8+
"@yarnpkg/plugin-catalog": patch
9+
"@yarnpkg/plugin-compat": patch
10+
"@yarnpkg/plugin-constraints": patch
11+
"@yarnpkg/plugin-dlx": patch
12+
"@yarnpkg/plugin-essentials": patch
13+
"@yarnpkg/plugin-exec": patch
14+
"@yarnpkg/plugin-file": patch
15+
"@yarnpkg/plugin-git": patch
16+
"@yarnpkg/plugin-github": patch
17+
"@yarnpkg/plugin-http": patch
18+
"@yarnpkg/plugin-init": patch
19+
"@yarnpkg/plugin-interactive-tools": patch
20+
"@yarnpkg/plugin-jsr": patch
21+
"@yarnpkg/plugin-link": patch
22+
"@yarnpkg/plugin-nm": patch
23+
"@yarnpkg/plugin-npm": patch
24+
"@yarnpkg/plugin-npm-cli": patch
25+
"@yarnpkg/plugin-pack": patch
26+
"@yarnpkg/plugin-patch": patch
27+
"@yarnpkg/plugin-pnp": patch
28+
"@yarnpkg/plugin-pnpm": patch
29+
"@yarnpkg/plugin-stage": patch
30+
"@yarnpkg/plugin-typescript": patch
31+
"@yarnpkg/plugin-version": patch
32+
"@yarnpkg/plugin-workspace-tools": patch
33+
"@yarnpkg/pnpify": patch
34+
"@yarnpkg/sdks": patch

packages/plugin-essentials/sources/commands/dedupe.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,18 @@ export default class DedupeCommand extends BaseCommand {
116116
if (dedupeReport.hasErrors())
117117
return dedupeReport.exitCode();
118118

119-
if (this.check) {
119+
if (this.check)
120120
return dedupedPackageCount ? 1 : 0;
121-
} else {
122-
return await project.installWithNewReport({
123-
json: this.json,
124-
stdout: this.context.stdout,
125-
}, {
126-
cache,
127-
mode: this.mode,
128-
});
129-
}
121+
122+
if (dedupedPackageCount === 0)
123+
return 0;
124+
125+
return await project.installWithNewReport({
126+
json: this.json,
127+
stdout: this.context.stdout,
128+
}, {
129+
cache,
130+
mode: this.mode,
131+
});
130132
}
131133
}

0 commit comments

Comments
 (0)