void 0.10.4 → 0.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents-Bmr5tFFb.mjs +1454 -0
- package/dist/{auth-cmd-CblKzAdD.mjs → auth-cmd-DlgNwByu.mjs} +10 -10
- package/dist/{better-auth-shared-D0Mbmx5V.mjs → better-auth-shared-BQooDxbw.mjs} +1 -1
- package/dist/{better-auth-shared-jkksALri.d.mts → better-auth-shared-BvnM9px6.d.mts} +2 -2
- package/dist/{build-cmd-CJQSRupz.mjs → build-cmd-Br8qL0rA.mjs} +15 -17
- package/dist/{cache-CMzjhxHh.mjs → cache-wH-mP8UE.mjs} +10 -12
- package/dist/{cancel-deploy-S2N8NSv6.mjs → cancel-deploy-BEBOEgtu.mjs} +16 -18
- package/dist/cli/cli.mjs +62 -51
- package/dist/{client-YIzxv2ZO.mjs → client-Cj96iiBH.mjs} +118 -8
- package/dist/{config-8dLIngKW.mjs → config-1twldYCW.mjs} +10 -10
- package/dist/{config--wXmVOoe.mjs → config-BdUctCZD.mjs} +6 -6
- package/dist/{create-project-pLQdzEPe.mjs → create-project-DD9n8Ho-.mjs} +28 -23
- package/dist/{db-hAmBumot.mjs → db-DjKE2-A-.mjs} +151 -150
- package/dist/{delete-CfSe3EJO.mjs → delete-D2kr3Kmk.mjs} +13 -15
- package/dist/{deploy-DpOdwtla.mjs → deploy-C4PbkFyE.mjs} +114 -119
- package/dist/{discover-C8N1I4tK.mjs → discover-BuVVSAum.mjs} +4 -4
- package/dist/{dist-5cGIJHQQ.mjs → dist-BuiRJkTd.mjs} +59 -27
- package/dist/{domain-CkowysQx.mjs → domain-_luIsM_B.mjs} +14 -16
- package/dist/{env-CIwG2y7G.mjs → env-CO5XAS9t.mjs} +23 -25
- package/dist/{env-helpers-B_ks681T.d.mts → env-helpers-z4stu8uc.d.mts} +1 -1
- package/dist/{env-types-CaJaIRXU.mjs → env-types-D51bnR-c.mjs} +4 -4
- package/dist/{env-validation-LH6eoyW-.mjs → env-validation-CeC2FL66.mjs} +4 -4
- package/dist/{fetch-error-C6qffTl2.mjs → fetch-error-Dj3crt0e.mjs} +3 -3
- package/dist/{gen-q6McxXgE.mjs → gen-Cf79J4aw.mjs} +42 -44
- package/dist/{github-cmd-BvEKQmcD.mjs → github-cmd-DnqxyOsb.mjs} +197 -91
- package/dist/{handler-B7rCOy21.d.mts → handler-imD0UVDT.d.mts} +4 -5
- package/dist/{headers-BNWymgnH.mjs → headers-BwvFGhkx.mjs} +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +102 -83
- package/dist/{init-CZP69LJu.mjs → init-KirOzVDs.mjs} +132 -134
- package/dist/link-CUmiosyb.mjs +45 -0
- package/dist/{list-B7qXBBjo.mjs → list-3GEw7b6m.mjs} +10 -12
- package/dist/{login-B3l_sDwT.mjs → login-DJReaT_Q.mjs} +14 -15
- package/dist/{logs-AXm660MB.mjs → logs-D-rQ56Lq.mjs} +9 -11
- package/dist/{magic-string.es-C1Fb0uxq.mjs → magic-string.es-ZQjdJFFn.mjs} +3 -3
- package/dist/{mcp-D2plINxM.mjs → mcp-D7yc0dXY.mjs} +2 -3
- package/dist/{node-B07cZs0d.mjs → node-yFFk626c.mjs} +6 -6
- package/dist/{package-json-Bg_GJdJB.mjs → package-json-B0NuUWGd.mjs} +1 -1
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/client.mjs +2 -1
- package/dist/pages/head-client.d.mts +1 -1
- package/dist/pages/head.d.mts +1 -1
- package/dist/pages/index.d.mts +2 -2
- package/dist/pages/index.mjs +5 -5
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/islands-plugin.mjs +3 -3
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +5 -2
- package/dist/{plugin-inference-C3fLzFvP.mjs → plugin-inference-CJxi_fWI.mjs} +4 -4
- package/dist/{prepare-DRRboRqH.mjs → prepare-C_cVurhP.mjs} +15 -18
- package/dist/{preset-B7ZQZn0u.mjs → preset-CVvwCeIy.mjs} +4 -4
- package/dist/{project-cmd-InegJruy.mjs → project-cmd-DnU7u9QF.mjs} +13 -14
- package/dist/{project-paths-CCMrHYQm.mjs → project-paths-tpdR1mJR.mjs} +2 -2
- package/dist/{project-tsconfig-BTNuNoJ0.mjs → project-tsconfig-D9uSVVpA.mjs} +4 -4
- package/dist/{protocol-6UZCowS1.d.mts → protocol-6hTJ04T1.d.mts} +3 -3
- package/dist/{resolve-project-D4O1_fZz.mjs → resolve-project-D2HI3TrG.mjs} +2 -2
- package/dist/{rollback-CHVE-DeT.mjs → rollback-Yh7bCKob.mjs} +21 -23
- package/dist/{route-types-D03ryMXz.mjs → route-types-CfKfhbIg.mjs} +234 -3
- package/dist/{runner-BQyKUqAL.mjs → runner-h272wcPj.mjs} +4 -5
- package/dist/{runner-pg-EuhrFW3D.mjs → runner-pg-waxJOnBb.mjs} +1 -1
- package/dist/runtime/ai.mjs +2 -2
- package/dist/runtime/auth.d.mts +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +3 -3
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +2 -2
- package/dist/runtime/client-react.d.mts +2 -2
- package/dist/runtime/client-react.mjs +1 -1
- package/dist/runtime/client-solid.d.mts +2 -2
- package/dist/runtime/client-solid.mjs +1 -1
- package/dist/runtime/client-svelte.d.mts +2 -2
- package/dist/runtime/client-svelte.mjs +1 -1
- package/dist/runtime/client-vue.d.mts +2 -2
- package/dist/runtime/client-vue.mjs +1 -1
- package/dist/runtime/client.d.mts +2 -2
- package/dist/runtime/client.mjs +1 -1
- package/dist/runtime/db-pg.d.mts +1 -1
- package/dist/runtime/env-helpers.d.mts +1 -1
- package/dist/runtime/env-public-client.d.mts +1 -1
- package/dist/runtime/env-public-client.mjs +2 -0
- package/dist/runtime/env-public.d.mts +3 -4
- package/dist/runtime/env-public.mjs +3 -1
- package/dist/runtime/env.mjs +1 -1
- package/dist/runtime/fetch-stream.d.mts +1 -1
- package/dist/runtime/fetch-stream.mjs +1 -1
- package/dist/runtime/fetch.d.mts +1 -1
- package/dist/runtime/fetch.mjs +1 -1
- package/dist/runtime/handler.d.mts +2 -2
- package/dist/runtime/handler.mjs +1 -1
- package/dist/runtime/isr.mjs +1 -1
- package/dist/runtime/live-server.mjs +2 -0
- package/dist/runtime/live.d.mts +2 -2
- package/dist/runtime/live.mjs +3 -1
- package/dist/runtime/migration-handler-pg.mjs +1 -1
- package/dist/runtime/migration-handler.mjs +1 -1
- package/dist/runtime/remote/index.mjs +11 -1
- package/dist/runtime/sandbox.d.mts +1 -4
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +2 -2
- package/dist/runtime/ws-server.mjs +2 -0
- package/dist/runtime/ws.d.mts +3 -3
- package/dist/runtime/ws.mjs +2 -0
- package/dist/{scan-VCAM1oh3.mjs → scan-Dp_Gyzs3.mjs} +3 -3
- package/dist/{scan-DGEp1-1Q.mjs → scan-i7Yz54fv.mjs} +26 -8
- package/dist/{secret-CVKwIOm3.mjs → secret-u7FRvg8d.mjs} +22 -24
- package/dist/{skills-Dl3u05da.mjs → skills-DsdNDtX3.mjs} +6 -7
- package/dist/{subcommand-prompt-B8ng0FTS.mjs → subcommand-prompt-DtES-oP6.mjs} +34 -35
- package/dist/sveltekit.mjs +2 -2
- package/dist/validate-DT7nFMlf.mjs +504 -0
- package/dist/{yarn-pnp-WLW2IHUY.mjs → yarn-pnp-CW8LB6g_.mjs} +1 -1
- package/package.json +19 -19
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +94 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +32 -11
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +45 -0
- package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +5 -5
- package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +4 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +29 -12
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/AGENTS.md +1 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/README.md +18 -6
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/build.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/check.md +35 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/create.md +70 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/fmt.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/index.md +11 -7
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/lint.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/pack.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/run.md +141 -26
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/staged.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/test.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +145 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/cache.md +16 -28
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/check.md +16 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ci.md +15 -17
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/commit-hooks.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/create.md +255 -2
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/docker.md +175 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/env.md +70 -5
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/github-actions-cache.md +165 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ide-integration.md +2 -2
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/index.md +9 -3
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/install.md +63 -11
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate-rules.md +347 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate.md +27 -3
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/monorepo.md +176 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/pack.md +8 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/run.md +36 -4
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/troubleshooting.md +11 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/upgrade.md +65 -13
- package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +403 -390
- package/skills/void/docs/node_modules/void/node_modules/pg/README.md +2 -1
- package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/AGENTS.md +1 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/README.md +18 -6
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/build.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/check.md +35 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/create.md +70 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/fmt.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/index.md +11 -7
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/lint.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/pack.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/run.md +141 -26
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/staged.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/test.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +145 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/cache.md +16 -28
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/check.md +16 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ci.md +15 -17
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/commit-hooks.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/create.md +255 -2
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/docker.md +175 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/env.md +70 -5
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/github-actions-cache.md +165 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ide-integration.md +2 -2
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/index.md +9 -3
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/install.md +63 -11
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate-rules.md +347 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate.md +27 -3
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/monorepo.md +176 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/pack.md +8 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/run.md +36 -4
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/troubleshooting.md +11 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/upgrade.md +65 -13
- package/skills/void/docs/reference/cli.md +19 -1
- package/dist/agents-MhSzNMiC.mjs +0 -151
- package/dist/collect-9rO3JFNM.mjs +0 -55
- package/dist/config-hhMYPVRT.mjs +0 -21
- package/dist/dist-abzUneor.mjs +0 -1287
- package/dist/drizzle-DqstQTGq.mjs +0 -232
- package/dist/link-BKLElphS.mjs +0 -47
- package/dist/output-DeiS4oEX.mjs +0 -139
- package/dist/plan-aD3wRDqF.mjs +0 -271
- package/dist/project-CH9pdo16.mjs +0 -72
- package/dist/project-slug-rX3kTOfY.mjs +0 -10
- package/dist/validate-CNWm-PsL.mjs +0 -186
- /package/dist/{auth-migrations-BP-hMzYl.mjs → auth-migrations-BTZ-ATvQ.mjs} +0 -0
- /package/dist/{auth-Dz2CCn4T.d.mts → auth-qgMlYp7Z.d.mts} +0 -0
- /package/dist/{canonical-json-CEyQaVDa.mjs → canonical-json-DuDiiUsQ.mjs} +0 -0
- /package/dist/{cf-access-DKDsgwOU.mjs → cf-access-Bqw81xAf.mjs} +0 -0
- /package/dist/{defer-C-bdSM_b.mjs → defer-YsYDUoii.mjs} +0 -0
- /package/dist/{dotenv-lS94ymhM.mjs → dotenv-D_UbC_vc.mjs} +0 -0
- /package/dist/{env-raw-Dtj1UAoK.mjs → env-raw-CoS20LHP.mjs} +0 -0
- /package/dist/{fetch-error-B6RaJ-eZ.d.mts → fetch-error-Sp1R4mZv.d.mts} +0 -0
- /package/dist/{git-metadata-Ce0AtSZL.mjs → git-metadata-CBKaL0v5.mjs} +0 -0
- /package/dist/{head-eOUCWUNy.d.mts → head-nmvOgFjd.d.mts} +0 -0
- /package/dist/{log-BdD_Fpms.mjs → log-ChfPKsVd.mjs} +0 -0
- /package/dist/{pathe.M-eThtNZ-BrPhGF_K.mjs → pathe.M-eThtNZ-CQzLbt4c.mjs} +0 -0
- /package/dist/{pg-CempqvEJ.mjs → pg-J2HbZIkX.mjs} +0 -0
- /package/dist/{providers-BJIoduK9.d.mts → providers-BNKRacMr.d.mts} +0 -0
- /package/dist/{providers-BwPbdHdi.mjs → providers-CJlNS3kT.mjs} +0 -0
- /package/dist/{proxy-M3pxItg2.mjs → proxy-D-3_D-Gl.mjs} +0 -0
- /package/dist/{chunk-DJd-R1mw.mjs → rolldown-runtime-DJK8HYOj.mjs} +0 -0
- /package/dist/{standard-schema-Cy0lfeWv.d.mts → standard-schema-DJ0HW7QP.d.mts} +0 -0
- /package/dist/{types-BodZGegX.d.mts → types-lLjNE9Qp.d.mts} +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Automatic Data Tracking
|
|
2
|
+
|
|
3
|
+
Automatic data tracking is how Vite Task learns what inputs a task needs for caching outputs without explicit config.
|
|
4
|
+
|
|
5
|
+
When you run a cache-enabled task, Vite Task observes the task's execution and records what files were read and written, as well as any metadata reported by the task. On the next run, Vite Task uses the recorded fingerprint to decide whether to replay the cache or run the task.
|
|
6
|
+
|
|
7
|
+
Use this page when you need to understand why a task hits or misses the cache, or when you need to decide whether to add `input`, `output`, `env`, or `untrackedEnv` config.
|
|
8
|
+
|
|
9
|
+
## Tracking Tiers
|
|
10
|
+
|
|
11
|
+
Automatic data tracking has two tiers:
|
|
12
|
+
|
|
13
|
+
| Tier | Applies to | Records |
|
|
14
|
+
| -------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| File system tracking | All tasks with cache enabled | <ul><li>Files read by the command</li><li>Missing-file probes</li><li>Directory listings</li><li>Written output files</li></ul> |
|
|
16
|
+
| Cooperative tracking | Cache-reporting tools (`vp build` today) | <ul><li>Environment variables reported by the tool</li><li>Tool-managed paths that should not be inputs or outputs, such as `node_modules/.vite-temp`</li></ul> |
|
|
17
|
+
|
|
18
|
+
Vite Task starts with file system tracking for any command. A cache-reporting tool can add information that only the tool knows while it runs.
|
|
19
|
+
|
|
20
|
+
## File System Tracking
|
|
21
|
+
|
|
22
|
+
File system tracking applies to every cache-enabled task. If you omit [`input`](/config/run#input), Vite Task tracks the files a command reads while it runs:
|
|
23
|
+
|
|
24
|
+
```ts [vite.config.ts]
|
|
25
|
+
import { defineConfig } from 'vite-plus';
|
|
26
|
+
|
|
27
|
+
export default defineConfig({
|
|
28
|
+
run: {
|
|
29
|
+
tasks: {
|
|
30
|
+
build: {
|
|
31
|
+
command: 'tsc',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
For this task, Vite Task records source files, config files, missing files the command checked, and directories the command scanned. Subsequent runs re-run the task when one of those tracked inputs changes.
|
|
39
|
+
|
|
40
|
+
File system tracking also tracks outputs. If you omit [`output`](/config/run#output), Vite Task archives files the command writes after a successful run and restores them on a cache hit.
|
|
41
|
+
|
|
42
|
+
### Limitations
|
|
43
|
+
|
|
44
|
+
Vite Task cannot track environment variable reads, and it cannot always tell which tracked paths are stable inputs, generated outputs, or tool-managed cache paths that should not become inputs or outputs.
|
|
45
|
+
|
|
46
|
+
Use [Override Inputs And Outputs](#override-inputs-and-outputs) when file system tracking includes files that should not affect the cache, misses files that should, or restores the wrong outputs.
|
|
47
|
+
|
|
48
|
+
Use [`env`](/config/run#env) when a command needs an environment variable and the value should affect the cache, or [`untrackedEnv`](/config/run#untrackedenv) when the value should not affect the cache.
|
|
49
|
+
|
|
50
|
+
These limitations do not apply to `vp build`: Vite reports [Cooperative Tracking](#cooperative-tracking) metadata automatically, including `VITE_*`, `NODE_ENV`, and Vite-managed cache paths that should not become inputs or outputs. A standard `vp build` task does not need manual `input`, `output`, or `env`.
|
|
51
|
+
|
|
52
|
+
### Override Inputs And Outputs
|
|
53
|
+
|
|
54
|
+
[`input`](/config/run#input) controls what invalidates the cache. [`output`](/config/run#output) controls which files Vite Task restores on a cache hit.
|
|
55
|
+
|
|
56
|
+
Both options use the same syntax and can be configured separately.
|
|
57
|
+
|
|
58
|
+
- Omit the option to keep automatic tracking.
|
|
59
|
+
- Add `{ auto: true }` to keep automatic tracking while adding glob rules.
|
|
60
|
+
- Use string globs to include paths.
|
|
61
|
+
- Use `!` globs to exclude paths.
|
|
62
|
+
- Use `[]` to replace automatic tracking with an empty list.
|
|
63
|
+
|
|
64
|
+
```ts [vite.config.ts]
|
|
65
|
+
tasks: {
|
|
66
|
+
build: {
|
|
67
|
+
command: 'node build.mjs',
|
|
68
|
+
|
|
69
|
+
// Keep automatic input tracking, but exclude `dist` from inputs.
|
|
70
|
+
input: [{ auto: true }, '!dist/**'],
|
|
71
|
+
|
|
72
|
+
// Disable automatic output tracking and restore only `dist/**` on a cache hit.
|
|
73
|
+
output: ['dist/**'],
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Use explicit `input` globs only when you know the command's full input set. This lint task overrides inputs only, so output tracking stays automatic:
|
|
79
|
+
|
|
80
|
+
```ts [vite.config.ts]
|
|
81
|
+
tasks: {
|
|
82
|
+
lint: {
|
|
83
|
+
command: 'vp lint',
|
|
84
|
+
// Disable automatic input tracking and fingerprint only these files.
|
|
85
|
+
input: ['src/**', 'vite.config.ts'],
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Set `input: []` when no files should affect the cache fingerprint. This is rarely useful. For example, a download task can be cached when the same URL always serves the same file. No input files should be fingerprinted for this task, but changing the URL still invalidates the cache:
|
|
91
|
+
|
|
92
|
+
```ts [vite.config.ts]
|
|
93
|
+
tasks: {
|
|
94
|
+
downloadSchema: {
|
|
95
|
+
command: 'curl -O https://example.com/schema.json',
|
|
96
|
+
input: [],
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Set `output: []` when no files should be restored on a cache hit.
|
|
102
|
+
|
|
103
|
+
## Cooperative Tracking
|
|
104
|
+
|
|
105
|
+
File system tracking records access. It cannot know why a tool used each path.
|
|
106
|
+
|
|
107
|
+
`vp build` knows more about a Vite build than Vite Task can infer from file access. When `vp build` runs with cache enabled, Vite reports that metadata to Vite Task. Vite Task merges the report with file system tracking to build a more accurate cache fingerprint.
|
|
108
|
+
|
|
109
|
+
For a standard Vite build, you do not need to add these entries yourself because Vite reports them automatically at runtime:
|
|
110
|
+
|
|
111
|
+
- `env: ['VITE_*']` or `env: ['NODE_ENV']`
|
|
112
|
+
- `output: ['dist/**']`
|
|
113
|
+
- input or output exclusions for temporary paths like `node_modules/.vite-temp`
|
|
114
|
+
|
|
115
|
+
You only need to define the task with `vp build`:
|
|
116
|
+
|
|
117
|
+
```ts [vite.config.ts]
|
|
118
|
+
import { defineConfig } from 'vite-plus';
|
|
119
|
+
|
|
120
|
+
export default defineConfig({
|
|
121
|
+
run: {
|
|
122
|
+
tasks: {
|
|
123
|
+
frontendBuild: 'vp build',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Run this task with `vpr frontendBuild` or `vp run frontendBuild`.
|
|
130
|
+
|
|
131
|
+
Manual config overrides reported metadata. Add `input`, `output`, `env`, or `untrackedEnv` when your project has behavior that Vite cannot report.
|
|
132
|
+
|
|
133
|
+
Vite+ supports cooperative tracking for `vp build` today. It will extend this support to more first-party tools in the future. Third-party tools can report cache metadata with [`@voidzero-dev/vite-task-client`](https://npmx.dev/package/@voidzero-dev/vite-task-client).
|
|
134
|
+
|
|
135
|
+
## When To Add Manual Config
|
|
136
|
+
|
|
137
|
+
Add config when your project has behavior the command or tool cannot know.
|
|
138
|
+
|
|
139
|
+
| Case | Example |
|
|
140
|
+
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
141
|
+
| Exclude an output directory from inputs | `input: [{ auto: true }, '!dist/**']` |
|
|
142
|
+
| Exclude a temporary generated file from input and output tracking | `input: [{ auto: true }, '!.tmp/config.mjs']`<br>`output: [{ auto: true }, '!.tmp/config.mjs']` |
|
|
143
|
+
| Avoid automatic file tracking for a task | `input: ['src/**']`<br>`output: ['dist/**']` |
|
|
144
|
+
| Track and pass an env var | `env: ['NODE_ENV']` |
|
|
145
|
+
| Pass an env var without fingerprinting it | `untrackedEnv: ['GITHUB_ACTIONS']` |
|
|
@@ -4,23 +4,19 @@ Vite Task can automatically track dependencies and cache tasks run through `vp r
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
When a task runs successfully (exit code 0), its terminal output (stdout/stderr)
|
|
7
|
+
When a task runs successfully (exit code 0), its terminal output (stdout/stderr) and all written files (output files) are saved. On the next run, Vite Task checks if anything changed:
|
|
8
8
|
|
|
9
9
|
1. **Arguments:** did the [additional arguments](/guide/run#additional-arguments) passed to the task change?
|
|
10
10
|
2. **Environment variables:** did any [fingerprinted env vars](/config/run#env) change?
|
|
11
|
-
3. **
|
|
11
|
+
3. **Inputs:** did any input file that the command reads change?
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
::: info
|
|
16
|
-
Currently, only terminal output is cached and replayed. Output files such as `dist/` are not cached. If you delete them, use `--no-cache` to force a re-run. Output file caching is planned for a future release.
|
|
17
|
-
:::
|
|
13
|
+
When all checks match, Vite Task replays the cached terminal output, restores saved output files, and skips the command.
|
|
18
14
|
|
|
19
15
|
When a cache miss occurs, Vite Task tells you exactly why:
|
|
20
16
|
|
|
21
17
|
```
|
|
22
18
|
$ vp lint ✗ cache miss: 'src/utils.ts' modified, executing
|
|
23
|
-
$ vp build ✗ cache miss: env changed, executing
|
|
19
|
+
$ vp build ✗ cache miss: env 'VITE_GREETING' changed, executing
|
|
24
20
|
$ vp test ✗ cache miss: args changed, executing
|
|
25
21
|
```
|
|
26
22
|
|
|
@@ -36,7 +32,7 @@ A task can set [`cache: false`](/config/run#cache) to opt out. This cannot be ov
|
|
|
36
32
|
|
|
37
33
|
### 2. CLI flags
|
|
38
34
|
|
|
39
|
-
`--no-cache` disables caching for
|
|
35
|
+
`--no-cache` disables caching for every task and script in that run. `--cache` enables caching for both tasks and scripts, which is equivalent to setting [`run.cache: true`](/config/run#run-cache) for that invocation.
|
|
40
36
|
|
|
41
37
|
### 3. Workspace config
|
|
42
38
|
|
|
@@ -47,29 +43,21 @@ The [`run.cache`](/config/run#run-cache) option in your root `vite.config.ts` co
|
|
|
47
43
|
| `cache.tasks` | `true` | Cache tasks defined in `vite.config.ts` |
|
|
48
44
|
| `cache.scripts` | `false` | Cache `package.json` scripts |
|
|
49
45
|
|
|
50
|
-
## Automatic
|
|
51
|
-
|
|
52
|
-
Vite Task tracks which files each command reads during execution. When a task runs, it records which files the process opens, such as your `.ts` source files, `vite.config.ts`, and `package.json`, and records their content hashes. On the next run, it re-checks those hashes to determine if anything changed.
|
|
53
|
-
|
|
54
|
-
This means caching works out of the box for most commands without any configuration. Vite Task also records:
|
|
55
|
-
|
|
56
|
-
- **Missing files:** if a command probes for a file that doesn't exist, such as `utils.ts` during module resolution, creating that file later correctly invalidates the cache.
|
|
57
|
-
- **Directory listings:** if a command scans a directory, such as a test runner looking for `*.test.ts`, adding or removing files in that directory invalidates the cache.
|
|
58
|
-
|
|
59
|
-
### Avoiding Overly Broad Input Tracking
|
|
46
|
+
## Automatic Data Tracking
|
|
60
47
|
|
|
61
|
-
|
|
48
|
+
Vite Task uses [automatic data tracking](/guide/automatic-data-tracking) to learn what each task needs for caching so you don't have to configure it manually. Automatic data tracking has two tiers:
|
|
62
49
|
|
|
63
|
-
- **
|
|
64
|
-
- **
|
|
50
|
+
- **File system tracking:** Vite Task records file reads, missing-file probes, directory listings, and written output files for every task with cache enabled.
|
|
51
|
+
- **Cooperative tracking:** cache-reporting tools can report metadata that file system tracking cannot infer. Vite+ supports this for `vp build` today.
|
|
65
52
|
|
|
66
|
-
Use
|
|
53
|
+
Use [`input`](/config/run#input) or [`output`](/config/run#output) when a task needs manual tracking rules. `input` controls what invalidates the cache. `output` controls which files Vite Task restores on a cache hit.
|
|
67
54
|
|
|
68
|
-
```ts
|
|
55
|
+
```ts [vite.config.ts]
|
|
69
56
|
tasks: {
|
|
70
57
|
build: {
|
|
71
|
-
command: '
|
|
72
|
-
input: [{ auto: true }, '
|
|
58
|
+
command: 'node build.mjs',
|
|
59
|
+
input: [{ auto: true }, '!dist/**'],
|
|
60
|
+
output: ['dist/**'],
|
|
73
61
|
},
|
|
74
62
|
}
|
|
75
63
|
```
|
|
@@ -80,7 +68,7 @@ By default, tasks run in a clean environment. Only a small set of common variabl
|
|
|
80
68
|
|
|
81
69
|
To add an environment variable to the cache key, add it to [`env`](/config/run#env). Changing its value then invalidates the cache:
|
|
82
70
|
|
|
83
|
-
```ts
|
|
71
|
+
```ts [vite.config.ts]
|
|
84
72
|
tasks: {
|
|
85
73
|
build: {
|
|
86
74
|
command: 'webpack --mode production',
|
|
@@ -89,7 +77,7 @@ tasks: {
|
|
|
89
77
|
}
|
|
90
78
|
```
|
|
91
79
|
|
|
92
|
-
To pass a variable to the task **without** affecting cache behavior, use [`untrackedEnv`](/config/run#
|
|
80
|
+
To pass a variable to the task **without** affecting cache behavior, use [`untrackedEnv`](/config/run#untrackedenv). This is useful for variables like `CI` or `GITHUB_ACTIONS` that should be available in the task, but do not affect caching behavior.
|
|
93
81
|
|
|
94
82
|
See [Run Config](/config/run#env) for details on wildcard patterns and the full list of automatically passed-through variables.
|
|
95
83
|
|
|
@@ -42,3 +42,19 @@ export default defineConfig({
|
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
44
|
```
|
|
45
|
+
|
|
46
|
+
### Disabling a step by default
|
|
47
|
+
|
|
48
|
+
To make `vp check` skip formatting or linting without passing a flag every time, set the [`check`](/config/check) block in `vite.config.ts`. This is handy when a project wants the rest of the toolchain but not, say, formatting:
|
|
49
|
+
|
|
50
|
+
```ts [vite.config.ts]
|
|
51
|
+
import { defineConfig } from 'vite-plus';
|
|
52
|
+
|
|
53
|
+
export default defineConfig({
|
|
54
|
+
check: {
|
|
55
|
+
fmt: false, // `vp check` lints (and type-checks) but does not format
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
These options only affect `vp check`; standalone `vp fmt` and `vp lint` still run normally. A step is skipped if it is disabled in config or the matching `--no-fmt` / `--no-lint` flag is passed. Because the defaults apply to every `vp check` run, a pre-commit hook that calls `vp check` will skip the disabled step too. See [Check config](/config/check) for the full reference.
|
|
@@ -10,10 +10,10 @@ That means you usually do not need separate `setup-node`, package-manager setup,
|
|
|
10
10
|
|
|
11
11
|
## GitHub Actions
|
|
12
12
|
|
|
13
|
-
```yaml
|
|
13
|
+
```yaml [.github/workflows/ci.yml]
|
|
14
14
|
- uses: voidzero-dev/setup-vp@v1
|
|
15
15
|
with:
|
|
16
|
-
node-version: '
|
|
16
|
+
node-version: '24'
|
|
17
17
|
cache: true
|
|
18
18
|
- run: vp install
|
|
19
19
|
- run: vp check
|
|
@@ -23,36 +23,34 @@ That means you usually do not need separate `setup-node`, package-manager setup,
|
|
|
23
23
|
|
|
24
24
|
With `cache: true`, `setup-vp` handles dependency caching for you automatically.
|
|
25
25
|
|
|
26
|
+
::: tip
|
|
27
|
+
`setup-vp` caches package-manager data. To reuse Vite Task results across CI runs, add a separate [GitHub Actions cache for Vite Task](/guide/github-actions-cache).
|
|
28
|
+
:::
|
|
29
|
+
|
|
26
30
|
## Simplifying Existing Workflows
|
|
27
31
|
|
|
28
32
|
If you are migrating an existing GitHub Actions workflow, you can often replace large blocks of Node, package-manager, and cache setup with a single `setup-vp` step.
|
|
29
33
|
|
|
30
34
|
#### Before:
|
|
31
35
|
|
|
32
|
-
```yaml
|
|
33
|
-
- uses:
|
|
36
|
+
```yaml [.github/workflows/ci.yml]
|
|
37
|
+
- uses: pnpm/action-setup@v6
|
|
34
38
|
with:
|
|
35
|
-
|
|
39
|
+
version: 11
|
|
36
40
|
|
|
37
|
-
- uses:
|
|
41
|
+
- uses: actions/setup-node@v6
|
|
38
42
|
with:
|
|
39
|
-
version:
|
|
40
|
-
|
|
41
|
-
- name: Get pnpm store path
|
|
42
|
-
run: pnpm store path
|
|
43
|
-
|
|
44
|
-
- uses: actions/cache@v4
|
|
45
|
-
with:
|
|
46
|
-
path: ~/.pnpm-store
|
|
47
|
-
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
|
43
|
+
node-version: '24'
|
|
44
|
+
cache: pnpm
|
|
48
45
|
|
|
49
|
-
- run: pnpm
|
|
46
|
+
- run: pnpm ci && pnpm dev:setup
|
|
47
|
+
- run: pnpm check
|
|
50
48
|
- run: pnpm test
|
|
51
49
|
```
|
|
52
50
|
|
|
53
51
|
#### After:
|
|
54
52
|
|
|
55
|
-
```yaml
|
|
53
|
+
```yaml [.github/workflows/ci.yml]
|
|
56
54
|
- uses: voidzero-dev/setup-vp@v1
|
|
57
55
|
with:
|
|
58
56
|
node-version: '24'
|
package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/commit-hooks.md
CHANGED
|
@@ -22,8 +22,17 @@ If you use [`vp create`](/guide/create) or [`vp migrate`](/guide/migrate), Vite+
|
|
|
22
22
|
```bash
|
|
23
23
|
vp config
|
|
24
24
|
vp config --hooks-dir .vite-hooks
|
|
25
|
+
vp config --no-hooks
|
|
26
|
+
vp config --no-agent
|
|
25
27
|
```
|
|
26
28
|
|
|
29
|
+
Use `--no-hooks` when you want `vp config` to leave existing Git hook setup unchanged. Use
|
|
30
|
+
`--no-agent` when you want it to skip updates to existing coding agent instruction files. You
|
|
31
|
+
can pass both flags when you want `vp config` to skip both setup steps.
|
|
32
|
+
|
|
33
|
+
You can also set `VITE_GIT_HOOKS=0` to disable hook installation from lifecycle scripts such as
|
|
34
|
+
`prepare` or `postinstall`.
|
|
35
|
+
|
|
27
36
|
### `vp staged`
|
|
28
37
|
|
|
29
38
|
`vp staged` runs staged-file checks using the `staged` config from `vite.config.ts`. If you set up Vite+ to handle your commit hooks, it will automatically run when you commit your local changes.
|
|
@@ -27,7 +27,7 @@ Vite+ ships with these built-in templates:
|
|
|
27
27
|
- `vite:monorepo` creates a new monorepo
|
|
28
28
|
- `vite:application` creates a new application
|
|
29
29
|
- `vite:library` creates a new library
|
|
30
|
-
- `vite:generator` creates a new generator
|
|
30
|
+
- `vite:generator` creates a new code generator (monorepo only, see [Code Generators](#code-generators))
|
|
31
31
|
|
|
32
32
|
## Template Sources
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ Vite+ ships with these built-in templates:
|
|
|
35
35
|
|
|
36
36
|
- Use shorthand templates like `vite`, `@tanstack/start`, `svelte`, `next-app`, `nuxt`, `react-router`, and `vue`
|
|
37
37
|
- Use full package names like `create-vite` or `create-next-app`
|
|
38
|
-
- Use local templates
|
|
38
|
+
- Use local monorepo templates declared in [`create.templates`](#code-generators) (for example an internal component or service generator)
|
|
39
39
|
- Use remote templates such as `github:user/repo` or `https://github.com/user/template-repo`
|
|
40
40
|
|
|
41
41
|
Run `vp create --list` to see the built-in templates and the common shorthand templates Vite+ recognizes.
|
|
@@ -44,13 +44,29 @@ Run `vp create --list` to see the built-in templates and the common shorthand te
|
|
|
44
44
|
|
|
45
45
|
- `--directory <dir>` writes the generated project into a specific target directory
|
|
46
46
|
- `--agent <name>` creates agent instructions files during scaffolding
|
|
47
|
+
- `--no-agent` skips agent instruction setup
|
|
47
48
|
- `--editor <name>` writes editor config files
|
|
49
|
+
- `--no-editor` skips editor config setup
|
|
50
|
+
- `--git` initialize a git repository
|
|
51
|
+
- `--no-git` skips git repository initialization
|
|
48
52
|
- `--hooks` enables pre-commit hook setup
|
|
49
53
|
- `--no-hooks` skips hook setup
|
|
54
|
+
- `--package-manager <name>` uses a specified package manager (`pnpm`, `npm`, `yarn`, or `bun`)
|
|
55
|
+
- `--approve-builds` approves and runs gated dependency build scripts without prompting
|
|
50
56
|
- `--no-interactive` runs without prompts
|
|
51
57
|
- `--verbose` shows detailed scaffolding output
|
|
52
58
|
- `--list` prints the available built-in and popular templates
|
|
53
59
|
|
|
60
|
+
### Dependency build scripts
|
|
61
|
+
|
|
62
|
+
For security, pnpm, bun, and yarn (Berry) do not run a dependency's build scripts (`install` / `postinstall`, e.g. native builds like `better-sqlite3`) until you approve them. When a template adds such a dependency directly, `vp create` surfaces it after installing instead of leaving the project in a half-built state:
|
|
63
|
+
|
|
64
|
+
- Interactive: you are asked which of those dependencies to approve and build (nothing is selected by default).
|
|
65
|
+
- Non-interactive: a note lists them and points at `vp pm approve-builds`.
|
|
66
|
+
- `--approve-builds`: approves and builds them automatically, so non-interactive runs (CI) can produce a ready-to-use project.
|
|
67
|
+
|
|
68
|
+
Approval is recorded the way each package manager expects: pnpm's `allowBuilds`, bun's `trustedDependencies`, or yarn's `dependenciesMeta.<pkg>.built` (in the workspace root manifest). Transitive build scripts you did not choose (e.g. `esbuild` pulled in by Vite) are left at the package manager's defaults and are not surfaced. npm runs build scripts by default, so there is nothing to approve there.
|
|
69
|
+
|
|
54
70
|
## Template Options
|
|
55
71
|
|
|
56
72
|
Arguments after `--` are passed directly to the selected template.
|
|
@@ -86,3 +102,240 @@ vp create create-next-app
|
|
|
86
102
|
vp create github:user/repo
|
|
87
103
|
vp create https://github.com/user/template-repo
|
|
88
104
|
```
|
|
105
|
+
|
|
106
|
+
## Code Generators
|
|
107
|
+
|
|
108
|
+
Monorepos often need to scaffold their own building blocks: a UI component, a service, or an internal package that follows house conventions. Vite+ supports this through generator packages powered by [Bingo](https://www.create.bingo/) templates.
|
|
109
|
+
|
|
110
|
+
### Scaffold a generator
|
|
111
|
+
|
|
112
|
+
Inside a Vite+ monorepo, run:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
vp create vite:generator
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
This requires a monorepo workspace. If you don't have one yet, create it first with `vp create vite:monorepo`.
|
|
119
|
+
|
|
120
|
+
The scaffolded generator package contains:
|
|
121
|
+
|
|
122
|
+
- `src/template.ts` defines the template using `createTemplate` from `bingo`: an options schema built with [Zod](https://zod.dev/) and a `produce()` function that returns the files to generate
|
|
123
|
+
- `bin/index.ts` is the CLI entry, powered by Bingo's `runTemplateCLI`
|
|
124
|
+
|
|
125
|
+
If the monorepo has a parent directory matching `generators` or `tools`, the new package is placed there by default.
|
|
126
|
+
|
|
127
|
+
### Registration
|
|
128
|
+
|
|
129
|
+
Local generators are declared in [`create.templates`](/config/create#create-templates) in the monorepo's `vite.config.ts`. This is the source of truth: only registered templates appear in the `vp create` picker.
|
|
130
|
+
|
|
131
|
+
`vp create vite:generator` registers the generator for you, adding an entry to `create.templates` in the root `vite.config.ts`:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
import { defineConfig } from 'vite-plus';
|
|
135
|
+
|
|
136
|
+
export default defineConfig({
|
|
137
|
+
create: {
|
|
138
|
+
templates: [
|
|
139
|
+
{ name: 'my-generator', description: 'Generate new components', template: 'my-generator' },
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Re-running is idempotent (no duplicate entries), and an existing `create.defaultTemplate` is preserved. You can also add entries by hand, for example to register a template you didn't scaffold this way. The `template` value is the generator's workspace package name, or a relative `./path` to it.
|
|
146
|
+
|
|
147
|
+
### Run a generator
|
|
148
|
+
|
|
149
|
+
Inside the monorepo, run `vp create` and pick the generator from the template list, or pass its entry `name` directly:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Interactive mode lists registered local templates alongside the built-ins
|
|
153
|
+
vp create
|
|
154
|
+
|
|
155
|
+
# Run a registered template by its name
|
|
156
|
+
vp create component
|
|
157
|
+
|
|
158
|
+
# Pass options to the generator after --
|
|
159
|
+
vp create component -- --name @your-org/button
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
When the generator depends on `bingo`, Vite+ appends `--skip-requests` automatically so it skips Bingo's outbound network requests (such as GitHub API calls).
|
|
163
|
+
|
|
164
|
+
After the generator runs, the created package goes through the regular monorepo integration: workspace registration, dependency installation, and formatting.
|
|
165
|
+
|
|
166
|
+
### Customize a generator
|
|
167
|
+
|
|
168
|
+
Edit `src/template.ts` to define the options and the files to produce:
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
import { createTemplate } from 'bingo';
|
|
172
|
+
import { z } from 'zod';
|
|
173
|
+
|
|
174
|
+
export default createTemplate({
|
|
175
|
+
options: {
|
|
176
|
+
name: z.string().describe('Package name'),
|
|
177
|
+
},
|
|
178
|
+
async produce({ options }) {
|
|
179
|
+
return {
|
|
180
|
+
files: {
|
|
181
|
+
'package.json': JSON.stringify({ name: options.name, version: '0.0.0' }, null, 2),
|
|
182
|
+
src: {
|
|
183
|
+
'index.ts': `export const name = '${options.name}';\n`,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
- `options` defines the generator's prompts and flags using Zod schemas
|
|
192
|
+
- `produce()` returns the [files](https://www.create.bingo/build/concepts/creations#files) to create, plus optional [scripts](https://www.create.bingo/build/concepts/creations#scripts) to run after generation and [suggestions](https://www.create.bingo/build/concepts/creations#suggestions) to print for the user
|
|
193
|
+
|
|
194
|
+
See the [Bingo documentation](https://www.create.bingo/) for the full template API.
|
|
195
|
+
|
|
196
|
+
## Organization Templates
|
|
197
|
+
|
|
198
|
+
An organization can publish a curated set of templates under a single npm scope by shipping an `@org/create` package whose `package.json` carries a `createConfig.templates` manifest. Once published, `vp create @org` opens an interactive picker over those templates.
|
|
199
|
+
|
|
200
|
+
### Pick from an org
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Open an interactive picker over @your-org/create's manifest
|
|
204
|
+
vp create @your-org
|
|
205
|
+
|
|
206
|
+
# Run a specific manifest entry directly
|
|
207
|
+
vp create @your-org:web
|
|
208
|
+
|
|
209
|
+
# Pin to an exact version or a dist-tag
|
|
210
|
+
vp create @your-org@1.2.3
|
|
211
|
+
vp create @your-org:web@next
|
|
212
|
+
|
|
213
|
+
# Set the org as the default for a repo (see create.defaultTemplate config)
|
|
214
|
+
vp create
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Behind the scenes, `vp create @org` maps to `@org/create` (the existing npm `create-*` convention). If that package has no `createConfig.templates` field, Vite+ falls back to running the package normally — so adopting the manifest is zero-risk for orgs that already publish `@org/create`.
|
|
218
|
+
|
|
219
|
+
Private registries work automatically: Vite+ reads `.npmrc` files from the project root and `~/`, honoring `@your-org:registry=...` scope mappings and `//host/:_authToken=...` credentials.
|
|
220
|
+
|
|
221
|
+
### Authoring `@org/create`
|
|
222
|
+
|
|
223
|
+
There are two common layouts. Pick the one that matches the org's template count and release cadence.
|
|
224
|
+
|
|
225
|
+
**Bundled (recommended for most orgs).** All templates live as subdirectories of `@org/create` itself. Manifest entries use relative `./path` values. One repo, one publish, one versioning story — the same pattern used by `create-vite` and `create-next-app`.
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
@your-org/create/
|
|
229
|
+
├── package.json # "createConfig": { "templates": [{ "template": "./templates/web" }, ...] }
|
|
230
|
+
├── templates/
|
|
231
|
+
│ ├── web/
|
|
232
|
+
│ │ ├── package.json
|
|
233
|
+
│ │ └── src/...
|
|
234
|
+
│ └── library/...
|
|
235
|
+
└── README.md
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Manifest-only.** When the org already publishes independent `@org/template-*` packages (or hosts them on GitHub), `@org/create` stays a thin index.
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
@your-org/create/
|
|
242
|
+
├── package.json # "createConfig": { "templates": [{ "template": "@your-org/template-web" }, ...] }
|
|
243
|
+
└── README.md
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
The two layouts can be mixed — a manifest can point most entries at external packages and keep a few as bundled subdirectories.
|
|
247
|
+
|
|
248
|
+
Optionally, provide a `bin` script so `npm create @org` (the legacy path) keeps working for non-Vite+ users. `vp create @org` reads the manifest directly and never runs the `bin`.
|
|
249
|
+
|
|
250
|
+
### Manifest schema
|
|
251
|
+
|
|
252
|
+
The manifest lives at `createConfig.templates` in `@org/create`'s `package.json`:
|
|
253
|
+
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"name": "@your-org/create",
|
|
257
|
+
"version": "1.0.0",
|
|
258
|
+
"createConfig": {
|
|
259
|
+
"templates": [
|
|
260
|
+
{
|
|
261
|
+
"name": "monorepo",
|
|
262
|
+
"description": "Monorepo",
|
|
263
|
+
"template": "@your-org/template-monorepo",
|
|
264
|
+
"monorepo": true
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"name": "web",
|
|
268
|
+
"description": "Web app template (Vite + React)",
|
|
269
|
+
"template": "@your-org/template-web"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"name": "demo",
|
|
273
|
+
"description": "Bundled demo template",
|
|
274
|
+
"template": "./templates/demo"
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Each entry supports:
|
|
282
|
+
|
|
283
|
+
| Field | Required | Notes |
|
|
284
|
+
| ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
285
|
+
| `name` | yes | Kebab-case identifier. Used by `vp create @org:<name>` for direct selection. Must be unique within the array. |
|
|
286
|
+
| `description` | yes | One-line description shown in the picker. |
|
|
287
|
+
| `template` | yes | An npm specifier (`@org/template-foo`, optionally `@version`), a GitHub URL (`github:user/repo`), a `vite:*` builtin, a local workspace package name, or a relative path (`./templates/foo`) that resolves against the `@org/create` root. |
|
|
288
|
+
| `monorepo` | no | If `true`, marks this entry as a monorepo-creating template. Hidden from the picker when `vp create` runs inside an existing monorepo, mirroring the built-in `vite:monorepo` filter. |
|
|
289
|
+
|
|
290
|
+
An invalid manifest is a hard error, not a silent fall-through — a maintainer who shipped a manifest should hear about the offending field, e.g. `@your-org/create: createConfig.templates[2].template must be a non-empty string`.
|
|
291
|
+
|
|
292
|
+
### Bundled subdirectory templates
|
|
293
|
+
|
|
294
|
+
Relative `./...` paths resolve against the enclosing `@org/create` package root — **not** the user's cwd. The referenced directory is copied into the target project as-is (no template-engine processing); the only exception is that a small set of underscore-prefixed scaffold files (`_gitignore`, `_npmrc`, `_yarnrc.yml`) are renamed to their dotfile equivalents. Paths that escape the package root are rejected.
|
|
295
|
+
|
|
296
|
+
### Make the org the default in a repo
|
|
297
|
+
|
|
298
|
+
Commit this in `vite.config.ts` at the project root:
|
|
299
|
+
|
|
300
|
+
```ts
|
|
301
|
+
import { defineConfig } from 'vite-plus';
|
|
302
|
+
|
|
303
|
+
export default defineConfig({
|
|
304
|
+
create: { defaultTemplate: '@your-org' },
|
|
305
|
+
});
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Now `vp create` (with no argument) drops straight into the `@your-org` picker. See [`create.defaultTemplate`](/config/create) for details.
|
|
309
|
+
|
|
310
|
+
The picker always appends a trailing **Vite+ built-in templates** entry so `vite:monorepo` / `vite:application` / `vite:library` / `vite:generator` stay reachable from the picker — selecting it routes to the standard built-in flow. For scripts and CI, explicit specifiers (`vp create vite:library`) bypass the configured default.
|
|
311
|
+
|
|
312
|
+
### Non-interactive inspection
|
|
313
|
+
|
|
314
|
+
`vp create @org --no-interactive` prints the manifest as a table and exits 1:
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
A template name is required when running `vp create @your-org` in non-interactive mode.
|
|
318
|
+
|
|
319
|
+
Available templates in @your-org/create:
|
|
320
|
+
|
|
321
|
+
NAME DESCRIPTION TEMPLATE
|
|
322
|
+
web Web app template (Vite + React) @your-org/template-web
|
|
323
|
+
library TypeScript library template @your-org/template-library
|
|
324
|
+
demo Bundled demo template ./templates/demo
|
|
325
|
+
|
|
326
|
+
Examples:
|
|
327
|
+
# Scaffold a specific template from the org
|
|
328
|
+
vp create @your-org:web --no-interactive
|
|
329
|
+
|
|
330
|
+
# Or use a Vite+ built-in template
|
|
331
|
+
vp create vite:application --no-interactive
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Publishing checklist
|
|
335
|
+
|
|
336
|
+
1. Create `@org/create` (scoped npm package) if you don't already have one.
|
|
337
|
+
2. Add a `createConfig.templates` array to `package.json`. (Bundle the templates under `./templates/...` or point at external packages.)
|
|
338
|
+
3. (Optional) Provide a `bin` launcher for `npm create @org` compatibility.
|
|
339
|
+
4. Publish.
|
|
340
|
+
5. Verify: `vp create @org --no-interactive` prints the manifest table; `vp create @org` opens the picker.
|
|
341
|
+
6. (Optional) Commit `create: { defaultTemplate: '@org' }` in your internal template repos.
|