You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: clarify task shorthand and clarify array command semantics
Move the task command shorthand description out from under the
\`command\` heading to the \`tasks\` section, since it sets a task value
not a command field. Add an explicit note that array commands chain
sequentially like \`&&\`, not split a single command into argv tokens.
https://claude.ai/code/session_01N7sZTbj8K2QYvMAWUB1Nmz
Defines tasks that can be run with `vp run <task>`.
67
67
68
+
As a shorthand, a task value can be a command string or an array of command strings directly:
69
+
70
+
```ts [vite.config.ts]
71
+
tasks: {
72
+
build: 'vp build',
73
+
check: ['vp lint', 'vp build'],
74
+
}
75
+
```
76
+
77
+
These are equivalent to setting only `command` on a task config:
78
+
79
+
```ts [vite.config.ts]
80
+
tasks: {
81
+
build: { command: 'vp build' },
82
+
check: { command: ['vp lint', 'vp build'] },
83
+
}
84
+
```
85
+
86
+
Use the object form when a task needs other fields like `cache`, `dependsOn`, `env`, or `input`.
87
+
68
88
### `command`
69
89
70
90
-**Type:**`string | string[]`
71
91
72
-
Defines the shell command to run for the task. An array runs each entry sequentially, equivalent to joining them with `&&`.
92
+
Defines the shell command to run for the task. The string is interpreted by a shell, so spaces, quoting, `&&`, pipes, and redirects all work as written on the command line.
73
93
74
94
```ts [vite.config.ts]
75
95
tasks: {
76
96
build: {
77
97
command: 'vp build',
78
98
},
79
-
check: {
80
-
command: ['vp lint', 'vp build'],
81
-
},
82
99
}
83
100
```
84
101
85
-
As a shorthand, a task value can also be a command string or array of command strings directly, without the surrounding object:
102
+
An array runs each entry as its own command, sequentially, equivalent to joining them with `&&`. It is **not** a way to split one command into argv tokens — `['vp', 'build']` would try to run a command called `vp` with no arguments, then a command called `build`, instead of `vp build`.
86
103
87
104
```ts [vite.config.ts]
88
105
tasks: {
89
-
build: 'vp build',
90
-
check: ['vp lint', 'vp build'],
106
+
check: {
107
+
// Two commands, run in order
108
+
command: ['vp lint', 'vp build'],
109
+
},
110
+
bad: {
111
+
// Wrong: this is NOT `vp build`; it is `vp` followed by `build`
0 commit comments