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.
- package/README.md +1 -1
- package/bin/vp +1 -1
- package/binding/index.cjs +137 -56
- package/binding/index.d.cts +52 -0
- package/dist/{agent-C5jMYVfB.js → agent-Cu6-tXIP.js} +2 -2
- package/dist/bin.js +6 -5
- package/dist/config/bin.js +2 -2
- package/dist/{constants-0IAVgpox.js → constants-C2dTOTe-.js} +2 -2
- package/dist/create/bin.js +97 -68
- package/dist/{define-config-DIE9de46.cjs → define-config-D0mevyb3.cjs} +1 -1
- package/dist/{define-config-U3_xg7i-.js → define-config-IgzmnvvV.js} +2 -2
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{editor-B5-lvRaU.js → editor-4sjlHmUh.js} +154 -36
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/lint-plugins-dev.d.ts +3 -0
- package/dist/lint-plugins-dev.js +2 -0
- package/dist/lint-plugins.cjs +21 -0
- package/dist/lint-plugins.d.ts +3 -0
- package/dist/lint-plugins.js +2 -0
- package/dist/migration/bin.js +7 -7
- package/dist/{oxlint-plugin-config-Drdl67Xp.js → oxlint-plugin-config-BVqEe9KY.js} +1 -1
- package/dist/oxlint-plugin.js +93 -32
- package/dist/pack-bin.js +1 -1
- package/dist/{package-BZz2Ij68.js → package-CHH8jWan.js} +1 -1
- package/dist/{prompts-CtzEgFY-.js → prompts-k14KgthC.js} +1 -1
- package/dist/{resolve-vite-config-CGks1xR7.js → resolve-vite-config-BqvS2P98.js} +2 -2
- package/dist/{resolve-vite-config-Dnmc-lBc.js → resolve-vite-config-CTOTuqTi.js} +1 -1
- package/dist/staged/bin.js +1 -1
- package/dist/toolchain.js +8 -8
- package/dist/toolchain.json +8 -8
- package/dist/{tsconfig-CUggNuJR.js → tsconfig-C3h9CVTA.js} +2 -2
- package/dist/{tsconfig-VAbm4ZzJ.js → tsconfig-euB-GmIE.js} +1 -1
- package/dist/version.js +2 -2
- package/dist/versions.js +4 -4
- package/docs/config/fmt.md +4 -2
- package/docs/config/lint.md +4 -2
- package/docs/config/staged.md +1 -2
- package/docs/guide/ci.md +28 -31
- package/docs/guide/commit-hooks.md +11 -34
- package/docs/guide/create.md +1 -2
- package/docs/guide/docker.md +20 -68
- package/docs/guide/env.md +56 -22
- package/docs/guide/fmt.md +3 -1
- package/docs/guide/global-cli.md +426 -0
- package/docs/guide/ide-integration.md +1 -2
- package/docs/guide/implode.md +14 -1
- package/docs/guide/index.md +37 -34
- package/docs/guide/install.md +18 -19
- package/docs/guide/lint.md +52 -1
- package/docs/guide/local-cli.md +123 -0
- package/docs/guide/migrate-rules.md +108 -267
- package/docs/guide/migrate.md +6 -49
- package/docs/guide/monorepo.md +2 -0
- package/docs/guide/run.md +1 -1
- package/docs/guide/troubleshooting.md +17 -8
- package/docs/guide/upgrade-project.md +61 -0
- package/docs/guide/upgrade.md +17 -62
- package/package.json +26 -17
- package/templates/generator/README.md +14 -0
- package/templates/generator/bin/index.ts +54 -5
- package/docs/guide/installer-env-vars.md +0 -252
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Commit Hooks
|
|
2
2
|
|
|
3
|
-
Use `vp hooks` to manage the Git hook dispatcher, `vp config` for project setup
|
|
4
|
-
(hooks + agent integration), and `vp staged` to run checks on staged files.
|
|
3
|
+
Use `vp hooks` to manage the Git hook dispatcher, `vp config` for project setup (hooks + agent integration), and `vp staged` to run checks on staged files.
|
|
5
4
|
|
|
6
5
|
## Overview
|
|
7
6
|
|
|
@@ -64,10 +63,7 @@ Check the `Dispatcher` and `core.hooksPath` lines to see whether hooks are actua
|
|
|
64
63
|
|
|
65
64
|
### `vp config`
|
|
66
65
|
|
|
67
|
-
`vp config` configures Vite+ for the current project. It installs the generated Git hook
|
|
68
|
-
dispatcher (unless hooks were disabled with `vp hooks disable`) and can also handle related
|
|
69
|
-
project integration such as agent setup. The hooks directory defaults to `.vite-hooks`, or the
|
|
70
|
-
last directory used by `vp hooks` / `vp config` in this clone:
|
|
66
|
+
`vp config` configures Vite+ for the current project. It installs the generated Git hook dispatcher (unless hooks were disabled with `vp hooks disable`) and can also handle related project integration such as agent setup. The hooks directory defaults to `.vite-hooks`, or the last directory used by `vp hooks` / `vp config` in this clone:
|
|
71
67
|
|
|
72
68
|
```bash
|
|
73
69
|
vp config
|
|
@@ -76,24 +72,15 @@ vp config --no-hooks
|
|
|
76
72
|
vp config --no-agent
|
|
77
73
|
```
|
|
78
74
|
|
|
79
|
-
Use `--no-hooks` when you want `vp config` to leave the Git hook dispatcher unchanged. Use
|
|
80
|
-
`--no-agent` when you want it to skip updates to existing coding agent instruction files. You can
|
|
81
|
-
pass both flags when you want `vp config` to skip both setup steps. After `vp hooks disable`,
|
|
82
|
-
`vp config` skips reinstalling the dispatcher and points you at `vp hooks enable` instead of
|
|
83
|
-
prompting again.
|
|
75
|
+
Use `--no-hooks` when you want `vp config` to leave the Git hook dispatcher unchanged. Use `--no-agent` when you want it to skip updates to existing coding agent instruction files. You can pass both flags when you want `vp config` to skip both setup steps. After `vp hooks disable`, `vp config` skips reinstalling the dispatcher and points you at `vp hooks enable` instead of prompting again.
|
|
84
76
|
|
|
85
|
-
You can also set `VP_GIT_HOOKS=0` to disable hook installation from lifecycle scripts such as
|
|
86
|
-
`prepare` or `postinstall`.
|
|
77
|
+
You can also set `VP_GIT_HOOKS=0` to disable hook installation from lifecycle scripts such as `prepare` or `postinstall`.
|
|
87
78
|
|
|
88
|
-
Project-owned hook scripts such as `.vite-hooks/pre-commit` should be committed to the repository.
|
|
89
|
-
The generated dispatcher and shims under `.vite-hooks/_` are ignored and recreated by `vp config`
|
|
90
|
-
or `vp hooks enable`. Neither command creates or modifies project hook scripts or staged-file
|
|
91
|
-
configuration.
|
|
79
|
+
Project-owned hook scripts such as `.vite-hooks/pre-commit` should be committed to the repository. The generated dispatcher and shims under `.vite-hooks/_` are ignored and recreated by `vp config` or `vp hooks enable`. Neither command creates or modifies project hook scripts or staged-file configuration.
|
|
92
80
|
|
|
93
81
|
### `vp staged`
|
|
94
82
|
|
|
95
|
-
`vp staged` runs staged-file checks using the `staged` config from `vite.config.ts`. To run it
|
|
96
|
-
before each commit, add it to the project-owned pre-commit hook:
|
|
83
|
+
`vp staged` runs staged-file checks using the `staged` config from `vite.config.ts`. To run it before each commit, add it to the project-owned pre-commit hook:
|
|
97
84
|
|
|
98
85
|
```bash
|
|
99
86
|
vp staged
|
|
@@ -119,12 +106,7 @@ export default defineConfig({
|
|
|
119
106
|
});
|
|
120
107
|
```
|
|
121
108
|
|
|
122
|
-
This is the default Vite+ approach and should replace separate `lint-staged` configuration in most
|
|
123
|
-
projects. When you opt into hooks during `vp create`, Vite+ scaffolds both this configuration and
|
|
124
|
-
the corresponding pre-commit hook. During `vp migrate`, existing hook policy is preserved, and
|
|
125
|
-
the default is introduced only when no existing hook policy is found. Because
|
|
126
|
-
`vp staged` reads from `vite.config.ts`, your staged-file checks stay in the same place as your
|
|
127
|
-
lint, format, test, build, and task-runner config.
|
|
109
|
+
This is the default Vite+ approach and should replace separate `lint-staged` configuration in most projects. When you opt into hooks during `vp create`, Vite+ scaffolds both this configuration and the corresponding pre-commit hook. During `vp migrate`, existing hook policy is preserved, and the default is introduced only when no existing hook policy is found. Because `vp staged` reads from `vite.config.ts`, your staged-file checks stay in the same place as your lint, format, test, build, and task-runner config.
|
|
128
110
|
|
|
129
111
|
## Disabling Hooks in Specific Environments
|
|
130
112
|
|
|
@@ -157,8 +139,7 @@ Because the hook itself reads this file, it works even when the committing proce
|
|
|
157
139
|
|
|
158
140
|
## Removing commit hooks
|
|
159
141
|
|
|
160
|
-
To stop using the Vite+ hook dispatcher in this clone (and keep `prepare` / `vp config` from
|
|
161
|
-
reinstalling it):
|
|
142
|
+
To stop using the Vite+ hook dispatcher in this clone (and keep `prepare` / `vp config` from reinstalling it):
|
|
162
143
|
|
|
163
144
|
```bash
|
|
164
145
|
vp hooks disable
|
|
@@ -170,8 +151,7 @@ This:
|
|
|
170
151
|
|
|
171
152
|
1. Unsets `core.hooksPath` when it points at the Vite+ dispatcher
|
|
172
153
|
2. Removes the generated `<hooks-dir>/_` directory
|
|
173
|
-
3. Records a **local** disable preference so lifecycle scripts skip reinstall until you run
|
|
174
|
-
`vp hooks enable` again
|
|
154
|
+
3. Records a **local** disable preference so lifecycle scripts skip reinstall until you run `vp hooks enable` again
|
|
175
155
|
|
|
176
156
|
To re-enable:
|
|
177
157
|
|
|
@@ -179,8 +159,7 @@ To re-enable:
|
|
|
179
159
|
vp hooks enable
|
|
180
160
|
```
|
|
181
161
|
|
|
182
|
-
If you no longer want hooks for the project at all (shared with teammates), also remove `vp config`
|
|
183
|
-
from the `prepare` or `postinstall` script in `package.json`.
|
|
162
|
+
If you no longer want hooks for the project at all (shared with teammates), also remove `vp config` from the `prepare` or `postinstall` script in `package.json`.
|
|
184
163
|
|
|
185
164
|
### Manual equivalent
|
|
186
165
|
|
|
@@ -195,6 +174,4 @@ git config --local vp.hooks.disabled true
|
|
|
195
174
|
# git config --local vp.hooks.dir .vite-hooks
|
|
196
175
|
```
|
|
197
176
|
|
|
198
|
-
Project-owned scripts such as `.vite-hooks/pre-commit` and the `staged` block in `vite.config.ts`
|
|
199
|
-
can remain for later use, or you can remove them separately if the project no longer needs them.
|
|
200
|
-
`vp hooks disable` does **not** delete those project-owned files.
|
|
177
|
+
Project-owned scripts such as `.vite-hooks/pre-commit` and the `staged` block in `vite.config.ts` can remain for later use, or you can remove them separately if the project no longer needs them. `vp hooks disable` does **not** delete those project-owned files.
|
package/docs/guide/create.md
CHANGED
|
@@ -57,8 +57,7 @@ Run `vp create --list` to see the built-in templates and the common shorthand te
|
|
|
57
57
|
- `--hooks` enables pre-commit hook setup (dispatcher + `.vite-hooks` + `staged` config)
|
|
58
58
|
- `--no-hooks` skips hook setup
|
|
59
59
|
|
|
60
|
-
After create, manage the dispatcher with `vp hooks status`, `vp hooks disable`, and `vp hooks enable`.
|
|
61
|
-
See the [Commit hooks guide](/guide/commit-hooks).
|
|
60
|
+
After create, manage the dispatcher with `vp hooks status`, `vp hooks disable`, and `vp hooks enable`. See the [Commit hooks guide](/guide/commit-hooks).
|
|
62
61
|
|
|
63
62
|
### Dependency build scripts
|
|
64
63
|
|
package/docs/guide/docker.md
CHANGED
|
@@ -6,16 +6,11 @@ Vite+ publishes an official Docker image with the `vp` CLI preinstalled:
|
|
|
6
6
|
ghcr.io/voidzero-dev/vite-plus
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Use it for builds, CI, and devcontainers. It is not intended as a production
|
|
10
|
-
runtime image.
|
|
9
|
+
Use it for builds, CI, and devcontainers. It is not intended as a production runtime image.
|
|
11
10
|
|
|
12
|
-
`vp` resolves the Node.js version from your project (`.node-version`,
|
|
13
|
-
`devEngines.runtime`, or `engines.node`) and downloads that exact version during
|
|
14
|
-
install/build. This means the image does not need Node-version-specific tags.
|
|
11
|
+
`vp` resolves the Node.js version from your project (`.node-version`, `devEngines.runtime`, or `engines.node`) and downloads that exact version during install/build. This means the image does not need Node-version-specific tags.
|
|
15
12
|
|
|
16
|
-
For production, use a multi-stage build: build the app with the Vite+ image, then
|
|
17
|
-
copy only the resolved Node.js binary, build output, and production dependencies
|
|
18
|
-
into a smaller runtime image.
|
|
13
|
+
For production, use a multi-stage build: build the app with the Vite+ image, then copy only the resolved Node.js binary, build output, and production dependencies into a smaller runtime image.
|
|
19
14
|
|
|
20
15
|
## Image tags
|
|
21
16
|
|
|
@@ -28,19 +23,13 @@ Tags track the `vp` version:
|
|
|
28
23
|
| `ghcr.io/voidzero-dev/vite-plus:<major>.<minor>` | Latest minor |
|
|
29
24
|
| `ghcr.io/voidzero-dev/vite-plus:<major>.<minor>.<patch>` | Exact version |
|
|
30
25
|
|
|
31
|
-
The examples use `:latest` to track the newest release; pin an exact tag or a
|
|
32
|
-
digest if you need reproducible builds. The image is published for `linux/amd64`
|
|
33
|
-
and `linux/arm64` and runs as the non-root `vp` user by default. That user has
|
|
34
|
-
passwordless `sudo`, so build/CI steps that need root (extra apt packages,
|
|
35
|
-
`playwright install --with-deps`) work without changing the image user.
|
|
26
|
+
The examples use `:latest` to track the newest release; pin an exact tag or a digest if you need reproducible builds. The image is published for `linux/amd64` and `linux/arm64` and runs as the non-root `vp` user by default. That user has passwordless `sudo`, so build/CI steps that need root (extra apt packages, `playwright install --with-deps`) work without changing the image user.
|
|
36
27
|
|
|
37
28
|
Browse all published versions and digests on the [GitHub package page](https://github.com/voidzero-dev/vite-plus/pkgs/container/vite-plus).
|
|
38
29
|
|
|
39
30
|
## Production: SSR / Node.js server app
|
|
40
31
|
|
|
41
|
-
For apps that run Node.js in production (SvelteKit, Nuxt, a custom Vite SSR
|
|
42
|
-
server, and so on), build with the toolchain image and copy the resolved Node.js
|
|
43
|
-
and the built app into a slim runtime stage:
|
|
32
|
+
For apps that run Node.js in production (SvelteKit, Nuxt, a custom Vite SSR server, and so on), build with the toolchain image and copy the resolved Node.js and the built app into a slim runtime stage:
|
|
44
33
|
|
|
45
34
|
```dockerfile [Dockerfile]
|
|
46
35
|
# syntax=docker/dockerfile:1
|
|
@@ -86,28 +75,19 @@ EXPOSE 3000
|
|
|
86
75
|
CMD ["node", "dist/server.js"]
|
|
87
76
|
```
|
|
88
77
|
|
|
89
|
-
The deployed image contains only Node.js plus your app and production
|
|
90
|
-
dependencies, and matches `.node-version` exactly. It is much smaller than the
|
|
91
|
-
default `node:*` image; see the distroless tip below for the smallest result.
|
|
78
|
+
The deployed image contains only Node.js plus your app and production dependencies, and matches `.node-version` exactly. It is much smaller than the default `node:*` image; see the distroless tip below for the smallest result.
|
|
92
79
|
|
|
93
80
|
::: warning Prune production dependencies in a separate stage
|
|
94
|
-
Install production dependencies in their own `deps` stage as shown. Running
|
|
95
|
-
`vp install --prod` after a full `vp install` in the same stage does not remove
|
|
96
|
-
the already-installed devDependencies, so the `vite-plus` toolchain would be
|
|
97
|
-
copied into the runtime image. If your server bundle is fully self-contained (no
|
|
98
|
-
un-bundled runtime dependencies), you can skip copying `node_modules` entirely.
|
|
81
|
+
Install production dependencies in their own `deps` stage as shown. Running `vp install --prod` after a full `vp install` in the same stage does not remove the already-installed devDependencies, so the `vite-plus` toolchain would be copied into the runtime image. If your server bundle is fully self-contained (no un-bundled runtime dependencies), you can skip copying `node_modules` entirely.
|
|
99
82
|
:::
|
|
100
83
|
|
|
101
84
|
::: tip Smaller still
|
|
102
|
-
For a shell-less, minimal-CVE runtime, swap the runtime base for distroless
|
|
103
|
-
(`gcr.io/distroless/cc`) and keep an `ENTRYPOINT` in vector form. It is glibc
|
|
104
|
-
based, so the copied Node.js binary remains compatible.
|
|
85
|
+
For a shell-less, minimal-CVE runtime, swap the runtime base for distroless (`gcr.io/distroless/cc`) and keep an `ENTRYPOINT` in vector form. It is glibc based, so the copied Node.js binary remains compatible.
|
|
105
86
|
:::
|
|
106
87
|
|
|
107
88
|
## Production: static SPA / SSG
|
|
108
89
|
|
|
109
|
-
A static site needs no Node.js at runtime; serve the build output with any static
|
|
110
|
-
server:
|
|
90
|
+
A static site needs no Node.js at runtime; serve the build output with any static server:
|
|
111
91
|
|
|
112
92
|
```dockerfile [Dockerfile]
|
|
113
93
|
FROM ghcr.io/voidzero-dev/vite-plus:latest AS build
|
|
@@ -123,8 +103,7 @@ COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
123
103
|
|
|
124
104
|
## Continuous integration
|
|
125
105
|
|
|
126
|
-
Use the image directly in container-based CI (GitLab CI, Buildkite, CircleCI,
|
|
127
|
-
Jenkins, and others):
|
|
106
|
+
Use the image directly in container-based CI (GitLab CI, Buildkite, CircleCI, Jenkins, and others):
|
|
128
107
|
|
|
129
108
|
```yaml [.gitlab-ci.yml]
|
|
130
109
|
build:
|
|
@@ -140,11 +119,7 @@ On GitHub Actions, prefer [`setup-vp`](./ci) instead of the image.
|
|
|
140
119
|
|
|
141
120
|
## Browser mode tests (Vitest / Playwright)
|
|
142
121
|
|
|
143
|
-
Running as the non-root `vp` user is what you want for browsers: Chromium keeps
|
|
144
|
-
its sandbox (running a browser as root disables it). Install the browser and its
|
|
145
|
-
system libraries in the job. `playwright install --with-deps` needs root to
|
|
146
|
-
`apt-get install` those libraries. The `vp` user has passwordless `sudo`, so
|
|
147
|
-
Playwright uses it to install them without changing the image user:
|
|
122
|
+
Running as the non-root `vp` user is what you want for browsers: Chromium keeps its sandbox (running a browser as root disables it). Install the browser and its system libraries in the job. `playwright install --with-deps` needs root to `apt-get install` those libraries. The `vp` user has passwordless `sudo`, so Playwright uses it to install them without changing the image user:
|
|
148
123
|
|
|
149
124
|
```yaml [.gitlab-ci.yml]
|
|
150
125
|
test:
|
|
@@ -155,15 +130,9 @@ test:
|
|
|
155
130
|
- vp test
|
|
156
131
|
```
|
|
157
132
|
|
|
158
|
-
`vp exec` runs the project's own Playwright (from your lockfile), so it installs
|
|
159
|
-
the browser revision your tests expect. Prefer it over `vpx playwright install`,
|
|
160
|
-
which would download whatever Playwright is latest and can fetch a different
|
|
161
|
-
browser revision.
|
|
133
|
+
`vp exec` runs the project's own Playwright (from your lockfile), so it installs the browser revision your tests expect. Prefer it over `vpx playwright install`, which would download whatever Playwright is latest and can fetch a different browser revision.
|
|
162
134
|
|
|
163
|
-
To bake the browser and its libraries into a derived image instead of installing
|
|
164
|
-
them on every run, install the project dependencies first so the baked browser
|
|
165
|
-
matches your lockfile, then install with the project's Playwright (root is
|
|
166
|
-
available through `sudo`):
|
|
135
|
+
To bake the browser and its libraries into a derived image instead of installing them on every run, install the project dependencies first so the baked browser matches your lockfile, then install with the project's Playwright (root is available through `sudo`):
|
|
167
136
|
|
|
168
137
|
```dockerfile [Dockerfile]
|
|
169
138
|
FROM ghcr.io/voidzero-dev/vite-plus:latest
|
|
@@ -173,13 +142,11 @@ RUN vp install --frozen-lockfile
|
|
|
173
142
|
RUN vp exec playwright install --with-deps chromium
|
|
174
143
|
```
|
|
175
144
|
|
|
176
|
-
If Chromium crashes under load in CI, give the container more shared memory with
|
|
177
|
-
`--ipc=host`; see the [Playwright Docker docs](https://playwright.dev/docs/docker).
|
|
145
|
+
If Chromium crashes under load in CI, give the container more shared memory with `--ipc=host`; see the [Playwright Docker docs](https://playwright.dev/docs/docker).
|
|
178
146
|
|
|
179
147
|
## Devcontainers
|
|
180
148
|
|
|
181
|
-
Use the image as a ready-to-go development container with the toolchain
|
|
182
|
-
preinstalled:
|
|
149
|
+
Use the image as a ready-to-go development container with the toolchain preinstalled:
|
|
183
150
|
|
|
184
151
|
```jsonc [.devcontainer/devcontainer.json]
|
|
185
152
|
{
|
|
@@ -197,23 +164,8 @@ docker run --rm -it -v "$PWD:/app" -w /app ghcr.io/voidzero-dev/vite-plus vp bui
|
|
|
197
164
|
|
|
198
165
|
## Notes
|
|
199
166
|
|
|
200
|
-
- **Node.js version**: provisioned from `.node-version`, `engines.node`, or
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
- **Non-root user**: the image runs as the non-root `vp` user, so copy sources
|
|
206
|
-
with `COPY --chown=vp:vp ...` as shown. Without it, `COPY` writes root-owned
|
|
207
|
-
files that `vp install` cannot update (permission denied). The `vp` user has
|
|
208
|
-
passwordless `sudo` for the occasional root step (installing extra apt packages
|
|
209
|
-
or `playwright install --with-deps`), so you rarely need to switch the image
|
|
210
|
-
user. The production runtime stage is a separate, vp-free base image, so this
|
|
211
|
-
convenience does not reach your deployed image.
|
|
212
|
-
- **Native addons**: the image includes a C/C++ build toolchain (`build-essential`,
|
|
213
|
-
`python3`), so native dependencies such as `better-sqlite3` compile during
|
|
214
|
-
`vp install`.
|
|
215
|
-
- **glibc**: the image is glibc based so it uses the official, signature-verified
|
|
216
|
-
Node.js builds.
|
|
217
|
-
- **Custom base image**: to add `vp` to your own base image instead, run the
|
|
218
|
-
installer: `curl -fsSL https://vite.plus | bash` (set `VP_VERSION` to pin a
|
|
219
|
-
version).
|
|
167
|
+
- **Node.js version**: provisioned from `.node-version`, `engines.node`, or `devEngines.runtime` at build time, so there is no Node.js-specific image tag. The dependency `COPY` uses a `.node-version*` glob so the file is optional: projects that pin via `engines.node`/`devEngines.runtime` need no `.node-version`, and those that use one have it available in every stage.
|
|
168
|
+
- **Non-root user**: the image runs as the non-root `vp` user, so copy sources with `COPY --chown=vp:vp ...` as shown. Without it, `COPY` writes root-owned files that `vp install` cannot update (permission denied). The `vp` user has passwordless `sudo` for the occasional root step (installing extra apt packages or `playwright install --with-deps`), so you rarely need to switch the image user. The production runtime stage is a separate, vp-free base image, so this convenience does not reach your deployed image.
|
|
169
|
+
- **Native addons**: the image includes a C/C++ build toolchain (`build-essential`, `python3`), so native dependencies such as `better-sqlite3` compile during `vp install`.
|
|
170
|
+
- **glibc**: the image is glibc based so it uses the official, signature-verified Node.js builds.
|
|
171
|
+
- **Custom base image**: to add `vp` to your own base image instead, run the installer: `curl -fsSL https://vite.plus | bash` (set `VP_VERSION` to pin a version).
|
package/docs/guide/env.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Environment
|
|
2
2
|
|
|
3
|
-
`vp env` manages the complete JavaScript environment: one Node.js runtime and one selected package manager. npm, pnpm, Yarn, and Bun are peer package-manager families.
|
|
3
|
+
`vp env` manages the complete JavaScript environment: one Node.js runtime and one selected package manager. npm, pnpm, Yarn, and Bun are peer package-manager families. It belongs to the [global CLI](/guide/global-cli) and is not included in the project-local `vite-plus` package.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
+
Think of the project environment as two independently selected components:
|
|
8
|
+
|
|
9
|
+
- **Node.js** is the runtime used to execute JavaScript tools and scripts. Each project can declare the Node.js version it needs.
|
|
10
|
+
- **The package manager** installs and manages project dependencies. Each project can select npm, pnpm, Yarn, or Bun and declare its version.
|
|
11
|
+
|
|
12
|
+
For example, a project can use Node.js 24 with pnpm 10. Changing its Node.js version does not change its package-manager selection, and switching from pnpm to Yarn does not change its Node.js version. Vite+ resolves both components when you run a command so that you can move between projects without manually switching tools.
|
|
13
|
+
|
|
14
|
+
Vite+ connects these selections to your shell through **shims**: small launchers named `node`, `npm`, `pnpm`, `yarn`, and `bun`, along with their aliases. In managed mode, a shim resolves and launches the appropriate tool for the current project. Commands such as `vp install` use the project's selected package manager; invoking `pnpm` directly always runs pnpm, even in a project that selects another manager.
|
|
15
|
+
|
|
7
16
|
Managed mode is on by default, so Node.js and configured package-manager shims resolve through Vite+ and pick the right versions for the current project. Fresh installers record managed mode for npm, pnpm, Yarn, and Bun after the user enables environment management.
|
|
8
17
|
|
|
9
|
-
|
|
18
|
+
Use `vp env off` to disable managed mode for Node.js and package managers. See [Environment Modes](#environment-modes) below for details and how to switch to system tools.
|
|
10
19
|
|
|
11
20
|
Most commands operate on both components when no selector is given. Add `node`, `pm`, `npm`, `pnpm`, `yarn`, or `bun` to narrow the command. `pm` means all four families for listing and cleanup, but the single selected package manager for project operations.
|
|
12
21
|
|
|
@@ -19,16 +28,18 @@ vp env pin node@24 pnpm@12 # Both components
|
|
|
19
28
|
vp env pin 22.0.0 pnpm@10.18.0 # Also both components
|
|
20
29
|
```
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
Use `vp env pin` to save a project's versions, `vp env default` to set fallback versions, and `vp env use` to override versions for the current shell. Run `vp env current` to see the resolved environment.
|
|
32
|
+
|
|
33
|
+
## Node.js Selection
|
|
34
|
+
|
|
35
|
+
To select the project's Node.js version, Vite+ checks the current directory first, then walks up through its parents. The nearest directory with a supported declaration wins. Within each directory, sources are checked in this order:
|
|
24
36
|
|
|
25
37
|
1. `.node-version` file
|
|
26
38
|
2. `devEngines.runtime` in `package.json` (the [devEngines standard](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#devengines))
|
|
27
39
|
3. `engines.node` in `package.json`
|
|
28
40
|
4. `.nvmrc` file
|
|
29
41
|
|
|
30
|
-
If no directory declares a version, Vite+ uses the global default (`vp env default`) and then the
|
|
31
|
-
latest LTS.
|
|
42
|
+
If no directory declares a version, Vite+ uses the global default (`vp env default`) and then the latest LTS.
|
|
32
43
|
|
|
33
44
|
`devEngines.runtime` ranks above `engines.node` because it declares the development-environment requirement, while `engines.node` is a consumer-facing support range. `vp env doctor` warns when declared sources conflict.
|
|
34
45
|
|
|
@@ -44,26 +55,51 @@ pnpm config set --global runtimeOnFail ignore
|
|
|
44
55
|
This setting also disables pnpm's automatic management of other declared runtimes, including Bun and Deno. Consider whether any of your projects rely on that behavior before setting it globally.
|
|
45
56
|
:::
|
|
46
57
|
|
|
58
|
+
## Package-Manager Selection
|
|
59
|
+
|
|
47
60
|
Package-manager selection uses this priority:
|
|
48
61
|
|
|
49
62
|
1. Explicit command override
|
|
50
|
-
2. `VP_PACKAGE_MANAGER`
|
|
63
|
+
2. `VP_PACKAGE_MANAGER`
|
|
51
64
|
3. Top-level `packageManager`
|
|
52
65
|
4. `devEngines.packageManager`
|
|
53
66
|
5. Lockfile or manager-specific configuration
|
|
54
67
|
6. The named package manager's global default version
|
|
55
68
|
7. The named shim's latest release
|
|
56
69
|
|
|
57
|
-
|
|
70
|
+
`VP_PACKAGE_MANAGER` selects the manager and version for commands such as `vp install`. Direct package-manager shims ignore this variable and use independent version overrides:
|
|
71
|
+
|
|
72
|
+
| Variable | Shims |
|
|
73
|
+
| ----------------- | ----------------- |
|
|
74
|
+
| `VP_NPM_VERSION` | `npm`, `npx` |
|
|
75
|
+
| `VP_PNPM_VERSION` | `pnpm`, `pnpx` |
|
|
76
|
+
| `VP_YARN_VERSION` | `yarn`, `yarnpkg` |
|
|
77
|
+
| `VP_BUN_VERSION` | `bun`, `bunx` |
|
|
78
|
+
|
|
79
|
+
These variables accept a version or range, such as `10.18.0`, `10`, or `latest`, and override the matching shim's project and default versions. They do not change the manager or version selected by `vp install`.
|
|
80
|
+
|
|
81
|
+
`vp env use pnpm@10.20.0` sets `VP_PNPM_VERSION` for the current shell, just as `vp env use node@22` sets `VP_NODE_VERSION`. Each package manager has its own override, so switching Yarn does not clear a pnpm override. `vp env use` does not set or clear `VP_PACKAGE_MANAGER`.
|
|
58
82
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
83
|
+
Direct shims resolve their version from the matching environment variable, then the matching session file when no shell wrapper is available, then project configuration and the family default. `vp env current pnpm` and `vp env which pnpm` inspect this shim selection; `vp env current pm` reports the manager selected for vp commands.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
VP_PACKAGE_MANAGER=pnpm@10.18.0 vp install
|
|
87
|
+
VP_PNPM_VERSION=10.20.0 pnpm --version
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The overrides apply in managed mode. A package manager can also perform its own version switching after Vite+ launches it; for example, pnpm's `managePackageManagerVersions` setting may switch back to the version in `package.json`.
|
|
91
|
+
|
|
92
|
+
A project selection applies only to its matching shims. For example, pnpm controls `pnpm` and `pnpx`; invoking `npm` still resolves npm independently. Without a matching project selection, a named shim uses its configured default version and otherwise uses the latest release without prompting. The directly invoked npm shim keeps its Node-bundled fallback, while an explicit `vp env ... npm` family scope uses standalone npm's latest release.
|
|
93
|
+
|
|
94
|
+
::: details Latest-version caching
|
|
95
|
+
When a named shim falls back to the latest release, the resolved version is cached for one hour. An expired cache remains available when the registry cannot be reached.
|
|
96
|
+
:::
|
|
97
|
+
|
|
98
|
+
## Environment Modes
|
|
99
|
+
|
|
100
|
+
Managed mode is on by default, so Node.js and configured package-manager shims resolve through Vite+ and pick the right versions for the current project. Fresh installers record managed mode for npm, pnpm, Yarn, and Bun after the user enables environment management.
|
|
65
101
|
|
|
66
|
-
|
|
102
|
+
To enable managed mode, run:
|
|
67
103
|
|
|
68
104
|
```bash
|
|
69
105
|
vp env on
|
|
@@ -102,8 +138,7 @@ PowerShell needs to dot-source the generated setup script in the current shell b
|
|
|
102
138
|
. "$env:APPDATA\vite-plus\env.ps1"
|
|
103
139
|
```
|
|
104
140
|
|
|
105
|
-
If an older Vite+ install uses `%USERPROFILE%\.vite-plus`, source the `env.ps1`
|
|
106
|
-
file in that directory instead.
|
|
141
|
+
If an older Vite+ install uses `%USERPROFILE%\.vite-plus`, source the `env.ps1` file in that directory instead.
|
|
107
142
|
|
|
108
143
|
Add that line to the end of your PowerShell `$PROFILE` to apply it automatically in new shells. It does not require elevated privileges.
|
|
109
144
|
|
|
@@ -129,14 +164,12 @@ vp-use --unset
|
|
|
129
164
|
|
|
130
165
|
Only `vp env use` needs this alternate command. Other `vp env` commands work normally in Command Prompt. `vp env setup` creates `vp-use.cmd` in the bin directory on Windows.
|
|
131
166
|
|
|
132
|
-
In CI, `vp env use` can run without shell initialization. It writes a temporary
|
|
133
|
-
Node.js or package-manager session file in the resolved state directory. Later
|
|
134
|
-
shim calls in the same job use these files to resolve the same environment.
|
|
167
|
+
In CI, `vp env use` can run without shell initialization. It writes a temporary session file per runtime or package manager in the resolved state directory, such as `.session-node-version` or `.session-pnpm-version`. Later shim calls in the same job use these files to resolve the same environment.
|
|
135
168
|
|
|
136
169
|
### Manage
|
|
137
170
|
|
|
138
171
|
- `vp env default` shows the global Node.js default and each configured package-manager version. Bare versions set Node.js; qualified specs such as `pnpm@10.18.0` set that package manager's shim default without replacing the defaults for Bun, Yarn, or npm. `--unset` clears all defaults unless scoped.
|
|
139
|
-
- `vp env pin` shows or writes project pins. Existing `.node-version` and top-level `packageManager` fields keep being updated for compatibility;
|
|
172
|
+
- `vp env pin` shows or writes project pins. Existing `.node-version` and top-level `packageManager` fields keep being updated for compatibility. An existing `.nvmrc` is updated when it is the effective Node source in the current directory; its comments and other non-version content are preserved. Otherwise Vite+ writes the matching `devEngines` entry. Use `--target node-version`, `--target nvmrc`, `--target dev-engines`, or `--target package-manager` to choose explicitly. Pinning in a child directory does not modify an inherited `.nvmrc`.
|
|
140
173
|
- `vp env unpin` removes both effective pins by default; append a selector to remove one. Lower-priority declarations are not deleted.
|
|
141
174
|
- `vp env use` activates the complete project environment. Explicit specs override selected components; `--unset` clears both unless scoped.
|
|
142
175
|
- `vp env install` installs the complete resolved environment, a selected component, or explicit specs.
|
|
@@ -175,7 +208,8 @@ vp env install # Install the complete resolved environment
|
|
|
175
208
|
vp env default node@24 # Set the global Node.js default
|
|
176
209
|
vp env default pnpm@10 # Set pnpm's global default version
|
|
177
210
|
vp env use 20 pnpm@10 # Override both components for this shell
|
|
178
|
-
vp env use --unset
|
|
211
|
+
vp env use --unset pnpm # Remove only the pnpm session version
|
|
212
|
+
vp env use --unset pm # Remove all package-manager session versions
|
|
179
213
|
vp env clean # Remove unused managed Node.js and package manager versions
|
|
180
214
|
|
|
181
215
|
# Inspect
|
package/docs/guide/fmt.md
CHANGED
|
@@ -18,7 +18,9 @@ vp fmt . --write
|
|
|
18
18
|
|
|
19
19
|
## Configuration
|
|
20
20
|
|
|
21
|
-
Put formatting configuration directly in the `fmt` block in `vite.config.ts` so all your configuration stays in one place. We do not recommend using `.oxfmtrc.json` with Vite+.
|
|
21
|
+
Put formatting configuration directly in the `fmt` block in the root `vite.config.ts` so all your configuration stays in one place. We do not recommend using `.oxfmtrc.json` with Vite+.
|
|
22
|
+
|
|
23
|
+
Vite+ does not currently support nested format configuration. For now, use [`fmt.overrides`](/guide/monorepo#format-overrides) in the root `vite.config.ts` for file- or package-specific options. The long-term behavior is open for discussion; [share your use case and expectations](/guide/troubleshooting#nested-lint-or-format-config-is-not-applied) to help shape it.
|
|
22
24
|
|
|
23
25
|
For editors, disable nested formatter configs so format-on-save uses the root Vite+ `fmt` block:
|
|
24
26
|
|