Development Workflow
Quick reference for all development commands.
Daily Development
# Start dev server (hot reload)
bun run lint && bun run format | tspin && bun run build | tspin && bun run dev | tspin
# Preview production build locally
bun run preview
Quality Checks
Run these before committing:
# Type checking (Astro + TypeScript)
bun astro check
# Linting (ESLint)
bun run lint
# Format check (Prettier)
bun run format:check
# stop on error
# Auto-format all files
bun run format | tspin
Production Build
# Full build pipeline
bun run build
This runs:
astro check— TypeScript validationastro build— Generate static site indist/pagefind --site dist— Build search indexcp -r dist/pagefind public/— Copy search index to public
Sync Content Collections
# Regenerate TypeScript types for content
bun run sync
Use after modifying src/content.config.ts or adding new content fields.
Command Summary
| Command | Purpose |
|---|---|
bun run dev | Start dev server with hot reload |
bun run build | Full production build |
bun run preview | Preview production build |
bun run sync | Sync content collection types |
bun astro check | TypeScript type checking |
bun run lint | ESLint code linting |
bun run format | Auto-format with Prettier |
bun run format:check | Check formatting without changes |
Git Hooks (Automated Quality Checks)
Git hooks are configured via Lefthook to automatically run quality checks.
Pre-commit (runs on every commit)
bun run format:check— Verify formattingbun run lint— Check for linting errors
Pre-push (runs before pushing)
bun astro check— TypeScript validationbun run build— Full production build
Setup
Hooks are installed automatically when you run bun install (via the prepare script). To manually reinstall:
bunx lefthook install
Bypassing Hooks (use sparingly)
# Skip pre-commit hooks
git commit --no-verify -m "message"
# Skip pre-push hooks
git push --no-verify
Preview Deployment
Deploy a preview build to Sevalla on demand using PR labels.
How it works
- Create a PR — CI runs checks (lint, format, typecheck, build) but no deploy
- Add
previewlabel — triggers deployment to Sevalla preview instance - Push more commits — continues deploying (label persists)
- Remove label — stops future preview deploys
Commands
# Add preview label to current branch's PR
gh pr edit --add-label "preview"
# Add preview label by PR number
gh pr edit 123 --add-label "preview"
# Create PR with preview label
gh pr create --title "Your title" --label "preview"
# Remove preview label
gh pr edit --remove-label "preview"
AI Assistant Prompt
Add the preview label to this PR
Or if no PR exists:
Create a PR with the preview label
Notes
- Build output goes to
dist/directory - Search index is generated by Pagefind during build
- The
public/folder contents are copied as-is todist/