Skip to content

Commit 2ec0c76

Browse files
branchseerclaude
andcommitted
docs: use string arrays for style 1, add comparison table
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1113d51 commit 2ec0c76

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

docs/depends-on.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Two equivalent styles are proposed.
3333

3434
### Style 1: CLI string syntax
3535

36-
Each `dependsOn` element is a string (or array of strings) written exactly as you would type CLI arguments to `vp run`:
36+
Each `dependsOn` element is a string (existing syntax) or a string array written exactly as you would type CLI arguments to `vp run`:
3737

3838
```jsonc
3939
{
@@ -45,25 +45,21 @@ Each `dependsOn` element is a string (or array of strings) written exactly as yo
4545
"utils#build",
4646

4747
// Run `build` across all workspace packages
48-
"--recursive build",
48+
["--recursive", "build"],
4949

5050
// Run `build` in current package and its transitive dependencies
51-
"--transitive build",
51+
["--transitive", "build"],
5252

5353
// Run `build` in packages matching a filter
54-
"--filter @myorg/core build",
55-
"--filter @myorg/core... build", // @myorg/core and its deps
56-
57-
// Array form — each element is one CLI token
5854
["--filter", "@myorg/core", "build"],
59-
["--transitive", "build"],
55+
["--filter", "@myorg/core...", "build"], // @myorg/core and its deps
6056
],
6157
},
6258
},
6359
}
6460
```
6561

66-
The parser splits a string element on whitespace (like a shell would) and interprets the tokens as `vp run` arguments. The array form avoids splitting entirely — useful when a filter value contains whitespace or for explicitness.
62+
Each element in the array is one CLI token, exactly as you would pass to `vp run`.
6763

6864
**Supported flags:**
6965

@@ -128,3 +124,11 @@ The same validation rules from the CLI apply:
128124
## Context: "Current Package"
129125

130126
When `--transitive` or a filter with traversal suffixes (e.g. `@myorg/core...`) resolves packages, "current package" means the package that owns the task containing this `dependsOn` entry — the same package that would be inferred from an unqualified `"build"` dependency today.
127+
128+
## Comparison
129+
130+
| | Style 1 (CLI string) | Style 2 (Object) |
131+
| ------------------ | -------------------------------------------------------------- | ------------------------------------------------------------------ |
132+
| Learning curve | None if you already know `vp run` — identical syntax | Minimal — same flag names, written as JSON keys |
133+
| IDE autocompletion | Yes — TypeScript tuple types can constrain each array position | Yes — TypeScript object types can validate keys and suggest fields |
134+
| Config consistency | Unusual — CLI syntax embedded in config arrays | Consistent — matches the object style used elsewhere in the config |

0 commit comments

Comments
 (0)