升级指南
¥Upgrade Guides
validate-commit-msg
validate-commit-msg 的维护者已弃用其软件包,转而使用 commitlint。
¥The maintainers of validate-commit-msg have deprecated their package in favor of commitlint.
使用默认设置迁移
¥Migrating with default settings
只需对你的设置进行少量更改,即可重新创建最常见的 validate-commit-msg 用例。
¥The most common validate-commit-msg use cases can be recreated with minor changes to your setup.
将 validate-commit-msg 替换为 commitlint
¥Replace validate-commit-msg with commitlint
npm remove validate-commit-msg --save-dev
npm install --save-dev @commitlint/cli @commitlint/config-conventional在 package.json 中添加一个 commitmsg 运行脚本
¥Add a commitmsg run-script to package.json
{
"scripts": {
"commitmsg": "commitlint -x @commitlint/config-conventional -E GIT_PARAMS"
}
}安装 Husky
¥Install husky
npm install --save-dev husky使用自定义设置迁移
¥Migrating with custom settings
如果你将 validate-commit-msg 与自定义配置一起使用,你可能也希望自定义 commitlint 配置。
¥If you used validate-commit-msg with custom configuration you might want to customize commitlint configuration, too.
将 validate-commit-msg 替换为 commitlint
¥Replace validate-commit-msg with commitlint
npm remove validate-commit-msg --save-dev
npm install --save-dev @commitlint/cli @commitlint/config-conventional在 package.json 中添加一个 commitmsg 运行脚本
¥Add a commitmsg run-script to package.json
{
"scripts": {
"commitmsg": "commitlint -E GIT_PARAMS"
}
}安装 Husky
¥Install husky
npm install --save-dev husky配置 commitlint
¥Configure commitlint
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
// Place your rules here
"scope-enum": [2, "always", ["a", "b"]], // error if scope is given but not in provided list
},
};validate-commit-msg 选项等效项
¥validate-commit-msg option equivalents
{
"types": ["a", "b"], // 'type-enum': [2, 'always', ['a', 'b']]
"scope": {
"required": true, // 'scope-empty': [2, 'never']
"allowed": ["a", "b"], // 'scope-enum': [2, 'always', ['a', 'b']]; specify [0] for allowed: ["*"]
"validate": false, // 'scope-enum': [0], 'scope-empty': [0]
"multiple": false // multiple scopes are not supported in commitlint
},
"warnOnFail": false, // no equivalent setting in commitlint
"maxSubjectLength": 100, // 'header-max-length': [2, 'always', 100]
"subjectPattern": ".+", // may be configured via `parser-preset`, contact us
"subjectPatternErrorMsg": "msg", // no equivalent setting in commitlint
"helpMessage": "", // no equivalent setting in commitlint
"autoFix": false // no equivalent setting in commitlint
}请参阅 规则参考 获取所有可用配置选项的列表。
¥Refer to the Rules Reference for a list of all available configuration options.
DevTools Slack 工作区上也有 #commitlint 通道。加入我们,我们将尽力帮助你进行迁移。
¥There is also the #commitlint channel on the DevTools Slack workspace. Join us there and we'll do our best to help you with your migration.
版本 1 至 2
¥Version 1 to 2
npm install --save-dev conventional-changelog-lint@latest重大变更
¥Breaking changes
CLI
无
¥None
配置
¥Config
通配符配置被忽略 - 从
2.0.0版本开始,以前的.wildcards配置将被完全忽略。如果你的.conventional-changelog-lintrc、commitlint.config.js或扩展可共享配置包含.wildcards键,则会发出警告。¥wildcards config is ignored - as of version
2.0.0the former.wildcardsconfiguration is ignored entirely. If your.conventional-changelog-lintrc,commitlint.config.jsor an extended shareable configuration has a.wildcardskey a warning will be issued.
API
无
¥None
版本 2 至 3
¥Version 2 to 3
npm remove --save-dev conventional-changelog-lint
npm install --save commitlint
mv .conventional-changelog-lintrc commitlint.config.js将所有对
conventional-changelog-lint的调用重命名为commitlint¥Rename all calls to
conventional-changelog-linttocommitlint
重大变更
¥Breaking changes
CLI
conventional-changelog-lint命令现在称为commitlint¥
conventional-changelog-lintcommand now is calledcommitlintcommitlint命令现在通过@commitlint/cli安装¥
commitlintcommand now is installed via@commitlint/cli.conventional-changelog-lintrc现在被称为commitlint.config.js。¥
.conventional-changelog-lintrcnow is calledcommitlint.config.jscommitlint不会在目录结构中向上搜索配置¥
commitlintdoes not search upwards in the directory structure for config--preset | -p标志已被移除。始终使用angular预设。¥
--preset | -pflag was removed. Theangularpreset is used always.
配置
¥Config
.preset键已被移除。始终使用angular预设。¥
.presetkey is removed. Theangularpreset is used always.
API
getConfiguration(name, settings, seed)更改为load(seed)¥
getConfiguration(name, settings, seed)changed toload(seed)getMessages(range)更改为read(range)¥
getMessages(range)changed toread(range)getPreset(name, require)已移除¥
getPreset(name, require)removedformat(report, options)现在只在options上遵循.color。¥
format(report, options)now only respects.coloronoptionslint(message, options)更改为lint(message, rules)¥
lint(message, options)changed tolint(message, rules)
版本 4 至 5
¥Version 4 to 5
npm remove --save-dev @commitlint/config-angular
npm install --save @commitlint/cli @commitlint/config-conventional
echo 'module.exports = {extends: ["@commitlint/config-conventional"]};';重大变更
¥Breaking changes
配置
¥Config
config-angular放弃了对chore类型的支持,破坏了与 conventional-changelog 的兼容性,请使用config-conventional代替。¥
config-angulardropped support for thechoretype, breaking compatibility with conventional-changelog, useconfig-conventionalinstead.
版本 7 至 8
¥Version 7 to 8
重大变更
¥Breaking changes
成功提交后的输出将被忽略
¥Output on successful commit will be omitted
你可以使用
--verbose标志来获得正确的输出。¥You can use the
--verboseflag to get positive output
版本 8 至 9
¥Version 8 to 9
重大变更
¥Breaking changes
可能的类型
¥Possible types
improvement类型现在将被此配置拒绝。¥
improvementtype will now be rejected by this config
版本 9 到 10
¥Version 9 to 10
重大变更
¥Breaking changes
节点支持
¥Node support
node v8 不再受支持。
¥node v8 is not supported anymore
版本 10 至 11
¥Version 10 to 11
重大变更
¥Breaking changes
Lerna 支持
¥Lerna support
lerna v2 不再受支持。
¥lerna v2 is not supported anymore
版本 11 至 12
¥Version 11 to 12
重大变更
¥Breaking changes
resolve-extends
extends解析的顺序从从右到左更改为从左到右¥The order of the
extendsresolution is changed from right-to-left to left-to-right