Skip to content

Commit fc3a8df

Browse files
authored
docs: add filename labels to configuration code blocks (#1496)
1 parent bcc93a4 commit fc3a8df

12 files changed

Lines changed: 30 additions & 30 deletions

File tree

docs/config/build.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Example
66

7-
```ts
7+
```ts [vite.config.ts]
88
import { defineConfig } from 'vite-plus';
99

1010
export default defineConfig({

docs/config/fmt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Example
66

7-
```ts
7+
```ts [vite.config.ts]
88
import { defineConfig } from 'vite-plus';
99

1010
export default defineConfig({

docs/config/index.md

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

33
Vite+ keeps project configuration in one place: `vite.config.ts`, allowing you to consolidate many top-level configuration files in a single file. You can keep using your Vite configuration such as `server` or `build`, and add Vite+ blocks for the rest of your workflow:
44

5-
```ts
5+
```ts [vite.config.ts]
66
import { defineConfig } from 'vite-plus';
77

88
export default defineConfig({

docs/config/lint.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Example
66

7-
```ts
7+
```ts [vite.config.ts]
88
import { defineConfig } from 'vite-plus';
99

1010
export default defineConfig({

docs/config/pack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Example
66

7-
```ts
7+
```ts [vite.config.ts]
88
import { defineConfig } from 'vite-plus';
99

1010
export default defineConfig({

docs/config/run.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
You can configure Vite Task under the `run` field in `vite.config.ts`. Check out [`vp run`](/guide/run) to learn more about running scripts and tasks with Vite+.
44

5-
```ts
5+
```ts [vite.config.ts]
66
import { defineConfig } from 'vite-plus';
77

88
export default defineConfig({
@@ -27,7 +27,7 @@ Whether to automatically run `preX`/`postX` package.json scripts as lifecycle ho
2727

2828
When enabled (the default), running a script like `test` will automatically run `pretest` before it and `posttest` after it, if they exist in `package.json`.
2929

30-
```ts
30+
```ts [vite.config.ts]
3131
export default defineConfig({
3232
run: {
3333
enablePrePostScripts: false, // Disable pre/post lifecycle hooks
@@ -46,7 +46,7 @@ This option can only be set in the workspace root's `vite.config.ts`. Setting it
4646

4747
Controls whether task results are cached and replayed on subsequent runs.
4848

49-
```ts
49+
```ts [vite.config.ts]
5050
export default defineConfig({
5151
run: {
5252
cache: {
@@ -71,7 +71,7 @@ Defines tasks that can be run with `vp run <task>`.
7171

7272
Defines the shell command to run for the task.
7373

74-
```ts
74+
```ts [vite.config.ts]
7575
tasks: {
7676
build: {
7777
command: 'vp build',
@@ -90,7 +90,7 @@ Commands joined with `&&` are automatically split into independently cached sub-
9090

9191
Tasks that must complete successfully before this one starts.
9292

93-
```ts
93+
```ts [vite.config.ts]
9494
tasks: {
9595
deploy: {
9696
command: 'deploy-script --prod',
@@ -101,7 +101,7 @@ tasks: {
101101

102102
Dependencies can reference tasks in other packages using the `package#task` format:
103103

104-
```ts
104+
```ts [vite.config.ts]
105105
dependsOn: ['@my/core#build', '@my/utils#lint'];
106106
```
107107

@@ -114,7 +114,7 @@ See [Task Dependencies](/guide/run#task-dependencies) for details on how explici
114114

115115
Whether to cache this task's output. Set to `false` for tasks that should never be cached, like dev servers:
116116

117-
```ts
117+
```ts [vite.config.ts]
118118
tasks: {
119119
dev: {
120120
command: 'vp dev',
@@ -130,7 +130,7 @@ tasks: {
130130

131131
Environment variables included in the cache fingerprint. When any listed variable's value changes, the cache is invalidated.
132132

133-
```ts
133+
```ts [vite.config.ts]
134134
tasks: {
135135
build: {
136136
command: 'vp build',
@@ -153,7 +153,7 @@ $ NODE_ENV=production vp run build # cache miss: variable changed
153153

154154
Environment variables passed to the task process but **not** included in the cache fingerprint. Changing these values won't invalidate the cache.
155155

156-
```ts
156+
```ts [vite.config.ts]
157157
tasks: {
158158
build: {
159159
command: 'vp build',
@@ -178,7 +178,7 @@ Vite Task automatically detects which files are used by a command (see [Automati
178178

179179
**Exclude files** from automatic tracking:
180180

181-
```ts
181+
```ts [vite.config.ts]
182182
tasks: {
183183
build: {
184184
command: 'vp build',
@@ -190,7 +190,7 @@ tasks: {
190190

191191
**Specify explicit files** only without automatic tracking:
192192

193-
```ts
193+
```ts [vite.config.ts]
194194
tasks: {
195195
build: {
196196
command: 'vp build',
@@ -201,7 +201,7 @@ tasks: {
201201

202202
**Resolve patterns relative to the workspace root** using the object form:
203203

204-
```ts
204+
```ts [vite.config.ts]
205205
tasks: {
206206
build: {
207207
command: 'vp build',
@@ -219,7 +219,7 @@ The `base` field is required and controls how the glob pattern is resolved:
219219

220220
**Disable file tracking** entirely and cache only on command/env changes:
221221

222-
```ts
222+
```ts [vite.config.ts]
223223
tasks: {
224224
greet: {
225225
command: 'node greet.mjs',
@@ -239,7 +239,7 @@ String glob patterns are resolved relative to the package directory by default.
239239

240240
Working directory for the task, relative to the package root.
241241

242-
```ts
242+
```ts [vite.config.ts]
243243
tasks: {
244244
'test-e2e': {
245245
command: 'vp test',

docs/config/staged.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Example
66

7-
```ts
7+
```ts [vite.config.ts]
88
import { defineConfig } from 'vite-plus';
99

1010
export default defineConfig({

docs/config/test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Example
66

7-
```ts
7+
```ts [vite.config.ts]
88
import { defineConfig } from 'vite-plus';
99

1010
export default defineConfig({

docs/guide/cache.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Automatic tracking can sometimes include more files than necessary, causing unne
6565

6666
Use the [`input`](/config/run#input) option to exclude files or to replace automatic tracking with explicit file patterns:
6767

68-
```ts
68+
```ts [vite.config.ts]
6969
tasks: {
7070
build: {
7171
command: 'tsc',
@@ -80,7 +80,7 @@ By default, tasks run in a clean environment. Only a small set of common variabl
8080

8181
To add an environment variable to the cache key, add it to [`env`](/config/run#env). Changing its value then invalidates the cache:
8282

83-
```ts
83+
```ts [vite.config.ts]
8484
tasks: {
8585
build: {
8686
command: 'webpack --mode production',

docs/guide/ci.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ That means you usually do not need separate `setup-node`, package-manager setup,
1010

1111
## GitHub Actions
1212

13-
```yaml
13+
```yaml [.github/workflows/ci.yml]
1414
- uses: voidzero-dev/setup-vp@v1
1515
with:
1616
node-version: '22'
@@ -29,7 +29,7 @@ If you are migrating an existing GitHub Actions workflow, you can often replace
2929

3030
#### Before:
3131

32-
```yaml
32+
```yaml [.github/workflows/ci.yml]
3333
- uses: actions/setup-node@v4
3434
with:
3535
node-version: '24'
@@ -52,7 +52,7 @@ If you are migrating an existing GitHub Actions workflow, you can often replace
5252

5353
#### After:
5454

55-
```yaml
55+
```yaml [.github/workflows/ci.yml]
5656
- uses: voidzero-dev/setup-vp@v1
5757
with:
5858
node-version: '24'

0 commit comments

Comments
 (0)