Skip to content

Commit ac9b169

Browse files
committed
refactor: switch to bash/PowerShell install scripts and rename CLI from vite to vp
- Replace npm install with official install scripts from staging.viteplus.dev - Rename all CLI references from `vite` to `vp` - Add `node-version` input for `vp env use` support - Remove `actions/setup-node` from CI workflow (vp manages its own Node.js) - Rename PACKAGE_NAME constant to DISPLAY_NAME - Update README, CLAUDE.md, action.yml, and package.json
1 parent 5bd070e commit ac9b169

12 files changed

Lines changed: 130 additions & 130 deletions

File tree

.github/workflows/test.yml

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
1818

19-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
20-
with:
21-
node-version: '22'
22-
2319
- name: Setup Vite+
2420
uses: ./
2521
with:
@@ -28,17 +24,13 @@ jobs:
2824
cache: false
2925

3026
- name: Verify installation
31-
run: vite --version
27+
run: vp --version
3228

3329
test-cache-pnpm:
3430
runs-on: ubuntu-latest
3531
steps:
3632
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
3733

38-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
39-
with:
40-
node-version: '22'
41-
4234
- name: Create test project with pnpm-lock.yaml
4335
run: |
4436
mkdir -p test-project
@@ -56,7 +48,7 @@ jobs:
5648

5749
- name: Verify installation
5850
run: |
59-
vite --version
51+
vp --version
6052
echo "Installed version: ${{ steps.setup.outputs.version }}"
6153
echo "Cache hit: ${{ steps.setup.outputs.cache-hit }}"
6254
@@ -65,10 +57,6 @@ jobs:
6557
steps:
6658
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
6759

68-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
69-
with:
70-
node-version: '22'
71-
7260
- name: Create test project with package-lock.json
7361
run: |
7462
mkdir -p test-project
@@ -86,7 +74,7 @@ jobs:
8674

8775
- name: Verify installation
8876
run: |
89-
vite --version
77+
vp --version
9078
echo "Installed version: ${{ steps.setup.outputs.version }}"
9179
echo "Cache hit: ${{ steps.setup.outputs.cache-hit }}"
9280
@@ -95,10 +83,6 @@ jobs:
9583
steps:
9684
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
9785

98-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
99-
with:
100-
node-version: '22'
101-
10286
- name: Create test project with yarn.lock
10387
run: |
10488
mkdir -p test-project
@@ -116,7 +100,7 @@ jobs:
116100

117101
- name: Verify installation
118102
run: |
119-
vite --version
103+
vp --version
120104
echo "Installed version: ${{ steps.setup.outputs.version }}"
121105
echo "Cache hit: ${{ steps.setup.outputs.cache-hit }}"
122106
@@ -125,31 +109,27 @@ jobs:
125109
steps:
126110
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
127111

128-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
129-
with:
130-
node-version: '22'
131-
132112
- name: Setup Vite+ with cache
133113
uses: ./
134114
id: setup
135115
with:
136116
cache: true
137117

138118
- name: Type check
139-
run: vite run typecheck
119+
run: vp run typecheck
140120

141121
- name: Format check
142-
run: vite run fmt:check
122+
run: vp run fmt:check
143123

144124
- name: Lint check
145-
run: vite run lint
125+
run: vp run lint
146126

147127
- name: Unit tests
148-
run: vite run test
128+
run: vp run test
149129

150130
- name: Build
151-
run: vite run build
131+
run: vp run build
152132

153133
- name: Verify dist is up to date
154134
run: |
155-
git diff --exit-code dist/ || (echo "dist/ is out of date. Run 'vite run build' and commit." && exit 1)
135+
git diff --exit-code dist/ || (echo "dist/ is out of date. Run 'vp run build' and commit." && exit 1)

CLAUDE.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,53 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
88

99
## Project Overview
1010

