docs: add comprehensive commit convention guide
This commit is contained in:
parent
f6347f1347
commit
d415a7c114
1 changed files with 89 additions and 0 deletions
89
.github/COMMIT_CONVENTION.md
vendored
Normal file
89
.github/COMMIT_CONVENTION.md
vendored
Normal file
|
|
@ -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
|
||||||
|
|
||||||
|
```
|
||||||
|
<type>[optional scope]: <description>
|
||||||
|
|
||||||
|
[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
|
||||||
Loading…
Add table
Reference in a new issue