@@ -18,14 +18,15 @@ npm i -g code-genius
1818
1919## 终端命令
2020
21- | 命令 | 参数 | 功能描述 |
22- | ------ | ---------------------------------------------- | ---------------------------------------------- |
23- | cm | --noEmoji | 帮助生成规范的 git 提交内容 |
24- | cmv | -- | 帮助验证 git commit 的内容是否符合规范 |
25- | cup | --ignore \< path\> | 清理运行时生成的文件 |
26- | ihooks | -- | 使用且有修改 simple-git-hooks 后需要重新初始化 |
27- | run | -- | 运行列出的脚本 |
28- | lint | --eslintrc \< file\> , --path \< path\> , --staged, --suffix \< suffix\> | 检查代码并尝试修复 |
21+ | 命令 | 参数 | 功能描述 |
22+ | -------- | ------------------------------------------------------------------- | ---------------------------------------------- |
23+ | cm | --noEmoji | 帮助生成规范的 git 提交内容 |
24+ | cmv | -- | 帮助验证 git commit 的内容是否符合规范 |
25+ | cup | --ignore \< path\> | 清理运行时生成的文件 |
26+ | ihooks | -- | 使用且有修改 simple-git-hooks 后需要重新初始化 |
27+ | run | -- | 运行列出的脚本 |
28+ | lint | --eslintrc \< file\> , --path \< path\> , --staged, --suffix \< suffix\> | 检查代码并尝试修复 |
29+ | prettier | --path \< path\> , --staged, --suffix \< suffix\> | 格式化代码高风格 |
2930
3031## API
3132
@@ -37,6 +38,7 @@ npm i -g code-genius
3738| 4 | ` gitInitSimpleHooks(cwd) ` | ` cwd?: string ` | ` Promise<void> ` |
3839| 5 | ` npmRun(cwd) ` | ` cwd?: string ` | ` Promise<void> ` |
3940| 6 | ` eslintFix(cwd, options) ` | ` cwd?: string ` ,` options:(EsLintOptions) ` | ` Promise<void> ` |
41+ | 7 | ` prettierFormat(cwd, options) ` | ` cwd?: string ` ,` options:(PrettierFormatOptions) ` | ` Promise<void> ` |
4042
4143## API 示例
4244
@@ -112,6 +114,18 @@ await eslintFix(cwd, esLintOptions);
112114npx esno index .ts
113115```
114116
117+ prettierFormat()
118+
119+ ``` typescript
120+ // ./index.ts
121+ import { prettierFormat , cwd , prettierFormatOptions } from " code-genius" ;
122+
123+ await prettierFormat (cwd , prettierFormatOptions );
124+
125+ // 运行
126+ npx esno index .ts
127+ ```
128+
115129## 执照
116130
117131MIT License
0 commit comments