Basic Scripts
{
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"lint": "eslint src/",
"deploy": "npm run build && wrangler deploy"
}
}
npm run dev
npm run build
Special Script Names
| Script name | How to run |
|---|---|
start | npm start (no run needed) |
test | npm test (no run needed) |
prebuild | Runs automatically before build |
Common Pitfalls
&&may not work on Windows — usecross-envor separate scriptsnpm startandnpm testdon’t need therunkeyword
To run these scripts automatically in CI, combine with GitHub Actions: Basic Auto-Deploy Setup.
Related Posts
- npm vs yarn: Differences and When to Use Each
- Fix npm Cache Problems
- Manage Node.js Versions with nvm
- How to Deploy an Astro Site to Cloudflare Pages
Recommended Services
- Fiverr - Find freelance developers and tech experts