Commit 34bce5c
fix: make task command required (#224)
## Summary
This change makes the `command` field mandatory in task configurations
within `vite-task.json`. Previously, tasks could omit the command and
fall back to a corresponding script defined in `package.json`. This
change simplifies the configuration model by requiring explicit command
definitions.
## Key Changes
- **Made `command` field required**: Changed `UserTaskConfig.command`
from `Option<Box<str>>` to `Box<str>`, making it a required field during
deserialization
- **Removed fallback logic**: Eliminated the fallback mechanism that
would use `package.json` scripts when a task command was omitted
- **Removed error variants**: Deleted
`ResolveTaskConfigError::CommandConflict` and
`ResolveTaskConfigError::NoCommand` as they are no longer needed
- **Simplified task resolution**: Updated
`ResolvedTaskConfig::resolve()` to only accept user config and package
directory, removing the `package_json_script` parameter
- **Updated test fixtures**: Modified all test fixtures to explicitly
define commands in `vite-task.json` instead of relying on `package.json`
scripts
- **Updated documentation**: Modified TypeScript type definitions and
CLAUDE.md to reflect that `command` is now required
## Implementation Details
- Tasks defined in `vite-task.json` must now include an explicit
`command` field
- Package.json scripts are no longer used as fallbacks for task commands
- The configuration is now more explicit and reduces ambiguity about
which command will be executed
- All existing test fixtures were updated to comply with the new
requirement
https://claude.ai/code/session_01LMFoqFGF6abfJ3WuSeEoRk
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 24434e8 commit 34bce5c
File tree
22 files changed
+78
-56
lines changed- crates
- vite_task_bin/tests/e2e_snapshots/fixtures/task-list/packages
- app
- lib
- vite_task_graph
- src
- config
- vite_task_plan/tests/plan_snapshots/fixtures
- cache-scripts-task-override
- snapshots
- cache-tasks-disabled
- cache-true-no-force-enable
- script-conflict
- snapshots
- workspace-root-depends-on-passthrough
22 files changed
+78
-56
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | 3 | | |
8 | 4 | | |
9 | 5 | | |
| |||
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 2 | + | |
6 | 3 | | |
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | 6 | | |
9 | | - | |
| 7 | + | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | 246 | | |
255 | 247 | | |
256 | 248 | | |
| |||
288 | 280 | | |
289 | 281 | | |
290 | 282 | | |
291 | | - | |
| 283 | + | |
292 | 284 | | |
293 | 285 | | |
294 | 286 | | |
295 | | - | |
296 | | - | |
| 287 | + | |
297 | 288 | | |
298 | 289 | | |
299 | 290 | | |
300 | | - | |
301 | 291 | | |
302 | 292 | | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | 293 | | |
310 | | - | |
| 294 | + | |
311 | 295 | | |
312 | 296 | | |
313 | 297 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
146 | | - | |
| 144 | + | |
147 | 145 | | |
148 | 146 | | |
149 | 147 | | |
| |||
365 | 363 | | |
366 | 364 | | |
367 | 365 | | |
368 | | - | |
| 366 | + | |
369 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
370 | 379 | | |
371 | 380 | | |
372 | 381 | | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
| 382 | + | |
378 | 383 | | |
379 | 384 | | |
380 | 385 | | |
381 | 386 | | |
382 | 387 | | |
383 | 388 | | |
| 389 | + | |
384 | 390 | | |
385 | 391 | | |
386 | 392 | | |
| |||
390 | 396 | | |
391 | 397 | | |
392 | 398 | | |
| 399 | + | |
393 | 400 | | |
394 | 401 | | |
395 | 402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
98 | 104 | | |
99 | 105 | | |
100 | 106 | | |
| |||
264 | 270 | | |
265 | 271 | | |
266 | 272 | | |
267 | | - | |
268 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
269 | 283 | | |
270 | 284 | | |
271 | 285 | | |
272 | 286 | | |
273 | 287 | | |
274 | | - | |
| 288 | + | |
275 | 289 | | |
276 | 290 | | |
277 | 291 | | |
278 | | - | |
279 | 292 | | |
280 | 293 | | |
281 | 294 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
0 commit comments