Uh oh!
There was an error while loading. Please reload this page.
feat: cache vp CLI installation to speed up setup - #8
Conversation
The vp CLI was re-downloaded from viteplus.dev on every CI run (~60s). Now the ~/.vite-plus/ directory is cached using @actions/cache, keyed by OS, arch, and resolved version. On cache hit the install script is skipped entirely, reducing setup to a few seconds. Also updates install URLs from staging.viteplus.dev to viteplus.dev.
There was a problem hiding this comment.
Pull request overview
Adds a dedicated GitHub Actions cache for the Vite+ (vp) installation directory, enabling faster runs by restoring ~/.vite-plus (or Windows equivalent) when possible, and saving it in the post step.
Changes:
- Introduces
cache-vpmodule to resolvelatest, restore the Vite+ home directory from cache, and save it on cache misses. - Integrates Vite+ cache restore into the install flow and saves the Vite+ cache during the post step.
- Adds
getVitePlusHome()utility and new action state keys to support the cache flow.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/utils.ts | Adds getVitePlusHome() helper used by install/cache code. |
src/types.ts | Adds new State enum entries for vp cache keys. |
src/install-viteplus.ts | Restores vp from cache before installing; uses Vite+ home helper for PATH setup. |
src/index.ts | Calls saveVpCache() during the post step. |
src/cache-vp.ts | New module implementing version resolution + cache restore/save for vp home. |
src/cache-vp.test.ts | New tests covering version resolution and vp cache restore/save behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Avoids throwing when HOME/USERPROFILE env vars are unset (e.g. self-hosted runners), keeping cache and PATH setup best-effort.
Previously cached the whole ~/.vite-plus/ directory, which could include
Node.js state from `vp env use` and mutations from later workflow steps.
Now caches only ~/.vite-plus/{version}/ and recreates the current/bin
symlinks after restore. This prevents cross-contamination in multi-Node
matrix builds and avoids baking unrelated state into the cache.There was a problem hiding this comment.
Pull request overview
Adds a dedicated GitHub Actions cache for the Vite+ (vp) binary installation to speed up runs by restoring a versioned ~/.vite-plus/<version> directory and recreating expected symlinks.
Changes:
- Introduce
cache-vpmodule to resolve versions, restore/save the vp binary cache, and rebuildcurrent/binlinks. - Update installer flow to attempt cache restore before downloading/installing, and always attempt to save the vp cache in post.
- Centralize
~/.vite-pluspath computation viagetVitePlusHome()and add newStatekeys for vp cache metadata.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils.ts | Adds getVitePlusHome() helper to standardize vp home directory resolution. |
| src/types.ts | Adds new State entries to persist vp cache key/version across main/post. |
| src/install-viteplus.ts | Attempts version resolution + vp cache restore before fresh install; updates install URLs. |
| src/index.ts | Saves the vp binary cache during the post step (in addition to optional dependency cache). |
| src/cache-vp.ts | Implements vp version resolution, cache restore/save, and symlink recreation. |
| src/cache-vp.test.ts | Adds unit tests covering resolve/restore/save vp cache behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Include the resolved node-version in the cache key so multi-Node matrix builds each get their own cache entry. Revert the version-specific directory + symlink approach in favor of caching the entire ~/.vite-plus/ as a black box — avoids coupling to vp's internal installation layout. Node version is now resolved before installVitePlus() so it can be included in the cache key.
fengmk2
commented
Mar 19, 2026
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:2d17a079b2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR speeds up the GitHub Action’s setup by caching the Vite+ (vp) installation directory (~/.vite-plus) using @actions/cache, so subsequent runs can skip the install script when a matching cache entry is restored.
Changes:
- Add vp-specific cache restore/save logic keyed by OS + arch + resolved vp version + node version.
- Resolve
version: "latest"to an actual semver from the npm registry to avoid stale cache keys when new versions are released. - Update install script URLs from
staging.viteplus.devtoviteplus.devand refactor home-dir handling.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils.ts | Adds getVitePlusHome() helper for consistent ~/.vite-plus path resolution. |
| src/types.ts | Adds new action state keys for vp cache primary/matched keys. |
| src/install-viteplus.ts | Restores vp from cache when available; otherwise installs and ensures vp bin is on PATH. |
| src/index.ts | Reorders setup to resolve node version first (for vp cache key) and saves vp cache in post step. |
| src/cache-vp.ts | Implements vp version resolution + cache restore/save using @actions/cache. |
| src/cache-vp.test.ts | Adds unit tests for version resolution and vp cache restore/save behaviors. |
Comments suppressed due to low confidence (1)
src/index.ts:33
- The step numbering comments are now inconsistent: after introducing the new Node-version resolution step, there are two “Step 3” comments (Node setup and cache restore). Update the numbering (or switch to non-numbered headings) so the execution order remains clear.
// Step 3: Set up Node.js version if specified
if (nodeVersion) {
info(`Setting up Node.js ${nodeVersion} via vp env use...`);
await exec("vp", ["env", "use", nodeVersion]);
}
// Step 3: Restore cache if enabled
if (inputs.cache) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…caching resolveVersion() now uses a semver regex to detect precise versions (e.g. "0.1.8", "1.0.0-beta.1") and passes them through. Any other input (e.g. "latest", "alpha", "canary") is treated as a dist-tag and resolved to a precise version via the npm registry.
There was a problem hiding this comment.
Pull request overview
This PR adds a dedicated cache for the Vite+ (vp) CLI installation to significantly speed up GitHub Action setup by avoiding re-downloading/re-installing the CLI on subsequent runs.
Changes:
- Add
@actions/cache-backed caching of~/.vite-plus/, keyed by OS + arch + resolved Vite+ version (+ Node version). - Resolve dist-tag versions (e.g.
latest,alpha) to a concrete semver via the npm registry for stable cache keying. - Update install script URLs to
viteplus.devand wire cache save into the post step.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils.ts | Add getVitePlusHome() helper for consistent ~/.vite-plus pathing. |
| src/types.ts | Add new post-state keys for vp cache primary/matched keys. |
| src/install-viteplus.ts | Restore from vp cache before running install script; update install URLs. |
| src/index.ts | Resolve Node version earlier for cache keying; save vp cache in post step. |
| src/cache-vp.ts | Implement version resolution + restore/save logic for vp installation cache. |
| src/cache-vp.test.ts | Add unit tests for version resolution and vp cache restore/save behavior. |
| README.md | Document the new Vite+ installation cache behavior and key structure. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
fengmk2
commented
Mar 19, 2026
good enough fengmk2/npmx.dev#2 |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: MK (fengmk2) <fengmk2@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a best-effort GitHub Actions cache for the Vite+ CLI installation to reduce setup time by restoring ~/.vite-plus/ when a matching cache entry exists, and updates install script URLs to the production domain.
Changes:
- Add
src/cache-vp.tsto resolve Vite+ versions (including dist-tags) and restore/save a cache for~/.vite-plus/. - Integrate the Vite+ cache into the main/post action flow, and add a
getVitePlusHome()helper. - Document the new installation cache behavior in the README and add unit tests.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils.ts | Adds getVitePlusHome() to centralize the ~/.vite-plus path logic. |
| src/types.ts | Adds new State keys to support vp cache restore/save across main/post. |
| src/install-viteplus.ts | Attempts cache restore before running install scripts; uses shared home helper. |
| src/index.ts | Reorders steps to resolve Node version early for cache keying; saves vp cache in post. |
| src/cache-vp.ts | Implements version resolution + @actions/cache restore/save for ~/.vite-plus/. |
| src/cache-vp.test.ts | Adds test coverage for version resolution and vp cache restore/save behaviors. |
| README.md | Documents automatic Vite+ installation caching and key format. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export async function restoreVpCache(version: string, nodeVersion: string): Promise<boolean> { | ||
| const vpHome = getVitePlusHome(); | ||
| const runnerOS = process.env.RUNNER_OS || platform(); | ||
| const runnerArch = arch(); | ||
| const primaryKey = `setup-vp-${runnerOS}-${runnerArch}-${version}-node${nodeVersion}`; | ||
| async function runPost(inputs: Inputs): Promise<void> { | ||
| // Save cache if enabled | ||
| const saves: Promise<void>[] = [saveVpCache()]; | ||
| if (inputs.cache) { | ||
| await saveCache(); | ||
| saves.push(saveCache()); | ||
| } | ||
| await Promise.all(saves); |
| import { runViteInstall } from "./run-install.js"; | ||
| import { restoreCache } from "./cache-restore.js"; | ||
| import { saveCache } from "./cache-save.js"; | ||
| import { saveVpCache } from "./cache-vp.js"; | ||
| import { State, Outputs } from "./types.js"; |
| The cache key includes OS, architecture, Vite+ version, and Node.js version: | ||
| `setup-vp-{OS}-{arch}-{vp-version}-node{node-version}` | ||
Summary
~/.vite-plus/directory using@actions/cache, keyed by OS + arch + resolved versionversion: "latest", resolve actual semver from npm registry so the cache key updates when new versions are releasedstaging.viteplus.devtoviteplus.devTest plan
vp run test)vp run check:fix)vp run build)🤖 Generated with Claude Code