Skip to content

Commit 8961354

Browse files
authored
test(plan): cover duplicate dependsOn fields (#480)
## Motivation Cover object-form `dependsOn` when the same workspace package appears in both `dependencies` and `devDependencies`, and clarify the changelog example for the feature.
1 parent 4212c17 commit 8961354

8 files changed

Lines changed: 170 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
22

33
- **Added** First-party support for caching `vite build` with zero cache config, giving Vite projects correct cache hits out of the box ([vitejs/vite#22453](https://github.com/vitejs/vite/pull/22453)).
4-
- **Added** Object-form `dependsOn` entries for direct workspace dependencies ([#479](https://github.com/voidzero-dev/vite-task/pull/479)).
4+
- **Added** Support for specifying tasks from dependency packages in `dependsOn`, such as `dependsOn: [{ "task": "build", "from": "dependencies" }]` ([#479](https://github.com/voidzero-dev/vite-task/pull/479)).
55
- **Added** [`@voidzero-dev/vite-task-client`](https://npmx.dev/package/@voidzero-dev/vite-task-client), allowing tools to report cache information to Vite Task at runtime so users do not need to configure it manually ([#441](https://github.com/voidzero-dev/vite-task/pull/441), [#454](https://github.com/voidzero-dev/vite-task/pull/454), [#449](https://github.com/voidzero-dev/vite-task/pull/449), [#450](https://github.com/voidzero-dev/vite-task/pull/450), [#458](https://github.com/voidzero-dev/vite-task/pull/458), [#431](https://github.com/voidzero-dev/vite-task/pull/431), [#459](https://github.com/voidzero-dev/vite-task/pull/459), [#472](https://github.com/voidzero-dev/vite-task/pull/472)).
66
- **Changed** Cached tasks now restore automatically tracked output files by default; use `output: []` to disable restoration ([#460](https://github.com/voidzero-dev/vite-task/pull/460), [#461](https://github.com/voidzero-dev/vite-task/pull/461)).
77
- **Changed** Environment values in task cache fingerprints are now stored only as SHA-256 digests, and env-related cache miss details report names without values ([#455](https://github.com/voidzero-dev/vite-task/pull/455)).
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "@test/object-depends-on-duplicate-fields",
3+
"version": "1.0.0",
4+
"workspaces": [
5+
"packages/*"
6+
]
7+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "@test/a",
3+
"version": "1.0.0",
4+
"dependencies": {
5+
"@test/b": "workspace:*"
6+
},
7+
"devDependencies": {
8+
"@test/b": "workspace:*"
9+
}
10+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"tasks": {
3+
"from_dependencies": {
4+
"command": "vtt from dependencies",
5+
"dependsOn": [{ "task": "build", "from": "dependencies" }]
6+
},
7+
"from_dev_dependencies": {
8+
"command": "vtt from devDependencies",
9+
"dependsOn": [{ "task": "build", "from": "devDependencies" }]
10+
}
11+
}
12+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "@test/b",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"build": "vtt build b"
6+
}
7+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages:
2+
- 'packages/*'
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# task graph
2+
3+
```mermaid
4+
flowchart TD
5+
task_0["<workspace>/packages/a#from_dependencies"]
6+
task_0 --> task_2
7+
task_1["<workspace>/packages/a#from_dev_dependencies"]
8+
task_1 --> task_2
9+
task_2["<workspace>/packages/b#build"]
10+
```
11+
12+
## `<workspace>/packages/a#from_dependencies`
13+
14+
```json
15+
{
16+
"task_display": {
17+
"package_name": "@test/a",
18+
"task_name": "from_dependencies",
19+
"package_path": "<workspace>/packages/a"
20+
},
21+
"resolved_config": {
22+
"commands": [
23+
"vtt from dependencies"
24+
],
25+
"resolved_options": {
26+
"cwd": "<workspace>/packages/a",
27+
"cache_config": {
28+
"env_config": {
29+
"fingerprinted_envs": [],
30+
"untracked_env": [
31+
"<default untracked envs>"
32+
]
33+
},
34+
"input_config": {
35+
"includes_auto": true,
36+
"positive_globs": [],
37+
"negative_globs": []
38+
},
39+
"output_config": {
40+
"includes_auto": true,
41+
"positive_globs": [],
42+
"negative_globs": []
43+
}
44+
}
45+
}
46+
},
47+
"source": "TaskConfig"
48+
}
49+
```
50+
51+
## `<workspace>/packages/a#from_dev_dependencies`
52+
53+
```json
54+
{
55+
"task_display": {
56+
"package_name": "@test/a",
57+
"task_name": "from_dev_dependencies",
58+
"package_path": "<workspace>/packages/a"
59+
},
60+
"resolved_config": {
61+
"commands": [
62+
"vtt from devDependencies"
63+
],
64+
"resolved_options": {
65+
"cwd": "<workspace>/packages/a",
66+
"cache_config": {
67+
"env_config": {
68+
"fingerprinted_envs": [],
69+
"untracked_env": [
70+
"<default untracked envs>"
71+
]
72+
},
73+
"input_config": {
74+
"includes_auto": true,
75+
"positive_globs": [],
76+
"negative_globs": []
77+
},
78+
"output_config": {
79+
"includes_auto": true,
80+
"positive_globs": [],
81+
"negative_globs": []
82+
}
83+
}
84+
}
85+
},
86+
"source": "TaskConfig"
87+
}
88+
```
89+
90+
## `<workspace>/packages/b#build`
91+
92+
```json
93+
{
94+
"task_display": {
95+
"package_name": "@test/b",
96+
"task_name": "build",
97+
"package_path": "<workspace>/packages/b"
98+
},
99+
"resolved_config": {
100+
"commands": [
101+
"vtt build b"
102+
],
103+
"resolved_options": {
104+
"cwd": "<workspace>/packages/b",
105+
"cache_config": {
106+
"env_config": {
107+
"fingerprinted_envs": [],
108+
"untracked_env": [
109+
"<default untracked envs>"
110+
]
111+
},
112+
"input_config": {
113+
"includes_auto": true,
114+
"positive_globs": [],
115+
"negative_globs": []
116+
},
117+
"output_config": {
118+
"includes_auto": true,
119+
"positive_globs": [],
120+
"negative_globs": []
121+
}
122+
}
123+
}
124+
},
125+
"source": "PackageJsonScript"
126+
}
127+
```
128+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cache": true
3+
}

0 commit comments

Comments
 (0)