Skip to content

Commit 7397022

Browse files
fengmk2claude
andcommitted
docs: add comprehensive README with usage examples
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8dacc7f commit 7397022

1 file changed

Lines changed: 153 additions & 0 deletions

File tree

README.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# setup-vite-plus-action
2+
3+
GitHub Action to set up [Vite+](https://github.com/voidzero-dev/vite-plus) (`@voidzero-dev/global`) with dependency caching support.
4+
5+
## Features
6+
7+
- Install Vite+ globally with version specification
8+
- Support both npm Registry and GitHub Package Registry
9+
- Cache project dependencies with auto-detection of lock files
10+
- Optionally run `vite install` after setup
11+
- Support for all major package managers (npm, pnpm, yarn, bun)
12+
13+
## Requirements
14+
15+
- Node.js >= 22.12.0 (use [actions/setup-node](https://github.com/actions/setup-node) first)
16+
17+
## Usage
18+
19+
### Basic Usage
20+
21+
```yaml
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: '22'
27+
- uses: voidzero-dev/setup-vite-plus-action@v1
28+
```
29+
30+
### With Caching and Install
31+
32+
```yaml
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: actions/setup-node@v4
36+
with:
37+
node-version: '22'
38+
- uses: voidzero-dev/setup-vite-plus-action@v1
39+
with:
40+
cache: true
41+
run-install: true
42+
```
43+
44+
### Specific Version
45+
46+
```yaml
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: actions/setup-node@v4
50+
with:
51+
node-version: '22'
52+
- uses: voidzero-dev/setup-vite-plus-action@v1
53+
with:
54+
version: '1.2.3'
55+
cache: true
56+
```
57+
58+
### GitHub Package Registry
59+
60+
```yaml
61+
steps:
62+
- uses: actions/checkout@v4
63+
- uses: actions/setup-node@v4
64+
with:
65+
node-version: '22'
66+
- uses: voidzero-dev/setup-vite-plus-action@v1
67+
with:
68+
registry: github
69+
github-token: ${{ secrets.GH_PKG_TOKEN }}
70+
```
71+
72+
### Advanced Run Install
73+
74+
```yaml
75+
steps:
76+
- uses: actions/checkout@v4
77+
- uses: actions/setup-node@v4
78+
with:
79+
node-version: '22'
80+
- uses: voidzero-dev/setup-vite-plus-action@v1
81+
with:
82+
cache: true
83+
run-install: |
84+
- cwd: ./packages/app
85+
args: ['--frozen-lockfile']
86+
- cwd: ./packages/lib
87+
```
88+
89+
## Inputs
90+
91+
| Input | Description | Required | Default |
92+
|-------|-------------|----------|---------|
93+
| `version` | Version of @voidzero-dev/global to install | No | `latest` |
94+
| `registry` | Registry to install from: `npm` or `github` | No | `npm` |
95+
| `github-token` | GitHub PAT for GitHub Package Registry | No | - |
96+
| `run-install` | Run `vite install` after setup. Accepts boolean or YAML object with `cwd`/`args` | No | `false` |
97+
| `cache` | Enable caching of project dependencies | No | `false` |
98+
| `cache-dependency-path` | Path to lock file for cache key generation | No | Auto-detected |
99+
100+
## Outputs
101+
102+
| Output | Description |
103+
|--------|-------------|
104+
| `version` | The installed version of @voidzero-dev/global |
105+
| `cache-hit` | Boolean indicating if cache was restored |
106+
107+
## Caching
108+
109+
When `cache: true` is set, the action automatically detects your lock file and caches the appropriate package manager store:
110+
111+
| Lock File | Package Manager | Cache Directory |
112+
|-----------|-----------------|-----------------|
113+
| `pnpm-lock.yaml` | pnpm | pnpm store |
114+
| `package-lock.json` | npm | npm cache |
115+
| `yarn.lock` | yarn | yarn cache |
116+
| `bun.lockb` | bun | bun cache |
117+
118+
The cache key format is: `vite-plus-{OS}-{arch}-{pm}-{lockfile-hash}`
119+
120+
## Example Workflow
121+
122+
```yaml
123+
name: CI
124+
125+
on:
126+
push:
127+
branches: [main]
128+
pull_request:
129+
branches: [main]
130+
131+
jobs:
132+
build:
133+
runs-on: ubuntu-latest
134+
steps:
135+
- uses: actions/checkout@v4
136+
137+
- uses: actions/setup-node@v4
138+
with:
139+
node-version: '22'
140+
141+
- uses: voidzero-dev/setup-vite-plus-action@v1
142+
with:
143+
cache: true
144+
run-install: true
145+
146+
- run: vite build
147+
148+
- run: vite test
149+
```
150+
151+
## License
152+
153+
MIT

0 commit comments

Comments
 (0)