@@ -71,6 +71,34 @@ import { gitCommit } from "code-genius";
71
71
})();
72
72
```
73
73
74
+ ### 配置文件
75
+
76
+ ``` typescript
77
+ # 覆盖默认的 ` gitCommitTypes ` 和 ` gitCommitScopes ` 配置
78
+ import { defineConfig } from " code-genius" ;
79
+
80
+ export default defineConfig ({
81
+ commands: {
82
+ commit: {
83
+ gitCommitTypes: [
84
+ {
85
+ emoji: " 🎉" ,
86
+ code: " feat" ,
87
+ description: " 增加新功能/特性" ,
88
+ },
89
+ ],
90
+ gitCommitScopes: [
91
+ {
92
+ emoji: " 🐛" ,
93
+ code: " fix" ,
94
+ description: " 修复bug" ,
95
+ },
96
+ ],
97
+ },
98
+ },
99
+ });
100
+ ```
101
+
74
102
## verify 命令
75
103
76
104
校验 ` COMMIT_EDITMSG ` 中的信息是否符合 ** Angualr** 规范, 支持命令模式和 ** API** 模式;
@@ -136,6 +164,21 @@ import { clear } from "code-genius";
136
164
})();
137
165
```
138
166
167
+ ### 配置文件
168
+
169
+ ``` typescript
170
+ # 覆盖默认的 ` files ` 配置
171
+ import { defineConfig } from " code-genius" ;
172
+
173
+ export default defineConfig ({
174
+ commands: {
175
+ clear: {
176
+ files: [" ./dist" ]
177
+ },
178
+ },
179
+ });
180
+ ```
181
+
139
182
## hooks 命令
140
183
141
184
新增或修改 ` simple-git-hooks ` 配置后需要重新初始化, 支持命令模式和 ** API** 模式;
@@ -266,6 +309,21 @@ import { setGitUserName, setGitUserEmail, checkGitUserInfo } from "code-genius";
266
309
})();
267
310
```
268
311
312
+ ### 配置文件
313
+
314
+ ``` typescript
315
+ # 覆盖默认的 ` gituser ` 配置
316
+ import { defineConfig } from " code-genius" ;
317
+
318
+ export default defineConfig ({
319
+ commands: {
320
+ gituser: {
321
+ ruleEmail: " ^[a-zA-Z0-9._%+-]+@(gmail)\\ .(com)$" ,
322
+ },
323
+ },
324
+ });
325
+ ```
326
+
269
327
## template 命令
270
328
271
329
基于 ** CodeGenius** 内置模板快速创建新项目, 仅支持询问模式;
@@ -329,6 +387,21 @@ codeg fix -p ./src -p ./components
329
387
330
388
PS: 依赖 ` eslint ` CLI 模式, 同时对项目配置的 ` .eslintignore ` 和 ` .eslintrc.json ` 生效.
331
389
390
+ ### 配置文件
391
+
392
+ ``` typescript
393
+ # 覆盖默认的 ` fix ` 配置
394
+ import { defineConfig } from " code-genius" ;
395
+
396
+ export default defineConfig ({
397
+ commands: {
398
+ fix: {
399
+ paths: [" ./src" , " ./scripts" ],
400
+ },
401
+ },
402
+ });
403
+ ```
404
+
332
405
## format 命令
333
406
334
407
运行 ` prettier ` 格式化代码风格, 仅支持命令模式;
@@ -352,6 +425,21 @@ codeg format -p ./src -p ./components
352
425
353
426
PS: 依赖 ` prettier ` CLI 模式, 同时对项目配置的 ` .prettierignore ` 和 ` .prettierrc.json ` 生效.
354
427
428
+ ### 配置文件
429
+
430
+ ``` typescript
431
+ # 覆盖默认的 ` format ` 配置
432
+ import { defineConfig } from " code-genius" ;
433
+
434
+ export default defineConfig ({
435
+ commands: {
436
+ format: {
437
+ paths: [" ./src" , " ./scripts" ],
438
+ },
439
+ },
440
+ });
441
+ ```
442
+
355
443
## impsort 命令
356
444
357
445
运行 ` eslint ` 对模块导入进行分组&按字母排序, 支持命令模式, 询问模式和 API 模式;
@@ -396,6 +484,21 @@ import { impSort } from "../src/index";
396
484
397
485
PS: 依赖 ` eslint ` API 模式, 依赖 ` simple-import-sort ` 插件的同时依旧会读取项目配置的 ` .eslintignore ` 和 ` .eslintrc.json ` 文件, 使用 ` impsort ` 的同时将同步进行 ` fix ` 检测和修复.
398
486
487
+ ### 配置文件
488
+
489
+ ``` typescript
490
+ # 覆盖默认的 ` impsort ` 配置
491
+ import { defineConfig } from " code-genius" ;
492
+
493
+ export default defineConfig ({
494
+ commands: {
495
+ format: {
496
+ impsort: [" ./src" , " ./scripts" ],
497
+ },
498
+ },
499
+ });
500
+ ```
501
+
399
502
## script 命令
400
503
401
504
代理运行 ` package.scripts ` 脚本, 仅支持询问模式;
0 commit comments