Skip to content

Commit a4982dc

Browse files
committed
fix: only set --all flag for Yarn 4
1 parent aff2d0f commit a4982dc

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/plugin-package/src/index.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ describe("Package plugin", () => {
409409
"yarn",
410410
"changed",
411411
"foreach",
412-
"--all",
413412
`--git-range=v${pack.version}`,
414413
"version",
415414
newVersion,

packages/plugin-package/src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,17 @@ Alternatively, you can use ${context.cli.colors.blue("lerna")} to manage the mon
295295
);
296296

297297
await deleteStableVersions();
298+
const yarnGte4 =
299+
context.hasData("yarn_version") &&
300+
semver.gte(context.getData<string>("yarn_version"), "4.0.0");
301+
298302
const commands = [
299303
publishAll
300304
? [
301305
"yarn",
302306
"workspaces",
303307
"foreach",
304-
"--all",
308+
...(yarnGte4 ? ["--all"] : []),
305309
"version",
306310
newVersion,
307311
"--deferred",
@@ -310,7 +314,7 @@ Alternatively, you can use ${context.cli.colors.blue("lerna")} to manage the mon
310314
"yarn",
311315
"changed",
312316
"foreach",
313-
"--all",
317+
...(yarnGte4 ? ["--all"] : []),
314318
`--git-range=v${pack.version}`,
315319
"version",
316320
newVersion,

0 commit comments

Comments
 (0)