平安校园
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

commitlint.config.cjs 3.6 KiB

3 달 전
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // @see: https://cz-git.qbenben.com/zh/guide
  2. const fs = require("fs");
  3. const path = require("path");
  4. const scopes = fs
  5. .readdirSync(path.resolve(__dirname, "src"), { withFileTypes: true })
  6. .filter(dirent => dirent.isDirectory())
  7. .map(dirent => dirent.name.replace(/s$/, ""));
  8. /** @type {import('cz-git').UserConfig} */
  9. module.exports = {
  10. ignores: [commit => commit.includes("init")],
  11. extends: ["@commitlint/config-conventional"],
  12. rules: {
  13. // @see: https://commitlint.js.org/#/reference-rules
  14. "body-leading-blank": [2, "always"],
  15. "footer-leading-blank": [1, "always"],
  16. "header-max-length": [2, "always", 108],
  17. "subject-empty": [2, "never"],
  18. "type-empty": [2, "never"],
  19. "subject-case": [0],
  20. "type-enum": [
  21. 2,
  22. "always",
  23. [
  24. "feat",
  25. "fix",
  26. "docs",
  27. "style",
  28. "refactor",
  29. "perf",
  30. "test",
  31. "build",
  32. "ci",
  33. "chore",
  34. "revert",
  35. "wip",
  36. "workflow",
  37. "types",
  38. "release"
  39. ]
  40. ]
  41. },
  42. prompt: {
  43. messages: {
  44. type: "选择你要提交的类型 :",
  45. scope: "选择一个提交范围(可选):",
  46. customScope: "请输入自定义的提交范围 :",
  47. subject: "填写简短精炼的变更描述 :\n",
  48. body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n',
  49. breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n',
  50. footerPrefixsSelect: "选择关联issue前缀(可选):",
  51. customFooterPrefixs: "输入自定义issue前缀 :",
  52. footer: "列举关联issue (可选) 例如: #31, #I3244 :\n",
  53. confirmCommit: "是否提交或修改commit ?"
  54. },
  55. types: [
  56. { value: "feat", name: "特性: 🚀 新增功能", emoji: "🚀" },
  57. { value: "fix", name: "修复: 🧩 修复缺陷", emoji: "🧩" },
  58. { value: "docs", name: "文档: 📚 文档变更", emoji: "📚" },
  59. { value: "style", name: "格式: 🎨 代码格式(不影响功能,例如空格、分号等格式修正)", emoji: "🎨" },
  60. { value: "refactor", name: "重构: ♻️ 代码重构(不包括 bug 修复、功能新增)", emoji: "♻️" },
  61. { value: "perf", name: "性能: ⚡️ 性能优化", emoji: "⚡️" },
  62. { value: "test", name: "测试: ✅ 添加疏漏测试或已有测试改动", emoji: "✅" },
  63. { value: "build", name: "构建: 📦️ 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)", emoji: "📦️" },
  64. { value: "ci", name: "集成: 🎡 修改 CI 配置、脚本", emoji: "🎡" },
  65. { value: "revert", name: "回退: ⏪️ 回滚 commit", emoji: "⏪️" },
  66. { value: "chore", name: "其他: 🔨 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)", emoji: "🔨" },
  67. { value: "wip", name: "开发: 🕔 正在开发中", emoji: "🕔" },
  68. { value: "workflow", name: "工作流: 📋 工作流程改进", emoji: "📋" },
  69. { value: "types", name: "类型: 🔰 类型定义文件修改", emoji: "🔰" }
  70. ],
  71. useEmoji: true,
  72. scopes: [...scopes],
  73. customScopesAlign: "bottom",
  74. emptyScopesAlias: "empty",
  75. customScopesAlias: "custom",
  76. allowBreakingChanges: ["feat", "fix"],
  77. issuePrefixs: [
  78. //如果使用 gitee 作为开发管理,注意邮箱要和gitee中设置一致才行
  79. //@see: https://gitee.com/help/articles/4141#article-header2
  80. { value: "link", name: "link: 链接 ISSUES 进行中" },
  81. { value: "closed", name: "closed: 标记 ISSUES 已完成" }
  82. ]
  83. }
  84. };