Skip to content

Commit a45c323

Browse files
committed
refactor(app): 重构
1 parent 36a850d commit a45c323

File tree

7 files changed

+343
-45
lines changed

7 files changed

+343
-45
lines changed

README.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@
44

55
使用场景: 用于校验那些不应该出现的邮箱地址会名称出现在 `git` 提交记录中, 常见的使用公司内部邮箱提交 `github` 的开源项目, 这通常是不允许的.
66

7+
## 安装
8+
9+
```bash
10+
npm i @codegenius/git-user-plugin -D
11+
```
12+
13+
```javascript
14+
import { defineConfig } from "code-genius";
15+
import { gitUserInstaller } from "@codegenius/git-user-plugin";
16+
17+
export default defineConfig({
18+
plugins: [
19+
gitUserInstaller({
20+
ruleEmail: "^[a-zA-Z0-9._%+-]+@(gmail)\\.(com)$",
21+
}),
22+
],
23+
});
24+
```
25+
26+
## 使用
27+
728
### 命令模式
829

930
```bash
@@ -35,7 +56,7 @@ codeg gituser --rule-email '^[a-zA-Z0-9._%+-]+@(qq)\.(com)$'
3556
### API 模式
3657

3758
```typescript
38-
import { setGitUserName, setGitUserEmail, checkGitUserInfo } from "code-genius";
59+
import { setGitUserName, setGitUserEmail, checkGitUserInfo } from "@codegenius/git-user-plugin";
3960

4061
(async () => {
4162
await setGitUserName("OSpoon", "[\\s\\S]*");
@@ -46,18 +67,3 @@ import { setGitUserName, setGitUserEmail, checkGitUserInfo } from "code-genius";
4667
await checkGitUserInfo("[\\s\\S]*", "^[a-zA-Z0-9._%+-]+@(gmail)\\.(com)$");
4768
})();
4869
```
49-
50-
### 配置文件
51-
52-
```typescript
53-
# 覆盖默认的 `gituser` 配置
54-
import { defineConfig } from "code-genius";
55-
56-
export default defineConfig({
57-
commands: {
58-
gituser: {
59-
ruleEmail: "^[a-zA-Z0-9._%+-]+@(gmail)\\.(com)$",
60-
},
61-
},
62-
});
63-
```

codeg.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineConfig } from "code-genius";
2+
import { gitInitSimpleHooksInstaller } from "@codegenius/hooks-plugin";
3+
4+
export default defineConfig({
5+
plugins: [
6+
gitInitSimpleHooksInstaller(),
7+
],
8+
});

0 commit comments

Comments
 (0)