144 lines
4.9 KiB
JavaScript
144 lines
4.9 KiB
JavaScript
/**
|
||
* feat:新增功能
|
||
* fix:bug 修复
|
||
* docs:文档更新
|
||
* style:不影响程序逻辑的代码修改(修改空白字符,格式缩进,补全缺失的分号等,没有改变代码逻辑)
|
||
* refactor:重构代码(既没有新增功能,也没有修复 bug)
|
||
* perf:性能, 体验优化
|
||
* test:新增测试用例或是更新现有测试
|
||
* build:主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交
|
||
* ci:主要目的是修改项目继续集成流程(例如 Travis,Jenkins,GitLab CI,Circle等)的提交
|
||
* chore:不属于以上类型的其他类型,比如构建流程, 依赖管理
|
||
* revert:回滚某个更早之前的提交
|
||
*/
|
||
|
||
module.exports = {
|
||
extends: ["@commitlint/config-conventional"],
|
||
rules: {
|
||
// 限制提交类型
|
||
"type-enum": [
|
||
2,
|
||
"always",
|
||
[
|
||
"feat",
|
||
"fix",
|
||
"docs",
|
||
"style",
|
||
"refactor",
|
||
"perf",
|
||
"test",
|
||
"build",
|
||
"ci",
|
||
"chore",
|
||
"revert",
|
||
],
|
||
],
|
||
// scope 可自定义(保留 prompt 的推荐列表,不做白名单限制)
|
||
"scope-enum": [0],
|
||
// subject 不能为空
|
||
"subject-empty": [2, "never"],
|
||
// subject 不能以句号结尾
|
||
"subject-full-stop": [2, "never", "."],
|
||
// subject 不限制大小写
|
||
"subject-case": [0],
|
||
// type 必须小写
|
||
"type-case": [2, "always", "lower-case"],
|
||
// scope 必须小写
|
||
"scope-case": [2, "always", "lower-case"],
|
||
// subject 最小长度
|
||
"subject-min-length": [2, "always", 4],
|
||
// subject 最大长度
|
||
"subject-max-length": [2, "always", 100],
|
||
// header 最大长度(type + scope + subject)
|
||
"header-max-length": [2, "always", 120],
|
||
// body 每行最大长度
|
||
"body-max-line-length": [2, "always", 200],
|
||
// footer 每行最大长度
|
||
"footer-max-line-length": [2, "always", 200],
|
||
},
|
||
prompt: {
|
||
useEmoji: true,
|
||
emojiAlign: "center",
|
||
allowCustomIssuePrefix: true,
|
||
allowEmptyIssuePrefix: true,
|
||
emptyIssuePrefixAlias: "跳过",
|
||
customIssuePrefixAlias: "自定义",
|
||
// 定义 scope 选项
|
||
scopes: [
|
||
{ value: "common", name: "common: @r-utils/common 包" },
|
||
{ value: "vue3", name: "vue3: @r-utils/vue3 包" },
|
||
{ value: "vue2", name: "vue2: @r-utils/vue2 包" },
|
||
{ value: "uni-app", name: "uni-app: @r-utils/uni-app 包" },
|
||
{ value: "deps", name: "deps: 依赖更新" },
|
||
{ value: "release", name: "release: 版本发布" },
|
||
],
|
||
allowCustomScopes: true,
|
||
allowEmptyScopes: true,
|
||
// 破坏性变更默认跳过;如需声明可手动在提交信息中添加 BREAKING CHANGE
|
||
allowBreakingChanges: [],
|
||
messages: {
|
||
type: "选择你要提交的类型:",
|
||
scope: "选择一个提交范围(可选):",
|
||
customScope: "请输入自定义范围:",
|
||
subject: "请简短描述这次改动:\n",
|
||
body: '请详细描述这次改动(可选,用 "|" 换行):\n',
|
||
breaking: '是否有破坏性变更(可选,用 "|" 换行):\n',
|
||
footerPrefixesSelect: "选择关联的 ISSUE 类型(可选):",
|
||
customFooterPrefix: "输入 ISSUE 前缀:",
|
||
footer: "列出关联的 ISSUE,如: #31, #34:\n",
|
||
generatingByAI: "正在通过 AI 生成提交信息...",
|
||
generatedSelectByAI: "选择一个 AI 生成的 subject:",
|
||
confirmCommit: "是否确认提交以上信息?",
|
||
},
|
||
// subject 最小长度提示(中文化 "[x more chars needed]")
|
||
minSubjectLength: 4,
|
||
defaultSubject: "",
|
||
types: [
|
||
{ value: "feat", name: "feat: 新增功能", emoji: ":sparkles:" },
|
||
{ value: "fix", name: "fix: 修复缺陷", emoji: ":bug:" },
|
||
{ value: "docs", name: "docs: 文档变更", emoji: ":memo:" },
|
||
{
|
||
value: "style",
|
||
name: "style: 代码格式(不影响逻辑)",
|
||
emoji: ":lipstick:",
|
||
},
|
||
{
|
||
value: "refactor",
|
||
name: "refactor: 重构(既非新功能,也不是修 bug)",
|
||
emoji: ":recycle:",
|
||
},
|
||
{ value: "perf", name: "perf: 性能优化", emoji: ":zap:" },
|
||
{
|
||
value: "test",
|
||
name: "test: 添加或修改测试",
|
||
emoji: ":white_check_mark:",
|
||
},
|
||
{
|
||
value: "build",
|
||
name: "build: 构建系统或外部依赖变更",
|
||
emoji: ":package:",
|
||
},
|
||
{
|
||
value: "ci",
|
||
name: "ci: CI 配置文件和脚本变更",
|
||
emoji: ":ferris_wheel:",
|
||
},
|
||
{
|
||
value: "chore",
|
||
name: "chore: 其它不修改 src 或测试的改动",
|
||
emoji: ":hammer:",
|
||
},
|
||
{
|
||
value: "revert",
|
||
name: "revert: 回退之前的 commit",
|
||
emoji: ":rewind:",
|
||
},
|
||
],
|
||
// issue 前缀也可以用中文说明
|
||
issuePrefixs: [
|
||
{ value: "link", name: "link: 关联 ISSUE" },
|
||
{ value: "close", name: "close: 关闭 ISSUE" },
|
||
],
|
||
},
|
||
};
|