Zhengqbbb / cz-git

cz-git | czg 🛠️ DX first and more engineered, lightweight, customizable, standard output format Commitizen adapter and CLI
https://cz-git.qbb.sh
MIT License
1.05k stars 39 forks source link

[Feature Request][bugfix] enableMultipleScopes为true时defaultScope不生效,同时希望defaultScope支持string[]数据类型 #140

Closed curlykay9527 closed 9 months ago

curlykay9527 commented 1 year ago

💭 Describe the feature

希望prompt.defaultScope在prompt.enableMultipleScopes为true的情况下可以支持scope字符串数组,或者提供prompt.defaultScopes属性 我有一个monorepo项目其中有多个工作空间,在一些联动需求提交时允许选择多个scope,我可以使用git status找到所有的涉及的工作区,减少手动选择工作区操作

💡 Proposed Solution

bugfix

image

实际效果

flow-line 默认未选中

期望效果

多选状态下flow-line 应该默认选中

Feature Request

image

实际效果

终端报错,defaultScope不支持处理string[]

期望效果

scope支持多选时同时defaultScope能支持默认选中多个scope

Zhengqbbb commented 1 year ago

终端报错,defaultScope不支持处理string[]

目前是只有 string 的。且功能目前仅有置顶

image

默认多选 scope,这个feature 是有想过,我不认为这是一个必要功能,scope 不应该过长,且已经有搜索功能,所以我对这个问题保持开放性,不一定会实现,但在后续我将进行尝试

或者提供prompt.defaultScopes属性

是指 defaultScopes 没有正常 work 吗 还有指其他的

curlykay9527 commented 1 year ago

scope 不应该过长

认同这一点,不过在存在enableMultipleScopes配置的情况下,去寻求defaultScope支持多选,我认为是一种自然的惯性思维。 当前我通过将涉及的暂存区workspack查询出来,并在scopes数组中排到前面。暂时满足了便捷选中scope的需求,如果defaultScope支持多选的话,我认为将会是一个非常好的DX

是指 defaultScopes 没有正常 work 吗 还有指其他的

不需要提供prompt.defaultScopes属性。 实际问题是,在enableMultipleScopes: true的情况下,defaultScope即使赋予了一个scope字符串,在选择scope时也没有出现置顶,见上方[bugfix]图

Zhengqbbb commented 1 year ago

defaultScope即使赋予了一个scope字符串,在选择scope时也没有出现置顶,见上方[bugfix]图

奇怪,没置顶的话就是 bug了,可以复现吗? 给一下最小化配置例子

.commitlintrc.cjs

/** @type {import('cz-git').UserConfig} */
module.exports = {
prompt: {
enableMultipleScopes: true,
scopes: ['bar', 'foo'],
defaultScope: 'foo',
},
}
image
curlykay9527 commented 1 year ago

这是我的问题,确实是置顶了,抱歉。

Zhengqbbb commented 9 months ago

很抱歉 久等了,当前功能已实现,已发布预发版本可进行测试 npm install -D cz-git@next

我预计在今晚合并主线,在周末发布版本

https://github.com/Zhengqbbb/cz-git/assets/40693636/f37ad34e-cbd2-4108-b19a-ea46382d3fd7

Zhengqbbb commented 9 months ago

The latest version 🌟(v1.8.0)🌟 should be resolve this issue request , please have a try. 💪 👀 Let me know if there are still any issues. 🎉