commitizen / commitizen/cz-cli

Can I pass the adapter config from node but not read from then package.json

未关闭
#667 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
17.5k
派生
566
平均合并
8 小时 16 分钟
30 天内合并 PR
1

描述

Hi, thanks you for the great work.
I am trying write a new command to call the `cz-cli` like the [doc](https://github.com/commitizen/cz-cli#commitizen-for-multi-repo-projects) said.
However, I will get some error as below when I run the command if the `pakcage.json` does not have the `config` propery.
```
\node_modules\commitizen\node_modules\cz-conventional-changelog\index.js:10
defaultType: process.env.CZ_TYPE || config.defaultType,
^
TypeError: Cannot read property 'defaultType' of undefined

```
I want the user can just run a commit command and do not need to add package.json config. Is that possible?Someways like:
```
const bootstrap = require('commitizen/dist/cli/git-cz').bootstrap
const path = require('path')
bootstrap({
cliPath: path.join(__dirname, '../node_modules/commitizen'),
config: {
"path": 'cz-conventional-changelog'
},
adapter: {
"commitizen": {
"path": "cz-conventional-changelog"
}
}
})
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。