Skip to content

Commit a7c43bc

Browse files
committed
✨ feat(customCommitType): default type editable (RedJue#50)
1 parent 789aa44 commit a7c43bc

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

src/config/commit-type.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { workspace, QuickPickItem } from 'vscode';
55
*/
66
export interface CommitType extends QuickPickItem {
77
icon?: string;
8+
key?:string;
89
}
910
//是否展现 Emoji图标 show Emoji or not
1011
const isShowEmoji = workspace.getConfiguration('GitCommitPlugin').get<boolean>('ShowEmoji');
@@ -14,58 +15,69 @@ const CustomCommitType = workspace.getConfiguration('GitCommitPlugin').get<boole
1415
let CommitType: Array<CommitType> = [
1516
{
1617
label: 'feat',
18+
key: 'feat',
1719
detail: '添加新特性',
18-
icon:'✨'
20+
icon: '✨'
1921
},
2022
{
2123
label: 'fix',
24+
key: 'fix',
2225
detail: '修复bug',
23-
icon:'🐞'
26+
icon: '🐞'
2427
},
2528
{
2629
label: 'docs',
30+
key: 'docs',
2731
detail: '仅仅修改文档',
28-
icon:'📃'
32+
icon: '📃'
2933
},
3034
{
3135
label: 'style',
36+
key: 'style',
3237
detail: '仅仅修改了空格、格式缩进、逗号等等,不改变代码逻辑',
33-
icon:'🌈'
38+
icon: '🌈'
3439
},
3540
{
3641
label: 'refactor',
42+
key: 'refactor',
3743
detail: '代码重构,没有加新功能或者修复bug',
38-
icon:'🦄'
44+
icon: '🦄'
3945
},
4046
{
4147
label: 'perf',
48+
key: 'perf',
4249
detail: '优化相关,比如提升性能、体验',
43-
icon:'🎈'
50+
icon: '🎈'
4451
},
4552
{
4653
label: 'test',
54+
key: 'test',
4755
detail: '增加测试用例',
48-
icon:'🧪'
56+
icon: '🧪'
4957
},
5058
{
5159
label: 'build',
60+
key: 'build',
5261
detail: '依赖相关的内容',
53-
icon:'🔧'
62+
icon: '🔧'
5463
},
5564
{
5665
label: 'ci',
66+
key: 'ci',
5767
detail: 'ci配置相关 例如对 k8s,docker的配置文件的修改',
58-
icon:'🐎'
68+
icon: '🐎'
5969
},
6070
{
6171
label: 'chore',
72+
key: 'chore',
6273
detail: '改变构建流程、或者增加依赖库、工具等',
63-
icon:'🐳'
74+
icon: '🐳'
6475
},
6576
{
6677
label: 'revert',
78+
key: 'revert',
6779
detail: '回滚到上一个版本',
68-
icon:'↩'
80+
icon: '↩'
6981
}
7082
];
7183

@@ -85,7 +97,7 @@ if (Array.isArray(CustomCommitType)) {
8597
if(Reflect.has(item, 'detail')){resultType.detail = item.detail;}else{Reflect.deleteProperty(resultType,'detail');};
8698
if(Reflect.has(item, 'icon')){resultType.icon = item.icon;}else{Reflect.deleteProperty(resultType,'icon');};
8799
}
88-
const target = CommitType.find((type)=>type.label === item.label);
100+
const target = CommitType.find((type)=>type.key === item.key);
89101

90102
if(target !== undefined){
91103
Object.assign(target,resultType);

0 commit comments

Comments
 (0)