Build & Run Script
When to use this skill
- •Use when bootstrapping the project's
package.jsonscripts or when validating build-time env variables. - •Triggered by requests to add/update
dev,build,preview, or helper scripts.
Instructions
- •First Step: Ensure
package.jsoncontains scripts:
- •
dev:vite - •
build:vite build - •
preview:vite preview --port 4173 - •
lint,test,formathelpers as needed.
- •
Second Step: Add a script
start:ciif CI needs to build and run a static server (e.g.,serve -s dist). - •
Third Step: Validate that required
VITE_variables are documented and, optionally, verified at runtime with a small pre-flight check.
Examples
- •
npm run devto start local dev server;npm run build && npm run previewto test production output locally.
Notes
- •Encourage
cross-envor platform-neutral approaches when setting env vars in scripts.