Skip to content

Commit 1113d51

Browse files
branchseerclaude
andcommitted
docs: use shorthand object syntax in dependsOn RFC
Task name is passed as the value of the flag key (e.g. `{ "transitive": "build" }`) instead of a separate `task` field with a boolean flag. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7ec16e6 commit 1113d51

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

docs/depends-on.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ These simple forms remain valid and unchanged under both proposed styles.
2929

3030
## Proposed Syntax
3131

32+
Two equivalent styles are proposed.
33+
3234
### Style 1: CLI string syntax
3335

3436
Each `dependsOn` element is a string (or array of strings) written exactly as you would type CLI arguments to `vp run`:
@@ -88,10 +90,10 @@ Each `dependsOn` element can be an object whose keys mirror the CLI flag names:
8890
"utils#build",
8991

9092
// Run `build` across all workspace packages
91-
{ "recursive": true, "task": "build" },
93+
{ "recursive": "build" },
9294

9395
// Run `build` in current package and its transitive dependencies
94-
{ "transitive": true, "task": "build" },
96+
{ "transitive": "build" },
9597

9698
// Run `build` in packages matching a filter
9799
{ "filter": "@myorg/core", "task": "build" },
@@ -101,28 +103,27 @@ Each `dependsOn` element can be an object whose keys mirror the CLI flag names:
101103
{ "filter": ["@myorg/core", "@myorg/utils"], "task": "build" },
102104

103105
// Workspace root
104-
{ "workspaceRoot": true, "task": "build" },
106+
{ "workspaceRoot": "build" },
105107
],
106108
},
107109
},
108110
}
109111
```
110112

111-
**Object fields:**
113+
**Object forms:**
112114

113-
| Field | Type | Meaning |
114-
| --------------- | -------------------- | ---------------------------------------------------------- |
115-
| `task` | `string` | **Required.** Task specifier (`"build"` or `"pkg#build"`). |
116-
| `recursive` | `boolean` | Select all workspace packages. |
117-
| `transitive` | `boolean` | Select current package + transitive dependencies. |
118-
| `filter` | `string \| string[]` | Select packages by filter expression(s). |
119-
| `workspaceRoot` | `boolean` | Select the workspace root package. |
115+
| Form | Meaning |
116+
| -------------------------------------------------- | ---------------------------------------------------------------- |
117+
| `{ "recursive": "<task>" }` | Run `<task>` across all workspace packages. |
118+
| `{ "transitive": "<task>" }` | Run `<task>` in current package and its transitive dependencies. |
119+
| `{ "filter": "<pattern>", "task": "<task>" }` | Run `<task>` in packages matching a filter expression. |
120+
| `{ "filter": ["<p1>", "<p2>"], "task": "<task>" }` | Run `<task>` in packages matching multiple filters. |
121+
| `{ "workspaceRoot": "<task>" }` | Run `<task>` in the workspace root package. |
120122

121123
The same validation rules from the CLI apply:
122124

123-
- `recursive` and `transitive` are mutually exclusive.
124-
- `filter` cannot be combined with `recursive` or `transitive`.
125-
- When `task` contains a `#` (e.g. `"pkg#build"`), it cannot be combined with `recursive` or `filter`.
125+
- `recursive`, `transitive`, `filter`, and `workspaceRoot` are mutually exclusive.
126+
- When using `filter`, the task name goes in a separate `task` field (since `filter` takes a pattern as its value).
126127

127128
## Context: "Current Package"
128129

0 commit comments

Comments
 (0)