@@ -160,6 +160,57 @@ codeg script
160
160
161
161
PS: 第一次使用 ` script ` 命令会初始化 ` scripts.config.json ` , 可以为它增加对应的描述, 以后每次使用均会同步 ` package.scripts ` 的变化.
162
162
163
+ ## 更多命令
164
+
165
+ 更多命令可以通过插件的形式进行组合, 这样可以为不同的项目定制不同的 CLI 功能, 避免额外的功能在使用上造成负担.
166
+
167
+ ``` javascript
168
+ // codeg.config.mjs code-genius 项目已配置的插件
169
+ import { defineConfig } from " code-genius" ;
170
+ import { clearInstaller } from " @codegenius/clear-plugin" ;
171
+ import { quantityInstaller } from " @codegenius/quantity-plugin" ;
172
+ import { npmDepCheckInstaller } from " @codegenius/depcheck-plugin" ;
173
+ import { lighthouseInstaller } from " @codegenius/lighthouse-plugin" ;
174
+ import { createProjectInstaller } from " @codegenius/create-plugin" ;
175
+ import { gitInitSimpleHooksInstaller } from " @codegenius/hooks-plugin" ;
176
+ import { gitUserInstaller } from " @codegenius/git-user-plugin" ;
177
+ import { npmRegistryInstaller } from " @codegenius/registry-plugin" ;
178
+ import { gitCommitVerifyInstaller } from " @codegenius/verify-plugin" ;
179
+ import { templateInstaller } from " @codegenius/template-plugin" ;
180
+ import { prettierFormatInstaller } from " @codegenius/format-plugin" ;
181
+ import { impSortInstaller } from " @codegenius/impsort-plugin" ;
182
+
183
+ export default defineConfig ({
184
+ commands: {
185
+ fix: {
186
+ paths: [" ./src" , " ./scripts" ],
187
+ },
188
+ },
189
+ plugins: [
190
+ clearInstaller ({
191
+ files: [" ./dist" ],
192
+ }),
193
+ quantityInstaller (),
194
+ npmDepCheckInstaller (),
195
+ lighthouseInstaller (),
196
+ createProjectInstaller (),
197
+ gitInitSimpleHooksInstaller (),
198
+ gitUserInstaller ({
199
+ ruleEmail: " ^[a-zA-Z0-9._%+-]+@(gmail)\\ .(com)$" ,
200
+ }),
201
+ npmRegistryInstaller (),
202
+ gitCommitVerifyInstaller (),
203
+ templateInstaller (),
204
+ prettierFormatInstaller ({
205
+ files: [" ./src" , " ./scripts" ],
206
+ }),
207
+ impSortInstaller ({
208
+ files: [" ./src" , " ./scripts" ],
209
+ }),
210
+ ],
211
+ });
212
+ ```
213
+
163
214
## 执照
164
215
165
216
MIT License
0 commit comments