Vue3 -- 项目配置之commitlint【企业级项目配置保姆级教程5】
引言:
对于我们的commit信息,也是有统一规范的,要让每个人都按照统一的标准来执行,我们可以利用commitlint来实现。
配置commitlint:
安装包:
pnpm add @commitlint/config-conventional @commitlint/cli -D
创建commitlint.config.cjs文件:
在根目录下创建commitlint.config.cjs文件并配置:
// @see: https://cz-git.qbenben.com/zh/guide
let fs = require("fs");
let path = require("path");
const scopes = fs
.readdirSync(path.resolve(__dirname, "src"), {
withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name.replace(/s$/, ""));
/** @type {import('cz-git').UserConfig} */
module.exports = {
ignores: [commit => commit.includes("init")],
extends: ["@commitlint/config-conventional"],
rules: {
// @see: https://commitlint.js.org/#/reference-rules
"body-leading-blank": [2, "always"],
"footer-leading-blank": [1