conventional-commits

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Conventional Commits Skill

Conventional Commits 技能

This project enforces conventional commits via
@commitlint/config-conventional
+ Husky v9+.
本项目通过
@commitlint/config-conventional
+ Husky v9+来强制推行规范提交(Conventional Commits)。

Commit Format

提交格式

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

[optional body]

[optional footer]
<type>(<scope>): <subject>

[可选正文]

[可选页脚]

Types

类型

TypeSemver BumpUsage
feat
MinorNew feature
fix
PatchBug fix
feat!
MajorBreaking feature
fix!
MajorBreaking fix
chore
NoneMaintenance, dependencies
docs
NoneDocumentation only
refactor
NoneCode change (no feature/fix)
test
NoneAdding/updating tests
ci
NoneCI/CD changes
perf
NonePerformance improvement
类型Semver 版本变更用途
feat
Minor新增功能
fix
Patch修复Bug
feat!
Major破坏性新增功能
fix!
Major破坏性修复
chore
维护工作、依赖更新
docs
仅文档更新
refactor
代码重构(无新增功能/修复)
test
添加/更新测试
ci
CI/CD 配置变更
perf
性能优化

Scopes (Optional)

范围(可选)

api
,
web
,
database
,
types
,
ui
,
utils
,
infra
,
deps
,
release
api
,
web
,
database
,
types
,
ui
,
utils
,
infra
,
deps
,
release

Subject 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
undefined
bash
undefined

Feature

新增功能

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.
undefined
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.
undefined

Git Hooks

Git 钩子

  • pre-commit (
    .husky/pre-commit
    ): Runs
    gitleaks protect --staged
    then
    pnpm lint-staged
  • commit-msg (
    .husky/commit-msg
    ): Runs
    pnpm commitlint --edit $1
If commitlint rejects, check:
  1. Type is valid (see table above)
  2. Subject length is under 72 characters
  3. Format matches
    type(scope): subject
  4. Scope is from the allowed list (or omitted)
  • pre-commit
    .husky/pre-commit
    ):先运行
    gitleaks protect --staged
    ,再运行
    pnpm lint-staged
  • commit-msg
    .husky/commit-msg
    ):运行
    pnpm commitlint --edit $1
如果commitlint拒绝提交,请检查:
  1. 类型是否有效(见上方表格)
  2. 主题长度是否在72个字符以内
  3. 格式是否匹配
    type(scope): subject
  4. 范围是否在允许列表中(或已省略)

Release Impact

发布影响

semantic-release reads commit types to determine version bumps:
  • feat
    → minor version bump (v4.46.0 → v4.47.0)
  • fix
    → patch version bump (v4.46.0 → v4.46.1)
  • BREAKING CHANGE
    footer or
    !
    suffix → major bump (v4.46.0 → v5.0.0)
  • chore
    ,
    docs
    ,
    refactor
    ,
    test
    → no release
semantic-release会读取提交类型来决定版本变更:
  • feat
    → 小版本更新(v4.46.0 → v4.47.0)
  • fix
    → 补丁版本更新(v4.46.0 → v4.46.1)
  • BREAKING CHANGE
    页脚或
    !
    后缀 → 大版本更新(v4.46.0 → v5.0.0)
  • chore
    ,
    docs
    ,
    refactor
    ,
    test
    → 不触发版本发布

Related

相关内容

  • See
    release-management
    skill for release workflow
  • See
    changelog
    skill for auto-generated changelogs
  • Config:
    .releaserc.json
    (semantic-release),
    @commitlint/config-conventional
  • 查看
    release-management
    技能了解发布工作流
  • 查看
    changelog
    技能了解自动生成的变更日志
  • 配置文件:
    .releaserc.json
    (semantic-release)、
    @commitlint/config-conventional