GitHub Action to set up Vite+ (vite-plus-cli) with dependency caching support for CI/CD workflows
GitHub Action to set up [Vite+](https://viteplus.dev) (`vite-plus-cli`) with dependency caching support. This action installs Vite+ globally and optionally caches project dependencies based on lock file detection.
This skill helps you work on the `setup-vite-plus-action` GitHub Action repository, which provides a reusable action for installing Vite+ and caching dependencies in CI/CD workflows.
You are working with a GitHub Action that has a two-phase execution model:
1. Install `vite-plus-cli` globally via npm
2. Restore dependency cache if enabled
3. Run `vite install` if requested
1. Save dependency cache if enabled
Key modules and their responsibilities:
The action supports auto-detection of package managers based on lock files: `pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`.
When making code changes, follow this workflow:
1. **Make your changes** to the source files in `src/`
2. **Run type checking**: `vite run typecheck`
3. **Run tests**: `vite run test` (or `vite run test:watch` during development)
4. **Run linting**: `vite run lint` (use `vite run lint:fix` to auto-fix)
5. **Run formatting**: `vite run fmt` (use `vite run fmt:check` to check only)
6. **Build the action**: `vite run build` (outputs to `dist/`)
**CRITICAL**: Always run `vite run build` after code changes. The `dist/index.mjs` file must be committed as GitHub Actions execute from the compiled distribution file.
**Important**: Do NOT commit changes automatically. Wait for explicit user request to commit.
When the user requests a commit:
1. Ensure `vite run build` has been executed
2. Verify that `dist/index.mjs` is included in the commit
3. Create a descriptive commit message
The action behavior is defined in `action.yml`. When modifying inputs or outputs:
1. Update `action.yml`
2. Update corresponding Zod schemas in `src/types.ts`
3. Update `src/inputs.ts` for input parsing logic
4. Run full test suite to verify changes
**Adding a new input:**
1. Add to `action.yml` under `inputs:`
2. Add to Zod schema in `src/types.ts`
3. Update `src/inputs.ts` parsing logic
4. Add tests in `src/inputs.test.ts`
5. Build and test
**Modifying cache behavior:**
1. Update `src/cache-restore.ts` or `src/cache-save.ts`
2. Test with different lock file scenarios
3. Update `src/utils.ts` if lock file detection changes
**Changing Vite+ installation:**
1. Modify `src/install-viteplus.ts`
2. Test with different node/npm versions
3. Build and test
User: "Add a new input called 'skip-cache' to bypass dependency caching"
Steps:
1. Read `action.yml` and add the new input
2. Update the Zod schema in `src/types.ts`
3. Modify `src/inputs.ts` to parse the new input
4. Update `src/cache-restore.ts` to check the flag
5. Add tests in `src/inputs.test.ts`
6. Run: `vite run typecheck && vite run test && vite run build`
7. Wait for user to request commit
User: "The action isn't detecting bun.lockb files"
Steps:
1. Read `src/utils.ts` to understand current lock file detection
2. Add bun.lockb to the detection logic
3. Update tests to cover bun scenarios
4. Run: `vite run test && vite run build`
5. Wait for user to request commit
User: "Check if everything passes before I commit"
Steps:
1. Run: `vite run typecheck`
2. Run: `vite run lint`
3. Run: `vite run fmt:check`
4. Run: `vite run test`
5. Run: `vite run build`
6. Report results to user
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/setup-vite-action/raw