whizark / commitlint-config-cz Goto Github PK
View Code? Open in Web Editor NEW:gear: commitlint sharable configuration, automatically converts/merges your cz-customizable (commitizen) config.
License: MIT License
:gear: commitlint sharable configuration, automatically converts/merges your cz-customizable (commitizen) config.
License: MIT License
Hi,@whizark, I appear some isses again.
I npm install
those:
"@commitlint/cli": "^8.2.0",
"commitizen": "^4.0.3",
"commitlint-config-cz": "^0.12.1",
"cz-customizable": "^6.2.0",
"husky": "^3.1.0",
this is my .cz.config.js
:
module.exports = {
types: [
{ value: 'feat✨', name: '特性: 一个新的特性' },
{ value: 'fix🐞', name: '修复: 修复一个Bug' },
{ value: 'docs📚', name: '文档: 变更的只有文档' },
{ value: 'style💅', name: '格式: 空格, 分号等格式修复' },
{ value: 'refactor🛠', name: '重构: 代码重构,注意和特性、修复区分开' },
{ value: 'perf🐎', name: '性能: 提升性能' },
{ value: 'test🏁', name: '测试: 添加一个测试' },
{ value: 'revert⏪', name: '回滚: 代码回退' },
{ value: 'chore🗯', name: '工具:开发工具变动(构建、脚手架工具等)' }
],
messages: {
type: '选择一种你的提交类型:',
customScope: '请输入修改范围(可选):',
subject: '短说明:',
body: '长说明,使用"|"换行(可选):',
footer: '关联关闭的issue,例如:#31, #34(可选):',
confirmCommit: '确定提交说明?'
},
allowCustomScopes: true,
allowBreakingChanges: ['特性', '修复'],
subjectLimit: 100
}
this is my commitlint.config.js
:
module.exports = {
extends: [
'cz'
],
rules: {
'type-empty': [2, 'never'],
'subject-empty': [2, 'never']
}
}
and this is my project.json
settings:
...
"config": {
"commitizen": {
"path": "node_modules/cz-customizable"
}
},
"cz-customizable": {
"config": ".cz-config.js"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
after I finish those step, I use npm run commit
to generate commit message, but the commlint check
always fails !😫 Just like this:
In fact, I have selected the type and input the subject. you can see:
? 选择一种你的提交类型: 修复: 修复一个Bug // this is my type
? 短说明: 代码提交bug // this is my subject
But the commlint check
always fails ! I don't know why, hope got your help !!
"commitlint-config-cz": "^0.12.1"
I use npm install commitlint-config-cz --save-dev
install commitlint-config-cz
,and I use it with commitizen
and cz-customizable
, but it not work.
this is my project.json
:
"config": {
"commitizen": {
"path": "node_modules/cz-customizable"
}
},
"cz-customizable": {
"config": "cz-config.js"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{ts,tsx}": [
"npm run lint:ts",
"npm run format",
"git add"
]
}
}
this is my commitlint.config.js
:
module.exports = {
extends: [
'cz'
]
};
this is my .cz-config.js
:
module.exports = {
types: [
{ value: 'feat✨', name: '特性: 一个新的特性' },
{ value: 'fix🐞', name: '修复: 修复一个Bug' },
{ value: 'docs📚', name: '文档: 变更的只有文档' },
{ value: 'style💅', name: '格式: 空格, 分号等格式修复' },
{ value: 'refactor🛠', name: '重构: 代码重构,注意和特性、修复区分开' },
{ value: 'perf🐎', name: '性能: 提升性能' },
{ value: 'test🏁', name: '测试: 添加一个测试' },
{ value: 'revert⏪', name: '回滚: 代码回退' },
{ value: 'chore🗯', name: '工具:开发工具变动(构建、脚手架工具等)' }
],
messages: {
type: '选择一种你的提交类型:',
customScope: '请输入修改范围(可选):',
subject: '短说明:',
body: '长说明,使用"|"换行(可选):',
footer: '关联关闭的issue,例如:#31, #34(可选):',
confirmCommit: '确定提交说明?'
},
allowCustomScopes: true,
allowBreakingChanges: ['特性', '修复'],
subjectLimit: 100
}
after i write those,I use git commit -m "xxxx"
directly to commit, it's still pass the check,i don't konw why,hope got you resolve! thank you!
this is my repository
I used the self -defined commit type
// .cz-config.js
'use strict';
module.exports = {
types: [
{
value: ':rocket: release',
name: '🚀 release: 发布版本/发布标签',
},
{
value: ':construction: WIP',
name: '💪 WIP: 正在进行的工作',
},
{
value: ':sparkles: feat',
name: '✨ feat: 新的特性',
},
{
value: ':bug: fix',
name: '🐛 fix: 修复Bug',
},
{
value: ':wrench: CI',
name: '🔧 CI: 目录结构变更(CI, Building, Tool...)',
},
{
value: ':pencil: docs',
name: '📝 docs: 仅文档更改',
},
{
value: ':twisted_rightwards_arrows: merge',
name: '🔀 merge: 合并分支',
},
{
value: ':rewind: revert',
name: '⏪ revert: 版本回滚',
},
{
value: ':white_check_mark: test',
name: '✅ test: 添加缺失的测试或更正现有测试',
},
{
value: ':chart_with_upwards_trend: perf',
name: '📈 perf: 提高性能的代码更改',
},
{
value: ':thought_balloon: chore',
name: '🗯 chore: 不修改src或测试文件的更改。例如更新构建任务、包管理器',
},
{
value: ':lipstick: ui',
name: '💄 UI: 更新UI和样式文件。',
},
{
value: ':art: style',
name: '🎨 style: 不影响代码含义的更改(空白、格式、缺少分号等)',
},
{
value: ':package: dep_up',
name: '📦 dep_up: 更新已编译的文件或包。',
},
{
value: ':hammer: refactor',
name: '🔨 refactor: 既不修复错误也不添加功能的代码更改',
},
{
value: ':truck: mv',
name: '🚚 mv: 移动或重命名文件。',
},
],
scopes: [],
messages: {
type: '选择一种你的提交类型:',
scope: '选择一个scope (可选):',
// used if allowCustomScopes is true
customScope: '表示该变更的范围:',
subject: '短说明:\n',
body: '长说明,使用"|"换行(可选):\n',
breaking: '非兼容性说明 (可选):\n',
footer: '关联关闭的issue,例如:#31, #34(可选):\n',
confirmCommit: '确定提交说明? yes/no',
},
allowCustomScopes: true,
allowBreakingChanges: ['feat', 'fix'],
};
There is no problem in submitting all of this
But when I generated CHANGELOG, the format was incorrect
"version": "conventional-changelog -p cz-customizable -i CHANGELOG.md -s -r 0 -n && git add CHANGELOG.md "
I specify the parser as cz-customizable,
Otherwise, these custom commit type cannot be written to CHANGELOG normally
when I lerna publish or lerna version, it will show lerna ERR! Error: Command failed with exit code 1: git commit -F /.../lerna-commit.txt, even if I config the commitlint.config.js like this extends: ['lerna','cz'], It will show Error: Cannot find module "conventional-changelog-lint-config-lerna" from , So, how can I resolve this problem, please give your advice, thanks very much
I'm not sure what kind of API works here, but let me describe my problem.
I built https://github.com/paulirish/commitlintbot which lints the title of Pull Requests with commitlint. As my project has custom types, I also use cz and thus I really appreciate you making this package which wires it all up very nicely. (thanks!)
But here's my challenge: The bot pulls the commitlint.config and cz-config over the github API, and then uses them to lint the title. All good so far, but I run this bot on now.sh
which doesn't allow you to write to disk. And since commitlint-config-cz
will only read the .cz-config.js
from disk, I can't supply the configuration correctly.
Unfortunately I don't have a concrete proposal for how this could be done, but I'd be happy with something a little hacky if that's fine with you. :)
Cheers
When using cz
as config for commitlint, the presence of the type is not checked, only its value if it is present. or instance:
my bad commit
: commitlint does not throw an errorfoo: my bad commit
: commitlint throws an error about the type valueBut, if I configure commitlint to extend @commitlint/config-conventional
, both cases throw errors.
"cz-customizable": {
"config": "node_modules/path/to/my/config.js"
}
not support ? only support root dir in project 'cz-config.js' ?
yarn install warning
warning " > [email protected]" has incorrect peer dependency "@commitlint/cli@^7.0.0 || ^8.0.0 || ^9.0.0".
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
package.json
app-root-path ~3.0.0
lodash.clonedeep ~4.5.0
@commitlint/cli 15.0.0
coveralls 3.1.1
intelli-espower-loader 1.1.0
mocha 9.1.3
nyc 15.1.0
power-assert 1.6.1
standard-version 9.3.2
.travis.yml
node 12
node 14
node 16
node 17
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.