11-
GitHub Action to set up [Vite+](https://github.com/voidzero-dev/vite-plus) (`vite-plus-cli`) with dependency caching support. This action installs Vite+ globally and optionally caches project dependencies based on lock file detection.
11+
GitHub Action to set up [Vite+](https://github.com/voidzero-dev/vite-plus) (`vp`) with dependency caching support. This action installs Vite+ globally via official install scripts and optionally caches project dependencies based on lock file detection.
1212

1313
## Commands
1414

1515
```bash
1616
# Build (required before committing - outputs to dist/)
17-
vite run build
17+
vp run build
1818

1919
# Type check
20-
vite run typecheck
20+
vp run typecheck
2121

2222
# Run tests
23-
vite run test
23+
vp run test
2424

2525
# Run tests in watch mode
26-
vite run test:watch
26+
vp run test:watch
2727

2828
# Lint
29-
vite run lint
30-
vite run lint:fix
29+
vp run lint
30+
vp run lint:fix
3131

3232
# Format
33-
vite run fmt
34-
vite run fmt:check
33+
vp run fmt
34+
vp run fmt:check
3535
```
3636

37-
**Important:** Always run `vite run build` after code changes - the `dist/index.mjs` must be committed.
37+
**Important:** Always run `vp run build` after code changes - the `dist/index.mjs` must be committed.
3838

3939
## Architecture
4040

4141
This is a GitHub Action with main and post execution phases (defined in `action.yml`):
4242

4343
- **Main phase** (`src/index.ts``runMain`):
44-
1. Install `vite-plus-cli` globally via npm
45-
2. Restore dependency cache if enabled
46-
3. Run `vite install` if requested
44+
1. Install Vite+ globally via bash/PowerShell install scripts
45+
2. Set up Node.js version via `vp env use` if specified
46+
3. Restore dependency cache if enabled
47+
4. Run `vp install` if requested
4748

4849
- **Post phase** (`src/index.ts``runPost`):
4950
1. Save dependency cache if enabled
5051

5152
### Key Modules
5253

5354
- `src/inputs.ts` - Parse and validate action inputs using Zod schemas
54-
- `src/install-viteplus.ts` - Install vite-plus globally via npm
55+
- `src/install-viteplus.ts` - Install Vite+ globally via official install scripts
5556
- `src/cache-restore.ts` / `src/cache-save.ts` - Dependency caching via `@actions/cache`
56-
- `src/run-install.ts` - Execute `vite install` with optional cwd/args
57+
- `src/run-install.ts` - Execute `vp install` with optional cwd/args
5758
- `src/types.ts` - Shared types, enums, and Zod schemas
5859
- `src/utils.ts` - Lock file detection, package manager cache path resolution
5960

@@ -63,4 +64,4 @@ Auto-detects package manager from lock files: `pnpm-lock.yaml`, `package-lock.js
6364

6465
## Testing
6566

66-
Tests are colocated with source files (e.g., `src/inputs.test.ts`). Run with `npm run test`.
67+
Tests are colocated with source files (e.g., `src/inputs.test.ts`). Run with `vp run test`.

README.md

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
11
# setup-vite-plus-action
22

3-
GitHub Action to set up [Vite+](https://github.com/voidzero-dev/vite-plus) (`vite-plus-cli`) with dependency caching support.
3+
GitHub Action to set up [Vite+](https://github.com/voidzero-dev/vite-plus) (`vp`) with dependency caching support.
44

55
## Features
66

7-
- Install Vite+ globally with version specification
7+
- Install Vite+ globally via official install scripts
8+
- Optionally set up a specific Node.js version via `vp env use`
89
- Cache project dependencies with auto-detection of lock files
9-
- Optionally run `vite install` after setup
10+
- Optionally run `vp install` after setup
1011
- Support for all major package managers (npm, pnpm, yarn)
1112

12-
## Requirements
13-
14-
- Node.js >= 22.12.0 (use [actions/setup-node](https://github.com/actions/setup-node) first)
15-
1613
## Usage
1714

1815
### Basic Usage
1916

2017
```yaml
2118
steps:
2219
- uses: actions/checkout@v6
23-
- uses: actions/setup-node@v6
24-
with:
25-
node-version: '22'
2620
- uses: voidzero-dev/setup-vite-plus-action@v1
2721
```
2822
29-
### With Caching and Install
23+
### With Node.js Version
3024
3125
```yaml
3226
steps:
3327
- uses: actions/checkout@v6
34-
- uses: actions/setup-node@v6
28+
- uses: voidzero-dev/setup-vite-plus-action@v1
3529
with:
3630
node-version: '22'
31+
```
32+
33+
### With Caching and Install
34+
35+
```yaml
36+
steps:
37+
- uses: actions/checkout@v6
3738
- uses: voidzero-dev/setup-vite-plus-action@v1
3839
with:
40+
node-version: '22'
3941
cache: true
4042
run-install: true
4143
```
@@ -45,12 +47,10 @@ steps:
4547
```yaml
4648
steps:
4749
- uses: actions/checkout@v6
48-
- uses: actions/setup-node@v6
49-
with:
50-
node-version: '22'
5150
- uses: voidzero-dev/setup-vite-plus-action@v1
5251
with:
5352
version: '1.2.3'
53+
node-version: '22'
5454
cache: true
5555
```
5656
@@ -59,32 +59,49 @@ steps:
5959
```yaml
6060
steps:
6161
- uses: actions/checkout@v6
62-
- uses: actions/setup-node@v6
63-
with:
64-
node-version: '22'
6562
- uses: voidzero-dev/setup-vite-plus-action@v1
6663
with:
64+
node-version: '22'
6765
cache: true
6866
run-install: |
6967
- cwd: ./packages/app
7068
args: ['--frozen-lockfile']
7169
- cwd: ./packages/lib
7270
```
7371
72+
### Matrix Testing with Multiple Node.js Versions
73+
74+
```yaml
75+
jobs:
76+
test:
77+
strategy:
78+
matrix:
79+
node-version: ['20', '22', '24']
80+
runs-on: ubuntu-latest
81+
steps:
82+
- uses: actions/checkout@v6
83+
- uses: voidzero-dev/setup-vite-plus-action@v1
84+
with:
85+
node-version: ${{ matrix.node-version }}
86+
cache: true
87+
- run: vp run test
88+
```
89+
7490
## Inputs
7591
7692
| Input | Description | Required | Default |
7793
|-------|-------------|----------|---------|
78-
| `version` | Version of vite-plus-cli to install | No | `latest` |
79-
| `run-install` | Run `vite install` after setup. Accepts boolean or YAML object with `cwd`/`args` | No | `true` |
94+
| `version` | Version of Vite+ to install | No | `latest` |
95+
| `node-version` | Node.js version to install via `vp env use` | No | Vite+ default |
96+
| `run-install` | Run `vp install` after setup. Accepts boolean or YAML object with `cwd`/`args` | No | `true` |
8097
| `cache` | Enable caching of project dependencies | No | `false` |
8198
| `cache-dependency-path` | Path to lock file for cache key generation | No | Auto-detected |
8299

83100
## Outputs
84101

85102
| Output | Description |
86103
|--------|-------------|
87-
| `version` | The installed version of vite-plus-cli |
104+
| `version` | The installed version of Vite+ |
88105
| `cache-hit` | Boolean indicating if cache was restored |
89106

90107
## Caching
@@ -116,17 +133,14 @@ jobs:
116133
steps:
117134
- uses: actions/checkout@v6
118135
119-
- uses: actions/setup-node@v6
120-
with:
121-
node-version: '22'
122-
123136
- uses: voidzero-dev/setup-vite-plus-action@v1
124137
with:
138+
node-version: '22'
125139
cache: true
126140
127-
- run: vite run build
141+
- run: vp run build
128142
129-
- run: vite run test
143+
- run: vp run test
130144
```
131145

132146
## Feedback

action.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
name: 'Setup Vite+'
2-
description: 'Install Vite+ (vite-plus-cli) and optionally cache project dependencies'
2+
description: 'Install Vite+ (vp) and optionally cache project dependencies'
33
author: 'voidzero-dev'
44
branding:
55
icon: zap
66
color: purple
77

88
inputs:
99
version:
10-
description: 'Version of vite-plus-cli to install'
10+
description: 'Version of Vite+ to install'
1111
required: false
1212
default: 'latest'
1313
run-install:
14-
description: 'Run `vite install` after setup. Accepts boolean or YAML object with cwd/args.'
14+
description: 'Run `vp install` after setup. Accepts boolean or YAML object with cwd/args.'
1515
required: false
1616
default: 'true'
17+
node-version:
18+
description: 'Node.js version to install via `vp env use`. If not specified, uses the default version bundled with Vite+.'
19+
required: false
1720
cache:
1821
description: 'Enable caching of project dependencies'
1922
required: false
@@ -24,7 +27,7 @@ inputs:
2427

2528
outputs:
2629
version:
27-
description: 'The installed version of vite-plus-cli'
30+
description: 'The installed version of Vite+'
2831
cache-hit:
2932
description: 'Boolean indicating if cache was restored'
3033

dist/index.mjs

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
"type": "module",
66
"packageManager": "pnpm@10.28.0",
77
"scripts": {
8-
"lint": "vite lint --type-aware --type-check",
9-
"lint:fix": "vite run lint --fix",
10-
"build": "vite lib",
8+
"lint": "vp lint --type-aware --type-check",
9+
"lint:fix": "vp run lint --fix",
10+
"build": "vp lib",
1111
"typecheck": "tsc --noEmit",
12-
"test": "vite test run",
13-
"test:watch": "vite test -w",
14-
"fmt": "vite fmt",
15-
"fmt:check": "vite fmt --check"
12+
"test": "vp test run",
13+
"test:watch": "vp test -w",
14+
"fmt": "vp fmt",
15+
"fmt:check": "vp fmt --check"
1616
},
1717
"dependencies": {
1818
"@actions/cache": "^4.0.0",

0 commit comments

Comments
 (0)