Skip to content

Commit 9cefe44

Browse files
committed
fix: workspaces foreach should take --all by default
1 parent c3b319a commit 9cefe44

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

.yarn/versions/ecd497b5.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-workspace-tools": 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-pnpm"
18+
- "@yarnpkg/plugin-stage"
19+
- "@yarnpkg/plugin-typescript"
20+
- "@yarnpkg/plugin-version"
21+
- "@yarnpkg/builder"
22+
- "@yarnpkg/core"
23+
- "@yarnpkg/doctor"

packages/plugin-workspace-tools/sources/commands/foreach.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export default class WorkspacesForeachCommand extends BaseCommand {
6464

6565
static schema = [
6666
t.hasKeyRelationship(`all`, t.KeyRelationship.Forbids, [`from`, `recursive`, `since`, `worktree`], {missingIf: `undefined`}),
67-
t.hasAtLeastOneKey([`all`, `recursive`, `since`, `worktree`], {missingIf: `undefined`}),
6867
];
6968

7069
from = Option.Array(`--from`, {
@@ -136,6 +135,14 @@ export default class WorkspacesForeachCommand extends BaseCommand {
136135
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
137136
const {project, workspace: cwdWorkspace} = await Project.find(configuration, this.context.cwd);
138137

138+
if ([`all`, `recursive`, `since`, `worktree`].every(opt => this[opt] === undefined)) {
139+
if (this.from === undefined) {
140+
this.all = true;
141+
} else {
142+
this.recursive = true;
143+
}
144+
}
145+
139146
if (!this.all && !cwdWorkspace)
140147
throw new WorkspaceRequiredError(project.cwd, this.context.cwd);
141148

0 commit comments

Comments
 (0)