From d415a7c114683221768ce9601a08279751bf70e1 Mon Sep 17 00:00:00 2001 From: rizary Date: Sun, 22 Jun 2025 00:57:14 +0700 Subject: [PATCH] docs: add comprehensive commit convention guide --- .github/COMMIT_CONVENTION.md | 89 ++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .github/COMMIT_CONVENTION.md diff --git a/.github/COMMIT_CONVENTION.md b/.github/COMMIT_CONVENTION.md new file mode 100644 index 0000000..5e2368e --- /dev/null +++ b/.github/COMMIT_CONVENTION.md @@ -0,0 +1,89 @@ +# Commit Convention Guide + +This project uses [Conventional Commits](https://www.conventionalcommits.org/) with [changelogen](https://github.com/unjs/changelogen) for automatic changelog generation. + +## Commit Message Format + +``` +[optional scope]: + +[optional body] + +[optional footer(s)] +``` + +## Types + +| Type | Emoji | Description | Version Bump | +|------|-------|-------------|--------------| +| `feat` | ๐Ÿš€ | New features | minor | +| `fix` | ๐Ÿ› | Bug fixes | patch | +| `docs` | ๐Ÿ“– | Documentation changes | patch | +| `style` | ๐Ÿ’„ | Code style changes | patch | +| `refactor` | โ™ป๏ธ | Code refactoring | patch | +| `perf` | โšก | Performance improvements | patch | +| `test` | โœ… | Adding tests | patch | +| `build` | ๐Ÿ—๏ธ | Build system changes | patch | +| `ci` | ๐Ÿค– | CI/CD changes | patch | +| `chore` | ๐Ÿงน | Maintenance tasks | patch | +| `revert` | โช | Reverting changes | patch | + +## Examples + +### Feature +```bash +git commit -m "feat: add user authentication system" +``` + +### Bug Fix +```bash +git commit -m "fix: resolve login validation error" +``` + +### Breaking Change +```bash +git commit -m "feat: redesign API structure + +BREAKING CHANGE: API endpoints have changed from /api/v1 to /api/v2" +``` + +### With Scope +```bash +git commit -m "feat(theme): add dark mode support" +``` + +## Changelog Scripts + +### Generate Changelog +```bash +pnpm run changelog +``` + +### Release with Changelog +```bash +pnpm run changelog:release +``` + +### Full Release Workflow +```bash +pnpm run release +``` + +## Best Practices + +1. **Use present tense**: "add feature" not "added feature" +2. **Use imperative mood**: "fix bug" not "fixes bug" +3. **Keep first line under 72 characters** +4. **Reference issues**: "fix: resolve login issue (#123)" +5. **Include breaking changes**: Always document breaking changes in footer +6. **Be descriptive**: Explain what and why, not how + +## Scopes (Optional) + +Common scopes for this project: +- `theme` - Theme system changes +- `eslint` - ESLint configuration +- `ui` - User interface components +- `auth` - Authentication system +- `electron` - Electron-specific changes +- `build` - Build system changes \ No newline at end of file