leoforfree / cz-customizable

A standalone commit message helper or customizable commitizen adapter for https://github.com/commitizen/cz-cli
MIT License
604 stars 201 forks source link

No scope question error(Denote the SCOPE of this change) #201

Closed manudeli closed 2 years ago

manudeli commented 2 years ago

I met no scope question(Denote the SCOPE of this change) commitizen in v6.9.1 but there's no error about scope question (Denote the SCOPE of this change) in v6.9.0

Expected

image

Error cases of recent Version(v6.9.1) - skip custom scope field

[CASE 1] If .cz-config.js's scopes is defined

image

[CASE 2] if .cz-config.js's scopes is not defined

image

I think it need to be reset

manudeli commented 2 years ago

Check this picture! there is customScope in cli, not every custom(like recent version).

image

but recent version of cz-customizable have every scope name as 'custom' when I use customScope, no changeable

I have use script npm run commit in every commits that this version change contain

Maybe there is problem with customScope in this commit 03efbf0d3fc7e232661ec8ad991613d3da75ab1b (update many deps)

when I changed dependency version of inquirer ^8.0.0 -> ^6.3.1, the problem is gone!

XPoet commented 2 years ago

I also encountered this problem with cz-customizable v6.9.1

manudeli commented 2 years ago

I also encountered this problem with cz-customizable v6.9.1

If you want to avoid this problem, you can use v6.9.0 first.

I submitted a Pull Request https://github.com/leoforfree/cz-customizable/pull/202 solution about this problem

Wait for it, upgrade after merging

chensidi commented 2 years ago

After setting allowCustomScopes to true and adding scopes: ['custom'] to the scopes option, I can't enter the value of the scope manually.

How should I solve it

XPoet commented 2 years ago

@chensidi You can use cz-custom, which is exactly the same as cz-customizable.

// install cz-custom
npm i cz-custom -D

// modify package.json
"config": {
    "commitizen": {
      "path": "cz-custom"
    },
    "cz-custom": {
      "config": ".cz-config.js"
    }
  }
chensidi commented 2 years ago

@chensidi You can use cz-custom, which is exactly the same as cz-customizable.

// install cz-custom
npm i cz-custom -D

// modify package.json
"config": {
    "commitizen": {
      "path": "cz-custom"
    },
    "cz-custom": {
      "config": ".cz-config.cjs"
    }
  }

@XPoet 感谢大佬,试了一下确实可以输入自定义scope 但是想问下,这个cz-custom和cz-customizable有什么关系,目前cz-customizable是^6.9.1,但cz-custom只有0.0.2 这是新仓库吗?望赐教😊😊😊

XPoet commented 2 years ago

@chensidi 因为 cz-customizable 目前存在自定义 scope 无效的问题,我提了修复该 bug 的 PR,但作者没合并。于是我自己在 cz-customizable 的基础上并发布新的 NPM 包 cz-custom,其用法和文档跟 cz-customizable 保持一致。 当然我会一直维护,跟 cz-customizable 保持功能上的同步,同时也会推出一些更好的功能。你也可以一直使用 cz-custom,没有本质上的区别。

chensidi commented 2 years ago

@XPoet 好的,希望原作者能看到及时合并,感谢大佬支持 @leonardoanalista Currently custom scopes, the problem that cannot be manually entered, hope to merge PR in time,Thank you very much

baixjian commented 2 years ago

@chensidi 因为 cz-customizable 目前存在自定义 scope 无效的问题,我提了修复该 bug 的 PR,但作者没合并。于是我自己在 cz-customizable 的基础上并发布新的 NPM 包 cz-custom,其用法和文档跟 cz-customizable 保持一致。 当然我会一直维护,跟 cz-customizable 保持功能上的同步,同时也会推出一些更好的功能。你也可以一直使用 cz-custom,没有本质上的区别。

您好,请问下使用cz-custom,如果不配置scope项的话,customScope也没有填写,怎么才能移除掉feat(custom): xxx中的 custom。 snapshot


module.exports = {
  types: [....],
  messages: {
    type: '请选择提交类型(必填)',
    scope: '选择一个scope (可选):',
    customScope: '请输入文件修改范围(可选)',
    subject: '请简要描述提交(必填)',
    body: '请输入详细描述(可选)',
    breaking: '列出任何BREAKING CHANGES(破坏性修改)(可选)',
    footer: '请输入要关闭的issue(可选)',
    confirmCommit: '确定提交此说明吗?'
  },
  skipQuestions: ['body', 'footer'],
  allowCustomScopes: true,
  allowBreakingChanges: ['feat', 'fix'], // 当提交类型为feat、fix时才有破坏性修改选项
  subjectLimit: 72
}
XPoet commented 2 years ago

@baixjian 增加 allowEmptyScopes 配置,可以不填写 Scope

module.exports = {
  ...

  allowEmptyScopes: true, // 允许空 Scope (增加这个配置项)
  emptyScopesName:  'empty               (不填 Scope)', // 可自由填写你想要显示的文字

  ....

}
image

看文档,有每个配置项的用法: https://github.com/XPoet/cz-customizable/tree/dev

leonardoanalista commented 2 years ago

Thank you all. I'll merge it as soon as the PR is green.

wakaka378 commented 1 year ago

Has this problem been fixed? I encountered this problem

"cz-customizable": "^7.0.0",

image