1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
| # 安装依赖 pnpm add commitizen cz-customizable -D # package.json 脚本添加 "git": "git add . && git cz", # package.json 脚本添加如下节点 "config": { "commitizen": { "path": "node_modules/cz-customizable" }, "cz-customizable": { "config": ".cz-config.cjs" } } # 根目录新建 .cz-config.cjs
module.exports = { types: [ { value: '✨feat', name: '✨ feat(新功能)' }, { value: ':bug: fix', name: '🐛 fix(Bug 修复)' }, { value: '📝docs', name: '📝 docs(文档更新)' }, { value: '💄style', name: '💄 style(代码样式更改,例如空格、格式、缺少分号等)' }, { value: '💡refactor', name: '💡 refactor(重构代码)' }, { value: '⚡️perf', name: '⚡️ perf(性能优化)' }, { value: '✅test', name: '✅ test(添加缺失或修正测试代码)' }, { value: '🔨chore', name: '🔨 chore(构建相关的代码或工具库,如文档生成等)' }, { value: '⏪️revert', name: '⏪️ revert(回退)' }, { value: '🎉ui', name: '🎉 ui(更新UI)' } ], scopes: [ { name: 'components' }, { name: 'views' }, { name: 'utils' }, { name: 'styles' }, { name: 'store' }, { name: 'router' }, { name: 'hooks' }, { name: 'layout' }, { name: 'mock' }, { name: 'assets' }, { name: 'other' } ], messages: { type: '请选择提交类型:(必填)', scope: '选择一个 scope:(可选)', customScope: '请输入影响范围:(可选)', subject: '请输入简要描述:(必填)', body: '请输入详细描述,使用 "|" 分行:(可选)', breaking: '请列出所有的破坏性变更,例如:描述、理由或迁移方式等:(可选)', footer: '请列出需关闭的 issue,例如:#31, #34:(可选)', confirmCommit: '请确认此提交信息?' }, subjectLimit: 100, allowCustomScopes: true, allowBreakingChanges: [':sparkles: feat', ':bug: fix'] }
|