Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@dzo/commitlint-config-esdz

Package Overview
Dependencies
Maintainers
6
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dzo/commitlint-config-esdz

规范团队Git提交记录,方便回溯。

latest
npmnpm
Version
0.0.8
Version published
Maintainers
6
Created
Source

CommitLint 规范

前端 CommitLint 规范

相关依赖

npm install husky commitlint @commitlint/config-conventional  --save-dev

安装组件

npm install @dzo/commitlint-config-esdz -D

# OR
yarn add @dzo/commitlint-config-esdz --dev

使用

在你的工程根目录下创建一个commitlint.config.js配置文件

配置如下即可:

module.exports = {
  extends: '@dzo/commitlint-config-esdz'
}

安装 husky

对于 commit-msg hook 我们可以使用以下命令来创建 git hook 所要执行的脚本

依次在项目根目录执行如下两条命令

npx husky install
npx husky add .husky/commit-msg 'npx --no-install commitlint --edit "$1"'
npm set-script cz "git add . && git cz && git push"

package.json 修改:

  "husky": {
    "hooks": {
      "commit-msg": "commitlint -e HUSKY_GIT_PARAMS"
    }
  },
  "config": {
    "commitizen":{
      "path":"./node_modules/@dzo/commitlint-config-esdz/lib/cz"
    }
  },

:::caution 如果项目之前安装过 CommitLint 相关的包,建议卸载,避免引入不必要的包。如@commitlint/cli@commitlint/config-conventional等,直接在 package.json 搜索commitlint,相关的包全部卸载 :::

规范

格式: <type>[(scope)]: <description>

示例

git commit -a -m 'build: xxxxx'
git commit -a -m 'feat(cli): xxxxx'
git commit -a -m 'feat(cli): xxxxx' --no-verify // 不验证规范

字段说明

字段类型说明必须
typestring用于表明我们这次提交的改动类型
scopestring一个可选的修改范围。用于标识此次提交主要涉及到代码中哪个模块
descriptionstring一句话描述此次提交的主要内容,做到言简意赅

type

type 类型说明
feat新增功能
fixbug 修复
ui更新 UI
style对代码含义无影响的改动(空格,格式化,等,非 UI 变动)
perf提升性能的代码更改
docs只有文档发生改变
test添加一些缺失的测试或者修正已存在的测试
refactor重构代码
chore影响构建系统或外部依赖的更改(例如:gulp,npm,webpack)
build编译相关的修改,例如发布版本、对项目构建或者依赖的改动
revert撤销上一次的提交

Keywords

commitlint

FAQs

Package last updated on 11 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts