Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
## Description

Brief description of changes

## Type of Change

- [ ] New feature
- [ ] Bug fix
- [ ] Refactoring
- [ ] Documentation
- [ ] Styling

## Changes Made

- Change 1
- Change 2
- ...

## Screenshots (if applicable)

## Checklist

- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] No TypeScript errors
- [ ] Tests added/updated
- [ ] All CI checks pass
- [ ] Tested on different screen sizes
- [ ] Loading states implemented
- [ ] Error handling in place

## Related Issues

Closes #
95 changes: 95 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
NODE_VERSION: 20

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

- name: Check formatting
run: npx prettier --check .

typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run TypeScript compiler
run: npm run type-check

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test -- --run --coverage

build:
name: Build
runs-on: ubuntu-latest
needs: [lint, typecheck, test]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
!.gitignore
!.prettierrc
!.github
!.husky

# dependencies
/node_modules
Expand Down
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,47 @@ npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm run format # Format with Prettier
npm run type-check # Run TypeScript type checking
npm run validate # Run type-check, lint, and tests
npm test # Run tests (watch mode)
npm run test:ui # Run tests with UI
npm run test:coverage # Run tests with coverage
```

## Git Workflow

This project uses automated checks to ensure code quality:

### Pre-commit hooks (via Husky)

- **lint-staged**: Runs ESLint and Prettier on staged files
- **commitlint**: Validates commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)

### Commit message format

```
<type>(<scope>): <subject>

Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
```

Examples:

```bash
git commit -m "feat: add user authentication"
git commit -m "fix(api): handle network timeout errors"
git commit -m "docs: update README with git workflow"
```

### CI Pipeline (GitHub Actions)

On every PR and push to main:

1. **Lint** - ESLint + Prettier check
2. **Type Check** - TypeScript compiler
3. **Test** - Vitest with coverage
4. **Build** - Next.js production build (only if all checks pass)

## Tech Stack

- Next.js 16 (App Router)
Expand Down
26 changes: 26 additions & 0 deletions commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const config = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'feat', // New feature
'fix', // Bug fix
'docs', // Documentation
'style', // Formatting (no code changes)
'refactor', // Code refactoring
'perf', // Performance improvement
'test', // Tests
'build', // Build/dependencies changes
'ci', // CI changes
'chore', // Maintenance tasks
'revert', // Revert commit
],
],
'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']],
'subject-max-length': [2, 'always', 72],
},
};

export default config;
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const eslintConfig = defineConfig([
'out/**',
'build/**',
'next-env.d.ts',
// Test coverage output
'coverage/**',
]),
]);

Expand Down
Loading