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
Copy file name to clipboardExpand all lines: docs/config/run.md
+11-12Lines changed: 11 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,9 +46,8 @@ Defines tasks that can be run with `vp run <task>`.
46
46
### `command`
47
47
48
48
-**Type:**`string`
49
-
-**Default:** matching `package.json` script
50
49
51
-
The shell command to run.
50
+
Defines the shell command to run for the task.
52
51
53
52
```ts
54
53
tasks: {
@@ -58,7 +57,7 @@ tasks: {
58
57
}
59
58
```
60
59
61
-
You cannot define a command in both `vite.config.ts` and `package.json` with the same task name.
60
+
Each task defined in `vite.config.ts` must include its own `command`. You cannot define a task in both `vite.config.ts` and `package.json` with the same task name.
62
61
63
62
Commands joined with `&&` are automatically split into independently cached sub-tasks. See [Compound Commands](/guide/run#compound-commands).
64
63
@@ -102,7 +101,7 @@ tasks: {
102
101
}
103
102
```
104
103
105
-
### `envs`
104
+
### `env`
106
105
107
106
-**Type:**`string[]`
108
107
-**Default:**`[]`
@@ -113,7 +112,7 @@ Environment variables included in the cache fingerprint. When any listed variabl
113
112
tasks: {
114
113
build: {
115
114
command: 'vp build',
116
-
envs: ['NODE_ENV'],
115
+
env: ['NODE_ENV'],
117
116
},
118
117
}
119
118
```
@@ -125,7 +124,7 @@ $ NODE_ENV=development vp run build # first run
125
124
$ NODE_ENV=production vp run build # cache miss: variable changed
126
125
```
127
126
128
-
### `passThroughEnvs`
127
+
### `untrackedEnv`
129
128
130
129
-**Type:**`string[]`
131
130
-**Default:** see below
@@ -136,7 +135,7 @@ Environment variables passed to the task process but **not** included in the cac
136
135
tasks: {
137
136
build: {
138
137
command: 'vp build',
139
-
passThroughEnvs: ['CI', 'GITHUB_ACTIONS'],
138
+
untrackedEnv: ['CI', 'GITHUB_ACTIONS'],
140
139
},
141
140
}
142
141
```
@@ -148,12 +147,12 @@ A set of common environment variables are automatically passed through to all ta
Vite Task automatically detects which files are used by a command (see [Automatic File Tracking](/guide/cache#automatic-file-tracking)). The `inputs` option can be used to explicitly include or exclude certain files.
155
+
Vite Task automatically detects which files are used by a command (see [Automatic File Tracking](/guide/cache#automatic-file-tracking)). The `input` option can be used to explicitly include or exclude certain files.
157
156
158
157
**Exclude files** from automatic tracking:
159
158
@@ -162,7 +161,7 @@ tasks: {
162
161
build: {
163
162
command: 'vp build',
164
163
// Use `{ auto: true }` to use automatic fingerprinting (default).
A command run by `vp run` is either a **task**(has an entry in `vite.config.ts`) or a **script**(only exists in `package.json` with no corresponding task entry). By default, **tasks are cached and scripts are not.**
29
+
A command run by `vp run` is either a **task**defined in `vite.config.ts` or a **script**defined in `package.json`. Task names and script names cannot overlap. By default, **tasks are cached and scripts are not.**
30
30
31
31
There are three types of controls for task caching, in order:
32
32
@@ -42,10 +42,10 @@ A task can set [`cache: false`](/config/run#cache) to opt out. This cannot be ov
42
42
43
43
The [`run.cache`](/config/run#run-cache) option in your root `vite.config.ts` controls the default for each category:
@@ -63,13 +63,13 @@ Automatic tracking can sometimes include more files than necessary, causing unne
63
63
-**Tool cache files:** some tools maintain their own cache, such as TypeScript's `.tsbuildinfo` or Cargo's `target/`. These files may change between runs even when your source code has not, causing unnecessary cache invalidation.
64
64
-**Directory listings:** when a command scans a directory, such as when globbing for `**/*.js`, Vite Task sees the directory read but not the glob pattern. Any file added or removed in that directory, even unrelated ones, invalidates the cache.
65
65
66
-
Use the [`inputs`](/config/run#inputs) option to exclude files or to replace automatic tracking with explicit file patterns:
66
+
Use the [`input`](/config/run#input) option to exclude files or to replace automatic tracking with explicit file patterns:
67
67
68
68
```ts
69
69
tasks: {
70
70
build: {
71
71
command: 'tsc',
72
-
inputs: [{ auto: true }, '!**/*.tsbuildinfo'],
72
+
input: [{ auto: true }, '!**/*.tsbuildinfo'],
73
73
},
74
74
}
75
75
```
@@ -78,20 +78,20 @@ tasks: {
78
78
79
79
By default, tasks run in a clean environment. Only a small set of common variables, such as `PATH`, `HOME`, and `CI`, are passed through. Other environment variables are neither visible to the task nor included in the cache fingerprint.
80
80
81
-
To add an environment variable to the cache key, add it to [`envs`](/config/run#envs). Changing its value then invalidates the cache:
81
+
To add an environment variable to the cache key, add it to [`env`](/config/run#env). Changing its value then invalidates the cache:
82
82
83
83
```ts
84
84
tasks: {
85
85
build: {
86
86
command: 'webpack --mode production',
87
-
envs: ['NODE_ENV'],
87
+
env: ['NODE_ENV'],
88
88
},
89
89
}
90
90
```
91
91
92
-
To pass a variable to the task **without** affecting cache behavior, use [`passThroughEnvs`](/config/run#pass-through-envs). This is useful for variables like `CI` or `GITHUB_ACTIONS` that should be available in the task, but do not generally affect caching behavior.
92
+
To pass a variable to the task **without** affecting cache behavior, use [`untrackedEnv`](/config/run#untracked-env). This is useful for variables like `CI` or `GITHUB_ACTIONS` that should be available in the task, but do not generally affect caching behavior.
93
93
94
-
See [Run Config](/config/run#envs) for details on wildcard patterns and the full list of automatically passed-through variables.
94
+
See [Run Config](/config/run#env) for details on wildcard patterns and the full list of automatically passed-through variables.
Copy file name to clipboardExpand all lines: docs/guide/run.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,8 +74,9 @@ export default defineConfig({
74
74
run: {
75
75
tasks: {
76
76
build: {
77
+
command: 'vp build',
77
78
dependsOn: ['lint'],
78
-
envs: ['NODE_ENV'],
79
+
env: ['NODE_ENV'],
79
80
},
80
81
deploy: {
81
82
command: 'deploy-script --prod',
@@ -87,10 +88,10 @@ export default defineConfig({
87
88
});
88
89
```
89
90
90
-
If `command` is omitted, the task uses the matching script from `package.json`. A task name can come from `vite.config.ts` or `package.json`, but not both.
91
+
If you want to run an existing `package.json` script as-is, use `vp run <script>`. If you want task-level caching, dependencies, or environment/input controls, define a task with an explicit `command`. A task name can come from `vite.config.ts` or `package.json`, but not both.
91
92
92
93
::: info
93
-
Tasks defined in `vite.config.ts` are cached by default. Plain `package.json` scripts without a matching task entry are not. See [When Is Caching Enabled?](/guide/cache#when-is-caching-enabled) for the full resolution order.
94
+
Tasks defined in `vite.config.ts` are cached by default. `package.json` scripts are not. See [When Is Caching Enabled?](/guide/cache#when-is-caching-enabled) for the full resolution order.
94
95
:::
95
96
96
97
See [Run Config](/config/run) for the full `run` block reference.
0 commit comments