我这里在项目根目录下创建了新的配置文件commitlint.config.cjs module.exports={extends:['@commitlint/config-conventional']}; 这里面我写的很简单,意思其实我这里定义的Commit Message就是继承了@commitlint/config-conventional 规则集,这个规则集定义了Git 提交信息定义一致性格式,使得提交信息更易于理解和自动化处理。
@commitlint/config-conventional 是基于conventional commits规范的配置文件。 @commitlint/cli 是 commitlint 工具的核心。 配置 具体的规范配置可以查看:https://github.com/conventional-changelog/commitlint我这里在项目根目录下创建了新的配置文件commitlint.config.cjs module.exports={extends:['@commitlint/config-conve...
前端项目规范5:Git提交信息规范的要点如下:commitlint的作用:功能:commitlint是一个工具,用于在提交代码前检查Commit Message是否符合预设的规范。使用方式:可以与husky结合,通过precommit钩子,在尝试提交代码前进行检查。主要应用阶段:commitlint主要应用在commitmsg阶段,确保提交信息的格式统一。配置:在项...
// .commitlintrc.jsconst{execSync}=require('child_process');// @tip: git branch name = feature/33 => auto get defaultIssues = #33constissue=execSync('git rev-parse --abbrev-ref HEAD').toString().trim().split("_")[1]// @tip: monorepo dynamic get name/** @type {import('cz-git...
commitlint: 代码校验工具 husky: githook 插件 lint-staged: 前端文件过滤工具,只检测暂存区代码 cz-customizable: 自定义提交配置 安装步骤 1. 环境准备 git 版本,笔者使用git for win 2.27.0相关钩子无发现问题,也建议>= 2.27.0版本,低版本会有githook 不兼容问题。
czgit使用小技巧如下:定义好scopes:作用:scopes代表了commit涉及的范围,可以是项目代码层面,也可以是项目业务层面的范围。代码层面:可以通过monorepo的packages来指定,或者遵循commitlint的scopeenum规则。业务层面:可以自定义scopes的名称和值,使其在命令行中显示得更直观,有助于团队成员快速理解commit的...
// .commitlintrc.jsconst{ execSync } =require('child_process');// @tip: git branch name = feature/33 => auto get defaultIssues = #33constissue =execSync('git rev-parse --abbrev-ref HEAD') .toString() .trim() .split("_")[1]// @tip: monorepo dynamic get name/**@type{import(...
在cz-git的使用过程中,我发现了一些实用的小技巧,旨在让commit操作更加便捷。首先,理解并定义好scopes至关重要,它代表了commit涉及的范围,可以是项目代码层面,通过monorepo的packages来指定,或者遵循[commitlint](https://github.com/conventional-changelog/commitlint)的scope-enum规则。对于项目业务层面...
// .commitlintrc.js const { execSync } = require('child_process'); // @tip: git branch name = feature/33 => auto get defaultIssues = #33 const issue = execSync('git rev-parse --abbrev-ref HEAD') .toString() .trim() .split("_")[1] ...
什么是 commitlint : git commit 时对于 commit message 进行规范检查的工具,保证团队的一致性。 什么是 commitizen : 基于Node.js的 git commit 命令行工具,辅助生成标准化规范化的 commit message。 什么是 adapter(适配器) : 更换 commitizen 命令行工具的 交互方式 插件。 cz-git 有什么特点 友好型命令行工具...