Skip to content

Commit 749dbd0

Browse files
authored
Update README.md
1 parent 10e66b9 commit 749dbd0

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

README.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,38 @@
1-
# codegenius-format-plugin
2-
运行 prettier 格式化代码风格
1+
# @codegenius/format-plugin
2+
3+
运行 `prettier` 格式化代码风格, 仅支持命令模式;
4+
5+
使用场景: 用于替代 `prettier --write`, 功能雷同, 可以使用 **API** 模式来运行命令.
6+
7+
### 命令模式
8+
9+
```bash
10+
# 格式化 src 文件夹下的文件
11+
codeg format
12+
```
13+
14+
```bash
15+
# 格式化 src 和 components 文件夹下的文件
16+
codeg format -p ./src -p ./components
17+
```
18+
19+
| 选项 | 描述 |
20+
| ------------------------- | ------------ |
21+
| -p, --pattern \<pattern\> | 设置匹配规则 |
22+
23+
PS: 依赖 `prettier` CLI 模式, 同时对项目配置的 `.prettierignore``.prettierrc.json` 生效.
24+
25+
### 配置文件
26+
27+
```typescript
28+
# 覆盖默认的 `format` 配置
29+
import { defineConfig } from "code-genius";
30+
31+
export default defineConfig({
32+
commands: {
33+
format: {
34+
paths: ["./src", "./scripts"],
35+
},
36+
},
37+
});
38+
```

0 commit comments

Comments
 (0)