conventional-commits
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseConventional Commits Skill
Conventional Commits 技能
This project enforces conventional commits via + Husky v9+.
@commitlint/config-conventional本项目通过 + Husky v9+来强制推行规范提交(Conventional Commits)。
@commitlint/config-conventionalCommit Format
提交格式
<type>(<scope>): <subject>
[optional body]
[optional footer]<type>(<scope>): <subject>
[可选正文]
[可选页脚]Types
类型
| Type | Semver Bump | Usage |
|---|---|---|
| Minor | New feature |
| Patch | Bug fix |
| Major | Breaking feature |
| Major | Breaking fix |
| None | Maintenance, dependencies |
| None | Documentation only |
| None | Code change (no feature/fix) |
| None | Adding/updating tests |
| None | CI/CD changes |
| None | Performance improvement |
| 类型 | Semver 版本变更 | 用途 |
|---|---|---|
| Minor | 新增功能 |
| Patch | 修复Bug |
| Major | 破坏性新增功能 |
| Major | 破坏性修复 |
| 无 | 维护工作、依赖更新 |
| 无 | 仅文档更新 |
| 无 | 代码重构(无新增功能/修复) |
| 无 | 添加/更新测试 |
| 无 | CI/CD 配置变更 |
| 无 | 性能优化 |
Scopes (Optional)
范围(可选)
apiwebdatabasetypesuiutilsinfradepsreleaseapiwebdatabasetypesuiutilsinfradepsreleaseSubject Rules
主题规则
- Imperative mood ("add" not "added" or "adds")
- No period at end
- 50 characters preferred, 72 max
- Lowercase first letter
- 祈使语气(使用“add”而非“added”或“adds”)
- 结尾不加句号
- 建议50个字符以内,最多72个字符
- 首字母小写
Examples
示例
bash
undefinedbash
undefinedFeature
新增功能
feat(web): add COE comparison chart
feat(web): add COE comparison chart
Bug fix
Bug修复
fix(database): handle null month in query
fix(database): handle null month in query
Breaking change
破坏性变更
feat!: migrate HeroUI v2 to v3
BREAKING CHANGE: HeroUI v3 requires motion/react instead of framer-motion
feat!: migrate HeroUI v2 to v3
BREAKING CHANGE: HeroUI v3 requires motion/react instead of framer-motion
Dependencies
依赖更新
chore(deps): upgrade Next.js to v16.1
chore(deps): upgrade Next.js to v16.1
Refactor
代码重构
refactor: simplify car makes page
refactor: simplify car makes page
Multiple changes (use body)
多项变更(使用正文)
feat(web): add Redis sorted sets for makes filtering
Add sorted set caching for makes list to improve
query performance on the car registrations page.
undefinedfeat(web): add Redis sorted sets for makes filtering
Add sorted set caching for makes list to improve
query performance on the car registrations page.
undefinedGit Hooks
Git 钩子
- pre-commit (): Runs
.husky/pre-committhengitleaks protect --stagedpnpm lint-staged - commit-msg (): Runs
.husky/commit-msgpnpm commitlint --edit $1
If commitlint rejects, check:
- Type is valid (see table above)
- Subject length is under 72 characters
- Format matches
type(scope): subject - Scope is from the allowed list (or omitted)
- pre-commit():先运行
.husky/pre-commit,再运行gitleaks protect --stagedpnpm lint-staged - commit-msg():运行
.husky/commit-msgpnpm commitlint --edit $1
如果commitlint拒绝提交,请检查:
- 类型是否有效(见上方表格)
- 主题长度是否在72个字符以内
- 格式是否匹配
type(scope): subject - 范围是否在允许列表中(或已省略)
Release Impact
发布影响
semantic-release reads commit types to determine version bumps:
- → minor version bump (v4.46.0 → v4.47.0)
feat - → patch version bump (v4.46.0 → v4.46.1)
fix - footer or
BREAKING CHANGEsuffix → major bump (v4.46.0 → v5.0.0)! - ,
chore,docs,refactor→ no releasetest
semantic-release会读取提交类型来决定版本变更:
- → 小版本更新(v4.46.0 → v4.47.0)
feat - → 补丁版本更新(v4.46.0 → v4.46.1)
fix - 页脚或
BREAKING CHANGE后缀 → 大版本更新(v4.46.0 → v5.0.0)! - ,
chore,docs,refactor→ 不触发版本发布test
Related
相关内容
- See skill for release workflow
release-management - See skill for auto-generated changelogs
changelog - Config: (semantic-release),
.releaserc.json@commitlint/config-conventional
- 查看技能了解发布工作流
release-management - 查看技能了解自动生成的变更日志
changelog - 配置文件:(semantic-release)、
.releaserc.json@commitlint/config-conventional