GitHub Action to set up Vite+ (vp) with dependency caching support.
- Install Vite+ globally via official install scripts
- Optionally set up a specific Node.js version via
vp env use - Cache project dependencies with auto-detection of lock files
- Optionally run
vp installafter setup - Support for all major package managers (npm, pnpm, yarn)
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
with:
node-version: "22"steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
with:
node-version: "22"
cache: true
run-install: truesteps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
with:
version: "1.2.3"
node-version: "22"
cache: truesteps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
with:
node-version: "22"
cache: true
run-install: |
- cwd: ./packages/app
args: ['--frozen-lockfile']
- cwd: ./packages/libjobs:
test:
strategy:
matrix:
node-version: ["20", "22", "24"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
with:
node-version: ${{ matrix.node-version }}
cache: true
- run: vp run test| Input | Description | Required | Default |
|---|---|---|---|
version |
Version of Vite+ to install | No | latest |
node-version |
Node.js version to install via vp env use |
No | Latest LTS |
run-install |
Run vp install after setup. Accepts boolean or YAML object with cwd/args |
No | true |
cache |
Enable caching of project dependencies | No | false |
cache-dependency-path |
Path to lock file for cache key generation | No | Auto-detected |
| Output | Description |
|---|---|
version |
The installed version of Vite+ |
cache-hit |
Boolean indicating if cache was restored |
When cache: true is set, the action automatically detects your lock file and caches the appropriate package manager store:
| Lock File | Package Manager | Cache Directory |
|---|---|---|
pnpm-lock.yaml |
pnpm | pnpm store |
package-lock.json |
npm | npm cache |
yarn.lock |
yarn | yarn cache |
The cache key format is: vite-plus-{OS}-{arch}-{pm}-{lockfile-hash}
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
with:
node-version: "22"
cache: true
- run: vp run build
- run: vp run test- Linux / macOS:
curl -fsSL https://staging.viteplus.dev/install.sh | bash - Windows:
irm https://staging.viteplus.dev/install.ps1 | iex
git clone https://github.com/voidzero-dev/setup-vp.git
cd setup-vp
vp install| Command | Description |
|---|---|
vp run build |
Build (outputs to dist/) |
vp run test |
Run tests |
vp run test:watch |
Run tests in watch mode |
vp run typecheck |
Type check |
vp run check |
Lint + format check |
vp run check:fix |
Auto-fix lint/format |
- Run
vp run check:fixandvp run build - The
dist/index.mjsmust be committed (it's the compiled action entry point) - Pre-commit hooks (via husky + lint-staged) will automatically run
vp check --fixon staged files viavpx lint-staged
If you have any feedback or issues, please submit an issue or start a discussion.
MIT