
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@startdt/commitlint-config
Advanced tools
npm i @commitlint/cli @startdt/commitlint-config --save-dev
提示:如果你已经全局安装了
Commitizen
依赖,则可以通过命令行快速创建遵循约定的提交。请参看:使用 CLI 规范提交信息
使用配置文件:
// .commitlintrc.js
module.exports = {
extends: '@startdt/commitlint-config',
formatter: '@startdt/commitlint-config/format',
rules: {
// 自定义规则
},
};
或者项目属性:
// package.json
"commitlint": {
"extends": "@startdt/commitlint-config",
"formatter": "@startdt/commitlint-config/format",
"rules": {}
}
最后,在 package.json
中添加 commit-msg
钩子:
"gitHooks": {
"commit-msg": "commitlint -e"
},
执行 git commit
时,自动校验 commit message 是否符合提交约定,并给出相应的提示。
如果你已经全局安装了 Commitizen
依赖,则可以通过命令行快速创建遵循约定的提交。
在 package.json
中配置 commitizen
选项:
// package.json
"config": {
"commitizen": {
"path": "./node_modules/@startdt/commitlint-config"
}
},
使用 git cz
替代 git commit
提交代码,即可通过交互式 CLI 快速创建遵循约定的提交。
如果你还没有安装 git cz
相关的依赖,我们提供了内置的 CLI 工具,可以在项目中使用 npm script
的方式调用:
// package.json
{
"scripts": {
"commit": "git-commit"
}
}
执行 npm run commit
提交代码,即可通过交互式 CLI 快速创建遵循约定的提交。
在 git commit
时提交信息遵循以下格式:
<type 类型>[optional scope 可选的作用域]: <description 描述>
[optional body 可选的正文]
[optional footer 可选的脚注]
用于说明 commit
的类型,只允许使用下面列举的标识:
init
: 初次提交代码feat
:新增功能特性fix
: 修复已知问题style
: 统一代码风格chore
: 更新非核心代码build
: 添加或更新构建test
: 添加或改进测试docs
: 添加或更新文档lang
: 国际化与本地化revert
: 撤销之前的提交refactor
: 重构现有代码example
:更新示例代码release
: 发布版本标签用于说明 commit
影响的范围,比如数据层、控制层、视图层等,视项目不同而不同。
如果你的修改影响了不止一个 scope,你可以使用 *
代替。
subject 是 commit
目的的简短描述(默认最大长度不超过 72 个字符)。
注意事项:
.
)Body 部分是对本次 commit
的详细描述,默认可选。
注意事项:
Footer 部分只用于以下两种情况:
非兼容性更新
如果当前代码与上一个版本不兼容,则 Footer 部分以 BREAKING CHANGE
开头,后面是对变动的描述、以及变动理由和迁移方法。
关闭 issue
如果当前 commit
针对某个 issue ,那么可以在 Footer 部分关闭这个 issue 。
FAQs
Commitlint 可共享配置
The npm package @startdt/commitlint-config receives a total of 1 weekly downloads. As such, @startdt/commitlint-config popularity was classified as not popular.
We found that @startdt/commitlint-config demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.