vite-plus 0.3.1 → 0.3.3

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.
Files changed (63) hide show
  1. package/README.md +1 -1
  2. package/bin/vp +1 -1
  3. package/binding/index.cjs +137 -56
  4. package/binding/index.d.cts +52 -0
  5. package/dist/{agent-C5jMYVfB.js → agent-Cu6-tXIP.js} +2 -2
  6. package/dist/bin.js +6 -5
  7. package/dist/config/bin.js +2 -2
  8. package/dist/{constants-0IAVgpox.js → constants-C2dTOTe-.js} +2 -2
  9. package/dist/create/bin.js +97 -68
  10. package/dist/{define-config-DIE9de46.cjs → define-config-D0mevyb3.cjs} +1 -1
  11. package/dist/{define-config-U3_xg7i-.js → define-config-IgzmnvvV.js} +2 -2
  12. package/dist/define-config.cjs +1 -1
  13. package/dist/define-config.js +1 -1
  14. package/dist/{editor-B5-lvRaU.js → editor-4sjlHmUh.js} +154 -36
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/lint-plugins-dev.d.ts +3 -0
  18. package/dist/lint-plugins-dev.js +2 -0
  19. package/dist/lint-plugins.cjs +21 -0
  20. package/dist/lint-plugins.d.ts +3 -0
  21. package/dist/lint-plugins.js +2 -0
  22. package/dist/migration/bin.js +7 -7
  23. package/dist/{oxlint-plugin-config-Drdl67Xp.js → oxlint-plugin-config-BVqEe9KY.js} +1 -1
  24. package/dist/oxlint-plugin.js +93 -32
  25. package/dist/pack-bin.js +1 -1
  26. package/dist/{package-BZz2Ij68.js → package-CHH8jWan.js} +1 -1
  27. package/dist/{prompts-CtzEgFY-.js → prompts-k14KgthC.js} +1 -1
  28. package/dist/{resolve-vite-config-CGks1xR7.js → resolve-vite-config-BqvS2P98.js} +2 -2
  29. package/dist/{resolve-vite-config-Dnmc-lBc.js → resolve-vite-config-CTOTuqTi.js} +1 -1
  30. package/dist/staged/bin.js +1 -1
  31. package/dist/toolchain.js +8 -8
  32. package/dist/toolchain.json +8 -8
  33. package/dist/{tsconfig-CUggNuJR.js → tsconfig-C3h9CVTA.js} +2 -2
  34. package/dist/{tsconfig-VAbm4ZzJ.js → tsconfig-euB-GmIE.js} +1 -1
  35. package/dist/version.js +2 -2
  36. package/dist/versions.js +4 -4
  37. package/docs/config/fmt.md +4 -2
  38. package/docs/config/lint.md +4 -2
  39. package/docs/config/staged.md +1 -2
  40. package/docs/guide/ci.md +28 -31
  41. package/docs/guide/commit-hooks.md +11 -34
  42. package/docs/guide/create.md +1 -2
  43. package/docs/guide/docker.md +20 -68
  44. package/docs/guide/env.md +56 -22
  45. package/docs/guide/fmt.md +3 -1
  46. package/docs/guide/global-cli.md +426 -0
  47. package/docs/guide/ide-integration.md +1 -2
  48. package/docs/guide/implode.md +14 -1
  49. package/docs/guide/index.md +37 -34
  50. package/docs/guide/install.md +18 -19
  51. package/docs/guide/lint.md +52 -1
  52. package/docs/guide/local-cli.md +123 -0
  53. package/docs/guide/migrate-rules.md +108 -267
  54. package/docs/guide/migrate.md +6 -49
  55. package/docs/guide/monorepo.md +2 -0
  56. package/docs/guide/run.md +1 -1
  57. package/docs/guide/troubleshooting.md +17 -8
  58. package/docs/guide/upgrade-project.md +61 -0
  59. package/docs/guide/upgrade.md +17 -62
  60. package/package.json +26 -17
  61. package/templates/generator/README.md +14 -0
  62. package/templates/generator/bin/index.ts +54 -5
  63. package/docs/guide/installer-env-vars.md +0 -252
@@ -15,18 +15,28 @@ Vite+ expects modern upstream tool versions.
15
15
 
16
16
  If you are migrating an existing project and it still depends on older Vite or Vitest versions, upgrade those first before adopting Vite+.
17
17
 
18
- Run `vp toolchain` to show the versions from the local Vite+ package.
19
- Run `vp toolchain --global` to show the versions from the global Vite+ release.
18
+ Run `vp toolchain` to show the versions from the local Vite+ package. Run `vp toolchain --global` to show the versions from the global Vite+ release.
20
19
 
21
20
  ## `vp check` does not run type-aware lint rules or type checks
22
21
 
23
22
  - Confirm that `lint.options.typeAware` and `lint.options.typeCheck` are enabled in `vite.config.ts`
24
23
  - Check whether your `tsconfig.json` still uses `compilerOptions.baseUrl`
25
24
 
26
- The Oxlint type checker path powered by `tsgolint` does not support `baseUrl`.
27
- `vp migrate` and `vp lint --init` try to run the `vp dlx @andrewbranch/ts5to6 --fixBaseUrl .`
28
- fix before enabling type-aware linting. If that fix fails or is declined, Vite+
29
- skips `typeAware` and `typeCheck`.
25
+ The Oxlint type checker path powered by `tsgolint` does not support `baseUrl`. `vp migrate` and `vp lint --init` try to run the `vp dlx @andrewbranch/ts5to6 --fixBaseUrl .` fix before enabling type-aware linting. If that fix fails or is declined, Vite+ skips `typeAware` and `typeCheck`.
26
+
27
+ ## Nested lint or format config is not applied
28
+
29
+ Vite+ does not currently support nested lint or format configuration. When running `vp lint`, `vp fmt`, or `vp check` from the workspace root, do not rely on configs in subdirectories or on `lint` and `fmt` blocks in package-level `vite.config.ts` files to override the root settings.
30
+
31
+ Keep lint and format settings in the root `vite.config.ts`. Use [`lint.overrides`](/guide/monorepo#root-config-with-overrides) and [`fmt.overrides`](/guide/monorepo#format-overrides) for file- or package-specific settings. You can also [import configuration objects](/guide/monorepo#composing-configuration-files) into the root config to keep settings in separate files.
32
+
33
+ For IDE integration, we have `disableNestedConfig` and `fmt.disableNestedConfig` config to disable nested lint and format configs and keep editor behavior aligned with the root Vite+ config. See [IDE Integration](/guide/ide-integration) for setup instructions for your editor.
34
+
35
+ We're holding off on nested config support for now. Some of the factors we're considering are how implicit config discovery affects the predictability of linting and formatting, what context AI agents need to understand the settings that apply, and the potential performance cost of finding and loading multiple configs. At the same time, we recognize that keeping package-specific context close to the code may have benefits. The use cases we've heard so far haven't given us a strong enough reason to commit to those semantics. Waiting leaves room to add support later, and we'd like to hear why your project needs nested configs, especially where root-level overrides fall short.
36
+
37
+ Do you need nested configs? [Share your use case and opinion on GitHub](https://github.com/voidzero-dev/vite-plus/discussions/2669), including your project structure, the reason why you want them and whether root-level overrides meet your needs.
38
+
39
+ We sincerely hope to hear your feedback. This will help us decide whether to improve the current situation in the future.
30
40
 
31
41
  ## VS Code extension does not read `vite.config.ts`
32
42
 
@@ -62,8 +72,7 @@ If `vp staged` fails or your pre-commit hook does not run:
62
72
  - if status shows `Preference: disabled (local)`, re-enable with `vp hooks enable`
63
73
  - check whether hooks were skipped intentionally through `VP_GIT_HOOKS=0`
64
74
 
65
- To stop hooks in this clone without deleting project policy files, run `vp hooks disable`.
66
- See the [Commit hooks guide](/guide/commit-hooks) for the full workflow.
75
+ To stop hooks in this clone without deleting project policy files, run `vp hooks disable`. See the [Commit hooks guide](/guide/commit-hooks) for the full workflow.
67
76
 
68
77
  A minimal staged config looks like this:
69
78
 
@@ -0,0 +1,61 @@
1
+ # Update Vite+
2
+
3
+ Updating `vite-plus` and its related project dependencies. To upgrade the global `vp` binary, see [Upgrading Vite+](/guide/upgrade).
4
+
5
+ ## Update with Migrate
6
+
7
+ The recommended way to update a project is to use `vp migrate`, which keeps the toolchain dependencies aligned.
8
+
9
+ After updating the project's `vite-plus` dependency, run the local CLI to align the toolchain versions:
10
+
11
+ ```bash
12
+ ./node_modules/.bin/vp migrate
13
+ ```
14
+
15
+ If your global CLI is newer than the project's version, running `vp migrate` upgrades the project to that global version instead:
16
+
17
+ ```bash
18
+ vp migrate
19
+ ```
20
+
21
+ On a project that is already on Vite+, migrate does a toolchain version upgrade only: it re-pins `vite-plus`, the `vite` -> `@voidzero-dev/vite-plus-core` alias, and the `vitest` pin to the versions bundled with the CLI running the migration, across every workspace package. It skips the first-time setup steps (git hooks, editor and agent files, lint migration), so a version bump does not re-touch things you already configured. Pass `--full` to also run that setup.
22
+
23
+ ## Manually Updating
24
+
25
+ Update `vite-plus` and the `vite` alias to `@voidzero-dev/vite-plus-core` together, keeping the core version aligned with `vite-plus`. Update these entries wherever they are declared in your workspace, including overrides or catalogs, then install dependencies to refresh the lockfile. Also [update the Vitest pin](#updating-the-vitest-pin) to match the bundled version.
26
+
27
+ Without the global CLI, run the `vp` commands on this page through your package manager, for example `pnpm exec vp toolchain vitest`.
28
+
29
+ ### Updating the Vitest Pin
30
+
31
+ If you migrated with `vp migrate`, your project pins `vitest` to an exact version so the whole project shares a single Vitest copy with the bundled `vp test` runner. The pin lives in your package manager's override block:
32
+
33
+ - **npm / Bun:** a `vitest` entry under `overrides` in `package.json`
34
+ - **Yarn:** a `vitest` entry under `resolutions` in `package.json`
35
+ - **pnpm:** a `vitest@*` entry under `overrides` in `pnpm-workspace.yaml`. If your `package.json` already has a `pnpm` field, the entry lives under `pnpm.overrides` in `package.json` instead. pnpm ignores `pnpm-workspace.yaml` overrides when `package.json` defines `pnpm.overrides`.
36
+
37
+ A Vite+ release can bump the bundled Vitest. Because that pin also applies to `vite-plus`'s own `vitest` dependency, an out-of-date pin keeps installing the previous runner even after you upgrade `vite-plus` — splitting Vitest's internals (mocks, `expect`, runner state) between the pinned copy and the one `vp test` loads.
38
+
39
+ After upgrading `vite-plus`, re-pin `vitest` to the version Vite+ now bundles. Check that version with:
40
+
41
+ ```bash
42
+ vp toolchain vitest
43
+ ```
44
+
45
+ Then set the `vitest` override to that exact version and reinstall dependencies.
46
+
47
+ ::: details Why pnpm overrides use `@*`
48
+ Under pnpm the managed keys use an explicit `@*` range (`vite@*`, `vitest@*`). pnpm applies an override by replacing the declared spec on every manifest, importer manifests included. A bare key matches any spec, including `catalog:`. The `@*` range keeps the override on the semver ranges that transitive and peer declarations use, and leaves `catalog:` references intact. `vp up` therefore no longer rewrites them to a concrete version.
49
+ :::
50
+
51
+ ## Preview Builds
52
+
53
+ After [installing a preview build of the global CLI](/guide/upgrade#global-vp-preview), run migrate in the project to move its local `vite-plus` onto the same build:
54
+
55
+ ```bash
56
+ vp migrate
57
+ ```
58
+
59
+ Migrate writes the bridge registry to `.npmrc`. For Yarn Berry, it writes the registry to `.yarnrc.yml`. It pins `vite-plus` and the `vite` alias to the matching `0.0.0-commit.<sha>` version. The `vite` alias points to `@voidzero-dev/vite-plus-core`. Commit the registry line if the project CI must test the preview.
60
+
61
+ After the install, run `vp toolchain` to show the selected versions. After testing, set `vite-plus` to `latest`. Remove the bridge `registry` line from `.npmrc` or `.yarnrc.yml`. Then run `vp install`.
@@ -1,13 +1,13 @@
1
1
  # Upgrading Vite+
2
2
 
3
- Use `vp upgrade` to update the global `vp` binary, and use Vite+'s package management commands to update the local `vite-plus` package in a project.
3
+ Use `vp upgrade` to update the global `vp` binary. To update the local `vite-plus` package in a project, see [Update Vite+](/guide/upgrade-project).
4
4
 
5
5
  ## Overview
6
6
 
7
7
  There are two parts to upgrading Vite+:
8
8
 
9
9
  - The global `vp` command installed on your machine
10
- - The local `vite-plus` package used by an individual project
10
+ - The [local `vite-plus` package](/guide/upgrade-project) used by an individual project
11
11
 
12
12
  You can upgrade both of them independently.
13
13
 
@@ -22,20 +22,18 @@ vp toolchain vite rolldown oxc
22
22
  vp toolchain --json
23
23
  ```
24
24
 
25
- The command uses the local `vite-plus` package when the project has one. Use
26
- `--global` to show the release for the global `vp` command:
25
+ The command uses the local `vite-plus` package when the project has one. Use `--global` to show the release for the global `vp` command:
27
26
 
28
27
  ```bash
29
28
  vp toolchain --global
30
29
  ```
31
30
 
32
- `vp why <package>` shows the dependency graph from the package manager. It
33
- cannot show code bundled into `@voidzero-dev/vite-plus-core`. It also cannot
34
- show engines compiled into Vite+. Use `vp toolchain` to show those versions and
35
- relationships.
31
+ `vp why <package>` shows the dependency graph from the package manager. It cannot show code bundled into `@voidzero-dev/vite-plus-core`. It also cannot show engines compiled into Vite+. Use `vp toolchain` to show those versions and relationships.
36
32
 
37
33
  ## Global `vp`
38
34
 
35
+ Update the global CLI with:
36
+
39
37
  ```bash
40
38
  vp upgrade # upgrade to the latest version
41
39
  vp upgrade --check # check for updates without installing
@@ -45,27 +43,14 @@ vp upgrade --registry <registry> # use a custom npm registry
45
43
 
46
44
  ### Move an Existing Install to the Split Directory Layout
47
45
 
48
- Vite+ 0.3.0 is the first release that supports the split directory layout.
49
- Vite+ 0.2.x and earlier use the single-root layout for fresh installs and
50
- upgrades.
46
+ Vite+ 0.3.0 is the first release that supports the split directory layout. Vite+ 0.2.x and earlier use the single-root layout for fresh installs and upgrades.
51
47
 
52
- `vp upgrade` keeps an existing default install in `~/.vite-plus` on Unix or
53
- `%USERPROFILE%\.vite-plus` on Windows. The command upgrades the CLI in that
54
- directory. It does not move the install to the split platform directories. You
55
- can continue to use the existing layout.
48
+ `vp upgrade` keeps an existing default install in `~/.vite-plus` on Unix or `%USERPROFILE%\.vite-plus` on Windows. The command upgrades the CLI in that directory. It does not move the install to the split platform directories. You can continue to use the existing layout.
56
49
 
57
- To use the split layout now, remove the existing install. Then install Vite+
58
- again. Run `vp implode` in a shell that uses the current install. The command
59
- removes the generated environment file and shell profile entries. It does not
60
- unset directory variables in the current shell. Unset all Vite+ directory
61
- variables before you run the installer. This can include values from an earlier
62
- preview environment file. Alternatively, start a new shell after `vp implode`.
63
- Then run the installer in the new shell.
50
+ To use the split layout now, remove the existing install. Then install Vite+ again. Run `vp implode` in a shell that uses the current install. The command removes the generated environment file and shell profile entries. It does not unset directory variables in the current shell. Unset all Vite+ directory variables before you run the installer. This can include values from an earlier preview environment file. Alternatively, start a new shell after `vp implode`. Then run the installer in the new shell.
64
51
 
65
52
  ::: warning
66
- `vp implode` removes all Vite+-managed Node.js runtimes, global packages,
67
- configuration, and caches. Keep the existing layout if you do not want to
68
- recreate that data.
53
+ `vp implode` removes all Vite+-managed Node.js runtimes, global packages, configuration, and caches. Keep the existing layout if you do not want to recreate that data.
69
54
  :::
70
55
 
71
56
  ```bash
@@ -82,11 +67,7 @@ Remove-Item Env:\VP_HOME, Env:\VP_DATA_DIR, Env:\VP_BIN_DIR, Env:\VP_CACHE_DIR -
82
67
  irm https://vite.plus/ps1 | iex
83
68
  ```
84
69
 
85
- Also remove persistent definitions of `VP_HOME`, `VP_DATA_DIR`, `VP_BIN_DIR`,
86
- and `VP_CACHE_DIR` from your shell profile or system environment. A fresh
87
- install uses `VP_HOME` or a complete `VP_*_DIR` group that remains set.
88
- `VP_HOME` selects the single-root layout. If you install Vite+ 0.2.x or earlier,
89
- the installer also uses this layout. The installer prints a notice.
70
+ Also remove persistent definitions of `VP_HOME`, `VP_DATA_DIR`, `VP_BIN_DIR`, and `VP_CACHE_DIR` from your shell profile or system environment. A fresh install uses `VP_HOME` or a complete `VP_*_DIR` group that remains set. `VP_HOME` selects the single-root layout. If you install Vite+ 0.2.x or earlier, the installer also uses this layout. The installer prints a notice.
90
71
 
91
72
  ### Rollback
92
73
 
@@ -98,35 +79,17 @@ vp upgrade --rollback
98
79
 
99
80
  Older versions are pruned automatically after each upgrade. The active version and the previous version are always kept, so a rollback target is never removed.
100
81
 
101
- ## Local `vite-plus`
82
+ ### Homebrew
102
83
 
103
- The recommended way to upgrade an existing Vite+ project is `vp migrate`:
84
+ Homebrew owns its installed binary and JavaScript package. Update them with:
104
85
 
105
86
  ```bash
106
- vp migrate
87
+ brew upgrade vite-plus
107
88
  ```
108
89
 
109
- On a project that is already on Vite+, migrate does a toolchain version upgrade only: it re-pins `vite-plus`, the `vite` -> `@voidzero-dev/vite-plus-core` alias, and the `vitest` pin to the versions the global `vp` now bundles, across every workspace package. It skips the first-time setup steps (git hooks, editor and agent files, lint migration), so a version bump does not re-touch things you already configured. Pass `--full` to also run that setup.
110
-
111
- ### Updating the Vitest Pin
112
-
113
- If you migrated with `vp migrate`, your project pins `vitest` to an exact version so the whole project shares a single Vitest copy with the bundled `vp test` runner. The pin lives in your package manager's override block:
114
-
115
- - **npm / Bun:** a `vitest` entry under `overrides` in `package.json`
116
- - **Yarn:** a `vitest` entry under `resolutions` in `package.json`
117
- - **pnpm:** a `vitest@*` entry under `overrides` in `pnpm-workspace.yaml`. If your `package.json` already has a `pnpm` field, the entry lives under `pnpm.overrides` in `package.json` instead. pnpm ignores `pnpm-workspace.yaml` overrides when `package.json` defines `pnpm.overrides`.
90
+ `vp upgrade` detects Homebrew installations and directs you to this command without downloading or installing another version. This also applies to `--force`, a specific version, and `--rollback`. Use Homebrew to manage these installations.
118
91
 
119
- Under pnpm the managed keys use an explicit `@*` range (`vite@*`, `vitest@*`). pnpm applies an override by replacing the declared spec on every manifest, importer manifests included. A bare key matches any spec, including `catalog:`. The `@*` range keeps the override on the semver ranges that transitive and peer declarations use, and leaves `catalog:` references intact. `vp up` therefore no longer rewrites them to a concrete version.
120
-
121
- A Vite+ release can bump the bundled Vitest. Because that pin also applies to `vite-plus`'s own `vitest` dependency, an out-of-date pin keeps installing the previous runner even after you upgrade `vite-plus` — splitting Vitest's internals (mocks, `expect`, runner state) between the pinned copy and the one `vp test` loads.
122
-
123
- After upgrading `vite-plus`, re-pin `vitest` to the version Vite+ now bundles. Check that version with:
124
-
125
- ```bash
126
- vp toolchain vitest
127
- ```
128
-
129
- Then set the `vitest` override to that exact version, or rerun `vp migrate` to update the pin for you.
92
+ `vp upgrade --check` directs you to `brew outdated vite-plus`. Automatic npm update checks and notices are disabled for Homebrew installations.
130
93
 
131
94
  ## Preview Builds
132
95
 
@@ -160,12 +123,4 @@ The installer uses the registry bridge to resolve the ref to a `0.0.0-commit.<sh
160
123
 
161
124
  ### Local `vite-plus` Preview
162
125
 
163
- After installing the preview global CLI above, run migrate in the project to move its local `vite-plus` onto the same build:
164
-
165
- ```bash
166
- vp migrate
167
- ```
168
-
169
- Migrate writes the bridge registry to `.npmrc`. For Yarn Berry, it writes the registry to `.yarnrc.yml`. It pins `vite-plus` and the `vite` alias to the matching `0.0.0-commit.<sha>` version. The `vite` alias points to `@voidzero-dev/vite-plus-core`. Commit the registry line if the project CI must test the preview.
170
-
171
- After the install, run `vp toolchain` to show the selected versions. After testing, set `vite-plus` to `latest`. Remove the bridge `registry` line from `.npmrc` or `.yarnrc.yml`. Then run `vp install`.
126
+ To use the same preview in a project, follow [Update Vite+](/guide/upgrade-project#preview-builds).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plus",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "The Unified Toolchain for the Web",
5
5
  "homepage": "https://viteplus.dev/guide",
6
6
  "bugs": {
@@ -69,6 +69,15 @@
69
69
  "types": "./dist/lint.d.ts",
70
70
  "import": "./dist/lint.js"
71
71
  },
72
+ "./lint/plugins": {
73
+ "types": "./dist/lint-plugins.d.ts",
74
+ "import": "./dist/lint-plugins.js",
75
+ "require": "./dist/lint-plugins.cjs"
76
+ },
77
+ "./lint/plugins-dev": {
78
+ "types": "./dist/lint-plugins-dev.d.ts",
79
+ "default": "./dist/lint-plugins-dev.js"
80
+ },
72
81
  "./oxlint-plugin": {
73
82
  "module-sync": "./dist/oxlint-plugin.js",
74
83
  "node": "./dist/oxlint-plugin.js",
@@ -350,7 +359,7 @@
350
359
  }
351
360
  },
352
361
  "dependencies": {
353
- "@oxc-project/types": "=0.148.0",
362
+ "@oxc-project/types": "=0.150.0",
354
363
  "@oxlint/plugins": "=1.79.0",
355
364
  "@vitest/browser": "4.1.11",
356
365
  "@vitest/browser-preview": "4.1.11",
@@ -361,23 +370,23 @@
361
370
  "@vitest/snapshot": "4.1.11",
362
371
  "@vitest/spy": "4.1.11",
363
372
  "@vitest/utils": "4.1.11",
364
- "oxfmt": "=0.66.0",
365
- "oxlint": "=1.81.0",
373
+ "oxfmt": "=0.68.0",
374
+ "oxlint": "=1.83.0",
366
375
  "oxlint-tsgolint": "=7.0.2001",
367
- "vite": "npm:@voidzero-dev/vite-plus-core@0.3.1",
376
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.3.3",
368
377
  "vitest": "4.1.11"
369
378
  },
370
379
  "devDependencies": {
371
- "@emnapi/core": "2.0.0-alpha.4",
372
- "@emnapi/runtime": "2.0.0-alpha.4",
373
- "@napi-rs/cli": "^3.8.2",
380
+ "@emnapi/core": "2.0.0-alpha.5",
381
+ "@emnapi/runtime": "2.0.0-alpha.5",
382
+ "@napi-rs/cli": "^3.10.0",
374
383
  "@nkzw/safe-word-list": "^3.1.0",
375
384
  "@types/cross-spawn": "^6.0.6",
376
385
  "@types/semver": "^7.8.0",
377
386
  "@types/validate-npm-package-name": "^4.0.2",
378
387
  "@vitest/browser-playwright": "4.1.11",
379
388
  "@vitest/browser-webdriverio": "4.1.11",
380
- "@voidzero-dev/vite-plus-prompts": "0.0.0",
389
+ "@voidzero-dev/vite-plus-prompts": "0.3.3",
381
390
  "bingo": "^0.9.3",
382
391
  "cac": "^7.0.0",
383
392
  "cross-spawn": "^7.0.5",
@@ -425,14 +434,14 @@
425
434
  "node": "^20.19.0 || ^22.18.0 || >=24.11.0"
426
435
  },
427
436
  "optionalDependencies": {
428
- "@voidzero-dev/vite-plus-darwin-arm64": "0.3.1",
429
- "@voidzero-dev/vite-plus-darwin-x64": "0.3.1",
430
- "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.3.1",
431
- "@voidzero-dev/vite-plus-linux-arm64-musl": "0.3.1",
432
- "@voidzero-dev/vite-plus-linux-x64-gnu": "0.3.1",
433
- "@voidzero-dev/vite-plus-linux-x64-musl": "0.3.1",
434
- "@voidzero-dev/vite-plus-win32-x64-msvc": "0.3.1",
435
- "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.3.1"
437
+ "@voidzero-dev/vite-plus-darwin-arm64": "0.3.3",
438
+ "@voidzero-dev/vite-plus-darwin-x64": "0.3.3",
439
+ "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.3.3",
440
+ "@voidzero-dev/vite-plus-linux-arm64-musl": "0.3.3",
441
+ "@voidzero-dev/vite-plus-linux-x64-gnu": "0.3.3",
442
+ "@voidzero-dev/vite-plus-linux-x64-musl": "0.3.3",
443
+ "@voidzero-dev/vite-plus-win32-x64-msvc": "0.3.3",
444
+ "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.3.3"
436
445
  },
437
446
  "scripts": {
438
447
  "build": "oxnode -C dev ./build.ts",
@@ -11,6 +11,20 @@ From monorepo root:
11
11
  vp create
12
12
  ```
13
13
 
14
+ For automation, provide the directory and every required template option:
15
+
16
+ ```bash
17
+ vp create <generator-name> --no-interactive -- --directory new-package --name new-package
18
+ ```
19
+
20
+ Vite+ sets `VP_CREATE_INTERACTIVE=0` for non-interactive local Bingo generators.
21
+ This starter then validates the arguments and runs Bingo's programmatic API.
22
+ Missing options and existing directories fail before any files are generated.
23
+ Existing generators are copied project files and are not updated by upgrading Vite+.
24
+ To adopt this behavior, update their entrypoint to match this starter.
25
+ Direct invocation uses the interactive CLI unless this variable is set to `0`.
26
+ When adding template options, also add their CLI types in `bin/index.ts`.
27
+
14
28
  ## Development
15
29
 
16
30
  ```bash
@@ -1,10 +1,59 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { runTemplateCLI, type Template } from 'bingo';
3
+ import fs from 'node:fs';
4
+ import { parseArgs } from 'node:util';
5
+
6
+ import { runTemplate, runTemplateCLI, type Template } from 'bingo';
7
+ import { z } from 'zod';
4
8
 
5
9
  import template from '../src/template.ts';
6
10
 
7
- // runTemplateCLI accepts the base `Template` type, which is wider than the
8
- // strongly typed template returned by createTemplate(). Cast through `unknown`
9
- // to bridge the two.
10
- process.exitCode = await runTemplateCLI(template as unknown as Template);
11
+ async function main() {
12
+ if (
13
+ process.env.VP_CREATE_INTERACTIVE !== '0' ||
14
+ process.argv.includes('--help') ||
15
+ process.argv.includes('--version')
16
+ ) {
17
+ // runTemplateCLI accepts a wider type than createTemplate returns.
18
+ return await runTemplateCLI(template as unknown as Template);
19
+ }
20
+
21
+ // Add CLI entries here when adding options to src/template.ts.
22
+ const { values } = parseArgs({
23
+ options: {
24
+ directory: { type: 'string' },
25
+ name: { type: 'string' },
26
+ offline: { type: 'boolean' },
27
+ 'skip-requests': { type: 'boolean' },
28
+ 'skip-files': { type: 'boolean' },
29
+ 'skip-scripts': { type: 'boolean' },
30
+ },
31
+ });
32
+ if (!values.directory?.trim()) {
33
+ throw new Error('Missing --directory. Pass generator options after -- in vp create.');
34
+ }
35
+ const options = z.object(template.options).parse(values);
36
+ if (fs.existsSync(values.directory)) {
37
+ throw new Error(`Directory already exists: ${values.directory}`);
38
+ }
39
+
40
+ await runTemplate(template, {
41
+ directory: values.directory,
42
+ mode: 'setup',
43
+ options,
44
+ offline: values.offline,
45
+ skips: {
46
+ requests: values['skip-requests'],
47
+ files: values['skip-files'],
48
+ scripts: values['skip-scripts'],
49
+ },
50
+ });
51
+ return 0;
52
+ }
53
+
54
+ try {
55
+ process.exitCode = await main();
56
+ } catch (error) {
57
+ console.error(error instanceof Error ? error.message : String(error));
58
+ process.exitCode = 1;
59
+ }