74 lines
2.1 KiB
Plaintext
74 lines
2.1 KiB
Plaintext
---
|
|
alwaysApply: true
|
|
---
|
|
|
|
# Development Workflow
|
|
|
|
## Git Workflow
|
|
|
|
- **Default Branch**: `main` is protected
|
|
- **Workflow**: feature branches → PR → required checks → squash merge
|
|
- **Commit Format**: Conventional Commits
|
|
- `feat: add contact form schema`
|
|
- `fix: correct Image remote pattern`
|
|
- `chore: bump dependencies`
|
|
|
|
## Required Checks
|
|
|
|
Before any merge:
|
|
- `npm run lint` - ESLint validation
|
|
- `npm run type-check` - TypeScript validation
|
|
- `npm run build` - Production build (optional locally, required in CI)
|
|
|
|
## Development Commands
|
|
|
|
```bash
|
|
# Setup
|
|
npm ci # Install dependencies
|
|
|
|
# Development
|
|
npm run dev # Dev server with Turbopack
|
|
npm run type-check # TypeScript validation
|
|
npm run lint # ESLint validation
|
|
|
|
# Build & Deploy
|
|
npm run build # Production build
|
|
npm run start # Preview production build
|
|
npx open-next@latest build # OpenNext build
|
|
npx wrangler deploy .open-next/worker # Deploy to Cloudflare
|
|
```
|
|
|
|
## Code Quality
|
|
|
|
### TypeScript
|
|
- Use strict mode (enabled in [tsconfig.json](mdc:tsconfig.json))
|
|
- Prefer type inference over explicit types
|
|
- Use absolute imports with `@` alias
|
|
|
|
### ESLint
|
|
- Follow Next.js ESLint config
|
|
- Fix all linting errors before committing
|
|
- Don't bypass checks in production builds
|
|
|
|
## Testing Strategy
|
|
|
|
- **Unit Tests**: Place close to sources, name with `.test.ts` or `.test.tsx`
|
|
- **E2E Tests**: Optional Playwright setup
|
|
- **Manual Testing**: Test all user flows before deployment
|
|
|
|
## Pull Request Guidelines
|
|
|
|
- Keep PRs small and reviewable
|
|
- Include screenshots for UI changes
|
|
- Update [AGENTS.md](mdc:AGENTS.md) if conventions change
|
|
- Justify new dependencies in PR description
|
|
- Never commit secrets or sensitive data
|
|
|
|
## Common Pitfalls to Avoid
|
|
|
|
1. Adding remote image domains without updating [next.config.ts](mdc:next.config.ts)
|
|
2. Introducing client components unnecessarily
|
|
3. Duplicating navigation in nested layouts
|
|
4. Bypassing Tailwind utilities for custom CSS
|
|
5. Forgetting to update middleware whitelist for new static assets
|
|
6. Committing secrets instead of using environment variables |