vite-plus 0.2.1 → 0.2.2
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/bin/oxfmt +6 -3
- package/bin/oxlint +6 -3
- package/bin/vpr +9 -0
- package/binding/index.cjs +53 -53
- package/binding/index.d.cts +86 -144
- package/dist/agent-D7O7mSeO.js +9456 -0
- package/dist/bin.js +10 -7
- package/dist/{cli-truncate-CWsmbK3p.js → cli-truncate-BVOlIIPy.js} +1 -1
- package/dist/config/bin.js +2 -2
- package/dist/{constants-CrfJQIUX.js → constants-NeTOxrzV.js} +7 -3
- package/dist/create/bin.js +22 -60
- package/dist/{define-config-2tfJoXr1.d.ts → define-config-BuMs_LKa.d.ts} +64 -9
- package/dist/{define-config-DJUehepE.js → define-config-CSgy0zML.js} +43 -18
- package/dist/{define-config-BGSjF6Xp.cjs → define-config-CrA3lZhQ.cjs} +61 -22
- package/dist/define-config.cjs +2 -1
- package/dist/define-config.d.ts +2 -2
- package/dist/define-config.js +2 -2
- package/dist/{dist-Oxo16Y0q.js → dist-CKz3vcoG.js} +4 -4
- package/dist/dist-CtM2JRbM.js +3 -0
- package/dist/editor-CPzssglc.js +584 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-Dn87fvjk.js → json-DiRs8ceZ.js} +13 -1
- package/dist/{log-update-lyIiuflf.js → log-update-DHZRyJ2m.js} +2 -2
- package/dist/migration/bin.d.ts +1 -10
- package/dist/migration/bin.js +531 -170
- package/dist/migration/compat/worker.d.ts +1 -0
- package/dist/migration/compat/worker.js +35 -0
- package/dist/{oxlint-plugin-config-q8a5PFch.js → oxlint-plugin-config-C2Rqc_WQ.js} +1 -1
- package/dist/oxlint-plugin.js +78 -9
- package/dist/pack-bin.js +1 -1
- package/dist/{package-BHirM1_v.js → package-CU2g7URl.js} +52 -3
- package/dist/protocol-D99W10Qi.js +4 -0
- package/dist/{report-BHSkWqRR.js → report-BS7ULx7A.js} +2 -0
- package/dist/{resolve-vite-config-CmdsfQzS.js → resolve-vite-config-r91rIaPs.js} +14 -10
- package/dist/{rolldown-runtime-DnnnRqeS.js → rolldown-runtime-C7HZzL1F.js} +1 -1
- package/dist/staged/bin.js +23 -19
- package/dist/{tsconfig-BWQPmGKz.js → tsconfig-fvpxgUq2.js} +395 -200
- package/dist/version.js +2 -5
- package/dist/versions.js +5 -5
- package/dist/{wrap-ansi-k7Dn4VtV.js → wrap-ansi-DNjkuBEp.js} +1 -1
- package/dist/wrap-ansi-DUi52C6W.js +2 -0
- package/docs/_data/team.ts +9 -0
- package/docs/config/check.md +35 -0
- package/docs/config/index.md +2 -0
- package/docs/config/run.md +61 -12
- package/docs/guide/automatic-data-tracking.md +145 -0
- package/docs/guide/cache.md +14 -35
- package/docs/guide/check.md +16 -0
- package/docs/guide/ci.md +4 -0
- package/docs/guide/docker.md +175 -0
- package/docs/guide/env.md +12 -0
- package/docs/guide/github-actions-cache.md +165 -0
- package/docs/guide/install.md +12 -2
- package/docs/guide/migrate-rules.md +347 -0
- package/docs/guide/migrate.md +14 -0
- package/docs/guide/pack.md +8 -0
- package/docs/guide/run.md +33 -3
- package/docs/guide/troubleshooting.md +1 -1
- package/docs/guide/upgrade.md +43 -21
- package/docs/package.json +1 -1
- package/package.json +20 -19
- package/dist/agent--cKmgD_n.js +0 -3341
- package/dist/compat-Cql3K40m.js +0 -14
- package/dist/dist-DRJUd9bL.js +0 -3
- package/dist/workspace-D0AVy4fu.js +0 -5830
- package/dist/wrap-ansi-CeQuiQ31.js +0 -2
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Docker
|
|
2
|
+
|
|
3
|
+
Vite+ publishes an official Docker image with the `vp` CLI preinstalled:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
ghcr.io/voidzero-dev/vite-plus
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Use it for builds, CI, and devcontainers. It is not intended as a production
|
|
10
|
+
runtime image.
|
|
11
|
+
|
|
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.
|
|
15
|
+
|
|
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.
|
|
19
|
+
|
|
20
|
+
## Image tags
|
|
21
|
+
|
|
22
|
+
Tags track the `vp` version:
|
|
23
|
+
|
|
24
|
+
| Tag | Meaning |
|
|
25
|
+
| -------------------------------------------------------- | -------------- |
|
|
26
|
+
| `ghcr.io/voidzero-dev/vite-plus:latest` | Latest release |
|
|
27
|
+
| `ghcr.io/voidzero-dev/vite-plus:<major>` | Latest major |
|
|
28
|
+
| `ghcr.io/voidzero-dev/vite-plus:<major>.<minor>` | Latest minor |
|
|
29
|
+
| `ghcr.io/voidzero-dev/vite-plus:<major>.<minor>.<patch>` | Exact version |
|
|
30
|
+
|
|
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 a non-root user by default.
|
|
34
|
+
|
|
35
|
+
Browse all published versions and digests on the [GitHub package page](https://github.com/voidzero-dev/vite-plus/pkgs/container/vite-plus).
|
|
36
|
+
|
|
37
|
+
## Production: SSR / Node.js server app
|
|
38
|
+
|
|
39
|
+
For apps that run Node.js in production (SvelteKit, Nuxt, a custom Vite SSR
|
|
40
|
+
server, and so on), build with the toolchain image and copy the resolved Node.js
|
|
41
|
+
and the built app into a slim runtime stage:
|
|
42
|
+
|
|
43
|
+
```dockerfile [Dockerfile]
|
|
44
|
+
# syntax=docker/dockerfile:1
|
|
45
|
+
|
|
46
|
+
# --- build stage: the official Vite+ toolchain image ---
|
|
47
|
+
FROM ghcr.io/voidzero-dev/vite-plus:latest AS build
|
|
48
|
+
WORKDIR /app
|
|
49
|
+
|
|
50
|
+
# Install dependencies first so this layer is cached across source changes.
|
|
51
|
+
COPY --chown=vp:vp package.json pnpm-lock.yaml .node-version* ./
|
|
52
|
+
RUN vp install --frozen-lockfile
|
|
53
|
+
|
|
54
|
+
# Build. vp reads .node-version and provisions that exact Node.js automatically.
|
|
55
|
+
COPY --chown=vp:vp . .
|
|
56
|
+
RUN vp build
|
|
57
|
+
|
|
58
|
+
# Export the exact resolved Node.js binary for the runtime stage.
|
|
59
|
+
RUN cp "$(vp env which node | head -1)" /tmp/node
|
|
60
|
+
|
|
61
|
+
# --- deps stage: production-only dependencies ---
|
|
62
|
+
# A separate, fresh `--prod` install so devDependencies (including the vite-plus
|
|
63
|
+
# toolchain) are excluded. Running `--prod` over the full install above would not
|
|
64
|
+
# prune the already-installed devDependencies.
|
|
65
|
+
FROM ghcr.io/voidzero-dev/vite-plus:latest AS deps
|
|
66
|
+
WORKDIR /app
|
|
67
|
+
COPY --chown=vp:vp package.json pnpm-lock.yaml .node-version* ./
|
|
68
|
+
RUN vp install --frozen-lockfile --prod
|
|
69
|
+
|
|
70
|
+
# --- runtime stage: small, glibc, no vp ---
|
|
71
|
+
FROM debian:bookworm-slim AS runtime
|
|
72
|
+
WORKDIR /app
|
|
73
|
+
ENV NODE_ENV=production
|
|
74
|
+
|
|
75
|
+
# The exact Node.js from .node-version (official, signature-verified build).
|
|
76
|
+
COPY --from=build /tmp/node /usr/local/bin/node
|
|
77
|
+
|
|
78
|
+
COPY --from=build /app/dist ./dist
|
|
79
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
80
|
+
COPY --from=build /app/package.json ./
|
|
81
|
+
|
|
82
|
+
USER nobody
|
|
83
|
+
EXPOSE 3000
|
|
84
|
+
CMD ["node", "dist/server.js"]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The deployed image contains only Node.js plus your app and production
|
|
88
|
+
dependencies, and matches `.node-version` exactly. It is much smaller than the
|
|
89
|
+
default `node:*` image; see the distroless tip below for the smallest result.
|
|
90
|
+
|
|
91
|
+
::: warning Prune production dependencies in a separate stage
|
|
92
|
+
Install production dependencies in their own `deps` stage as shown. Running
|
|
93
|
+
`vp install --prod` after a full `vp install` in the same stage does not remove
|
|
94
|
+
the already-installed devDependencies, so the `vite-plus` toolchain would be
|
|
95
|
+
copied into the runtime image. If your server bundle is fully self-contained (no
|
|
96
|
+
un-bundled runtime dependencies), you can skip copying `node_modules` entirely.
|
|
97
|
+
:::
|
|
98
|
+
|
|
99
|
+
::: tip Smaller still
|
|
100
|
+
For a shell-less, minimal-CVE runtime, swap the runtime base for distroless
|
|
101
|
+
(`gcr.io/distroless/cc`) and keep an `ENTRYPOINT` in vector form. It is glibc
|
|
102
|
+
based, so the copied Node.js binary remains compatible.
|
|
103
|
+
:::
|
|
104
|
+
|
|
105
|
+
## Production: static SPA / SSG
|
|
106
|
+
|
|
107
|
+
A static site needs no Node.js at runtime; serve the build output with any static
|
|
108
|
+
server:
|
|
109
|
+
|
|
110
|
+
```dockerfile [Dockerfile]
|
|
111
|
+
FROM ghcr.io/voidzero-dev/vite-plus:latest AS build
|
|
112
|
+
WORKDIR /app
|
|
113
|
+
COPY --chown=vp:vp package.json pnpm-lock.yaml .node-version* ./
|
|
114
|
+
RUN vp install --frozen-lockfile
|
|
115
|
+
COPY --chown=vp:vp . .
|
|
116
|
+
RUN vp build
|
|
117
|
+
|
|
118
|
+
FROM nginx:alpine AS runtime
|
|
119
|
+
COPY --from=build /app/dist /usr/share/nginx/html
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Continuous integration
|
|
123
|
+
|
|
124
|
+
Use the image directly in container-based CI (GitLab CI, Buildkite, CircleCI,
|
|
125
|
+
Jenkins, and others):
|
|
126
|
+
|
|
127
|
+
```yaml [.gitlab-ci.yml]
|
|
128
|
+
build:
|
|
129
|
+
image: ghcr.io/voidzero-dev/vite-plus:latest
|
|
130
|
+
script:
|
|
131
|
+
- vp install --frozen-lockfile
|
|
132
|
+
- vp check
|
|
133
|
+
- vp test
|
|
134
|
+
- vp build
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
On GitHub Actions, prefer [`setup-vp`](./ci) instead of the image.
|
|
138
|
+
|
|
139
|
+
## Devcontainers
|
|
140
|
+
|
|
141
|
+
Use the image as a ready-to-go development container with the toolchain
|
|
142
|
+
preinstalled:
|
|
143
|
+
|
|
144
|
+
```jsonc [.devcontainer/devcontainer.json]
|
|
145
|
+
{
|
|
146
|
+
"image": "ghcr.io/voidzero-dev/vite-plus:latest",
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Ad-hoc usage
|
|
151
|
+
|
|
152
|
+
Run any `vp` command against a project without installing vp on your machine:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
docker run --rm -it -v "$PWD:/app" -w /app ghcr.io/voidzero-dev/vite-plus vp build
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Notes
|
|
159
|
+
|
|
160
|
+
- **Node.js version**: provisioned from `.node-version`, `engines.node`, or
|
|
161
|
+
`devEngines.runtime` at build time, so there is no Node.js-specific image tag. The
|
|
162
|
+
dependency `COPY` uses a `.node-version*` glob so the file is optional: projects
|
|
163
|
+
that pin via `engines.node`/`devEngines.runtime` need no `.node-version`, and
|
|
164
|
+
those that use one have it available in every stage.
|
|
165
|
+
- **Non-root user**: the image runs as the non-root `vp` user, so copy sources
|
|
166
|
+
with `COPY --chown=vp:vp ...` as shown. Without it, `COPY` writes root-owned
|
|
167
|
+
files that `vp install` cannot update (permission denied).
|
|
168
|
+
- **Native addons**: the image includes a C/C++ build toolchain (`build-essential`,
|
|
169
|
+
`python3`), so native dependencies such as `better-sqlite3` compile during
|
|
170
|
+
`vp install`.
|
|
171
|
+
- **glibc**: the image is glibc based so it uses the official, signature-verified
|
|
172
|
+
Node.js builds.
|
|
173
|
+
- **Custom base image**: to add `vp` to your own base image instead, run the
|
|
174
|
+
installer: `curl -fsSL https://vite.plus | bash` (set `VP_VERSION` to pin a
|
|
175
|
+
version).
|
package/docs/guide/env.md
CHANGED
|
@@ -153,3 +153,15 @@ VP_NODE_DIST_MIRROR=https://my-mirror.example.com/nodejs/dist vp env default lts
|
|
|
153
153
|
# Set it permanently in your shell profile (.bashrc, .zshrc, etc.)
|
|
154
154
|
echo 'export VP_NODE_DIST_MIRROR=https://my-mirror.example.com/nodejs/dist' >> ~/.zshrc
|
|
155
155
|
```
|
|
156
|
+
|
|
157
|
+
## Node.js Signature Verification
|
|
158
|
+
|
|
159
|
+
When installing Node.js from the official `nodejs.org` distribution, Vite+ downloads the PGP-signed `SHASUMS256.txt.asc` and verifies it against the bundled Node.js release keys before trusting any checksum. This protects against a tampered `SHASUMS256.txt` paired with a matching malicious archive. The SHA-256 checksum of the downloaded archive is always verified afterward.
|
|
160
|
+
|
|
161
|
+
Custom mirrors (`VP_NODE_DIST_MIRROR`) that publish only the plain `SHASUMS256.txt` fall back to checksum-only verification. A mirror that does publish a `.asc` still has its signature verified, and an invalid signature is a hard error.
|
|
162
|
+
|
|
163
|
+
If a future keyring or certificate issue blocks downloads, set `VP_NODE_SKIP_SIGNATURE_VERIFY` to temporarily bypass PGP verification. The SHA-256 checksum is still verified, and Vite+ prints a warning when the signature check is skipped:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
VP_NODE_SKIP_SIGNATURE_VERIFY=1 vp env install 22
|
|
167
|
+
```
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# GitHub Actions Cache
|
|
2
|
+
|
|
3
|
+
::: warning Experimental
|
|
4
|
+
Reusing Vite Task's cache across GitHub Actions runs is experimental. Test and measure it in your project before relying on it in CI.
|
|
5
|
+
:::
|
|
6
|
+
|
|
7
|
+
Vite Task stores task results in `node_modules/.vite/task-cache` at the workspace root. Restore that directory in later GitHub Actions runs so Vite Task can reuse previous task results.
|
|
8
|
+
|
|
9
|
+
GitHub Actions cache and Vite Task make separate decisions:
|
|
10
|
+
|
|
11
|
+
1. `actions/cache` restores and saves the cache directory based on the key in your workflow.
|
|
12
|
+
2. Vite Task uses the restored cache directory and replays only the tasks whose fingerprints still match.
|
|
13
|
+
|
|
14
|
+
## Before You Start
|
|
15
|
+
|
|
16
|
+
Use this workflow when all of these are true:
|
|
17
|
+
|
|
18
|
+
- The command runs through [`vp run`](/guide/run).
|
|
19
|
+
- An immediate second run reports a cache hit for the task.
|
|
20
|
+
- The task has stable input and output tracking for CI.
|
|
21
|
+
- The workflow installs dependencies before restoring `node_modules/.vite/task-cache`.
|
|
22
|
+
|
|
23
|
+
If the immediate second run misses, fix the task's tracking config before adding GitHub Actions cache. Check [When To Add Manual Config](/guide/automatic-data-tracking#when-to-add-manual-config) for common causes of unstable caching and fixes.
|
|
24
|
+
|
|
25
|
+
## Measure Before Caching Across Runs
|
|
26
|
+
|
|
27
|
+
You may not need to restore Vite Task cache across GitHub Actions runs when:
|
|
28
|
+
|
|
29
|
+
- The task is already fast enough. Restore and save steps add overhead, so short tasks can finish faster without this workflow.
|
|
30
|
+
- Cache transfer takes longer than rerunning the task. Vite Task can still save time inside one workflow run when the same task runs more than once, but across runs the transfer time is part of the cost.
|
|
31
|
+
|
|
32
|
+
Measure before you add a GitHub Actions cache for Vite Task. Compare workflow duration with and without the restore and save steps. Check both the GitHub cache step time and the `vp run` time.
|
|
33
|
+
|
|
34
|
+
## 1. Define Cacheable CI Tasks
|
|
35
|
+
|
|
36
|
+
Only commands run through `vp run` use Vite Task caching. A direct command such as `vp build` does not use the task cache. Define a task in `vite.config.ts` for each command you want to cache in CI:
|
|
37
|
+
|
|
38
|
+
```ts [vite.config.ts]
|
|
39
|
+
import { defineConfig } from 'vite-plus';
|
|
40
|
+
|
|
41
|
+
export default defineConfig({
|
|
42
|
+
run: {
|
|
43
|
+
tasks: {
|
|
44
|
+
build: 'vp build',
|
|
45
|
+
lint: 'vp lint',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This guide assumes each task already hits locally. If a task misses, fix its tracking config in `vite.config.ts` before adding the GitHub Actions cache steps. See [Automatic Data Tracking](/guide/automatic-data-tracking) and [`run.tasks`](/config/run#tasks).
|
|
52
|
+
|
|
53
|
+
Run each task twice:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
vp run build
|
|
57
|
+
vp run build # should print "cache hit"
|
|
58
|
+
vp run lint
|
|
59
|
+
vp run lint # should print "cache hit"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 2. Restore The Cache After Install
|
|
63
|
+
|
|
64
|
+
Restore `node_modules/.vite/task-cache` after `vp install`, because package installation can recreate or modify `node_modules`.
|
|
65
|
+
|
|
66
|
+
```yaml [.github/workflows/ci.yml]
|
|
67
|
+
name: CI
|
|
68
|
+
|
|
69
|
+
on:
|
|
70
|
+
pull_request:
|
|
71
|
+
push:
|
|
72
|
+
branches: [main]
|
|
73
|
+
|
|
74
|
+
permissions:
|
|
75
|
+
contents: read
|
|
76
|
+
|
|
77
|
+
jobs:
|
|
78
|
+
ci:
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v4
|
|
82
|
+
|
|
83
|
+
- uses: voidzero-dev/setup-vp@v1
|
|
84
|
+
with:
|
|
85
|
+
node-version: '24'
|
|
86
|
+
cache: true
|
|
87
|
+
|
|
88
|
+
- run: vp install
|
|
89
|
+
|
|
90
|
+
- name: Restore Vite Task cache
|
|
91
|
+
id: vite-task-cache
|
|
92
|
+
uses: actions/cache/restore@v6
|
|
93
|
+
with:
|
|
94
|
+
path: node_modules/.vite/task-cache
|
|
95
|
+
key: vite-task-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }}
|
|
96
|
+
restore-keys: |
|
|
97
|
+
vite-task-${{ runner.os }}-${{ runner.arch }}-
|
|
98
|
+
|
|
99
|
+
- run: vp run lint
|
|
100
|
+
- run: vp run build
|
|
101
|
+
|
|
102
|
+
- name: Save Vite Task cache
|
|
103
|
+
if: success()
|
|
104
|
+
uses: actions/cache/save@v6
|
|
105
|
+
with:
|
|
106
|
+
path: node_modules/.vite/task-cache
|
|
107
|
+
key: ${{ steps.vite-task-cache.outputs.cache-primary-key }}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The primary key includes `github.run_id` and `github.run_attempt` so each successful run can save a new immutable cache entry. The restore prefix lets GitHub restore the newest cache for the same operating system and architecture.
|
|
111
|
+
|
|
112
|
+
Leave task inputs, including source files and lockfiles, out of the GitHub Actions key. Vite Task fingerprints them. If they change the Actions key, GitHub can skip useful restores before Vite Task decides which tasks still hit.
|
|
113
|
+
|
|
114
|
+
For monorepos, restore the task cache from the workspace root. Then run the same `vp run` commands you use locally, such as `vp run -t @my/app#build`. Vite Task can reuse results for the requested package and the packages it depends on.
|
|
115
|
+
|
|
116
|
+
## 3. Verify In The Logs
|
|
117
|
+
|
|
118
|
+
On the first run, the restore step should say that no cache was found, and the save step should create one. Pull requests from forks may be restore-only because GitHub can give the cache token read-only access. In that case, the save step warns and exits successfully without writing a cache entry.
|
|
119
|
+
|
|
120
|
+
On a later run, look for both layers:
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
Cache restored from key: vite-task-Linux-X64-...
|
|
124
|
+
$ vp build ◉ cache hit, replaying
|
|
125
|
+
vp run: cache hit, 1.10s saved.
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
If GitHub restores a cache but Vite Task prints a cache miss, the workflow restored the cache directory, but the task fingerprint changed.
|
|
129
|
+
|
|
130
|
+
## Keep Task Tracking Stable
|
|
131
|
+
|
|
132
|
+
If GitHub restores a cache but `vp run` prints a cache miss, fix the task fingerprint before changing the Actions cache key. See [Automatic Data Tracking](/guide/automatic-data-tracking) and [`run.tasks`](/config/run#tasks).
|
|
133
|
+
|
|
134
|
+
## Choose A Cache Key
|
|
135
|
+
|
|
136
|
+
Use a rolling primary key plus a restore prefix:
|
|
137
|
+
|
|
138
|
+
```yaml [.github/workflows/ci.yml]
|
|
139
|
+
key: vite-task-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }}
|
|
140
|
+
restore-keys: |
|
|
141
|
+
vite-task-${{ runner.os }}-${{ runner.arch }}-
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The primary key is unique for each run because it contains `github.run_id` and `github.run_attempt`. GitHub then searches the restore prefix and restores the newest matching cache.
|
|
145
|
+
|
|
146
|
+
Include:
|
|
147
|
+
|
|
148
|
+
- `runner.os` and `runner.arch`, because outputs and native tools can be platform-specific.
|
|
149
|
+
- A per-run value such as `github.run_id` and `github.run_attempt`, because GitHub cache entries are immutable.
|
|
150
|
+
|
|
151
|
+
If a dependency file affects a task result, track it in the task fingerprint rather than the GitHub Actions key.
|
|
152
|
+
|
|
153
|
+
## Manage Cache Eviction And Scope
|
|
154
|
+
|
|
155
|
+
GitHub evicts caches based on its cache retention and repository storage rules. Cache scope is also branch-aware: workflow runs can restore caches from the current branch and the default branch, while pull request merge-ref caches have limited scope.
|
|
156
|
+
|
|
157
|
+
Vite Task can clear the whole task cache, but it does not currently evict individual task entries by age or size. As new task entries and output archives are saved, `node_modules/.vite/task-cache` can keep growing.
|
|
158
|
+
|
|
159
|
+
Manage size at the GitHub Actions cache layer:
|
|
160
|
+
|
|
161
|
+
- Keep the cached `path` limited to the Vite Task cache directory.
|
|
162
|
+
- Keep the restore prefix scoped to compatible runners, such as the same OS and architecture.
|
|
163
|
+
- Delete stale GitHub Actions cache entries, save caches from fewer workflows, or adjust the repository cache limit if large caches cause frequent evictions.
|
|
164
|
+
|
|
165
|
+
See [GitHub's cache reference](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching) for the current eviction and scope rules.
|
package/docs/guide/install.md
CHANGED
|
@@ -67,6 +67,15 @@ Use the `-g` flag for installing, updating or removing globally installed packag
|
|
|
67
67
|
- `vp uninstall -g <pkg>` removes a global package
|
|
68
68
|
- `vp update -g [pkg]` updates one global package or all of them
|
|
69
69
|
- `vp list -g [pkg]` lists global packages
|
|
70
|
+
- `vp outdated -g [pkg]` prints outdated packages
|
|
71
|
+
|
|
72
|
+
::: warning
|
|
73
|
+
These commands do **NOT** interact with the underlying package manager's global installation directory.
|
|
74
|
+
|
|
75
|
+
Instead, Vite+ manages its own global packages under `~/.vite-plus/packages`, allowing them to remain available across different Node.js versions.
|
|
76
|
+
|
|
77
|
+
As a result, commands such as `vp link` do not affect Vite+'s global packages and will not appear in `vp list -g`.
|
|
78
|
+
:::
|
|
70
79
|
|
|
71
80
|
## Managing Dependencies
|
|
72
81
|
|
|
@@ -109,6 +118,7 @@ Use these commands when you want package-manager-managed tools available outside
|
|
|
109
118
|
- `vp uninstall -g typescript`
|
|
110
119
|
- `vp update -g`
|
|
111
120
|
- `vp list -g`
|
|
121
|
+
- `vp outdated -g`
|
|
112
122
|
|
|
113
123
|
#### Add and Remove
|
|
114
124
|
|
|
@@ -167,8 +177,8 @@ Examples:
|
|
|
167
177
|
|
|
168
178
|
```bash
|
|
169
179
|
vp pm config get registry
|
|
170
|
-
vp pm cache clean --force
|
|
171
|
-
vp pm
|
|
180
|
+
vp pm cache clean -- --force
|
|
181
|
+
vp pm audit --json
|
|
172
182
|
```
|
|
173
183
|
|
|
174
184
|
#### Staged publishing
|