Skip to content

Commit e251a53

Browse files
committed
✨refactor(core): 精简代码,整合套件
1 parent 1d16322 commit e251a53

25 files changed

+224
-396
lines changed

.prettierignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -18,113 +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\>, --ignore \<file\>, --path \<path\>, --staged, --suffix \<suffix\> | 检查代码并尝试修复 |
29-
| format | --prettierrc \<file\>, --ignore \<file\>, --path \<path\>, --staged, --suffix \<suffix\> | 格式化代码风格 |
30-
31-
## API
32-
33-
| 序号 | API | 参数 | 返回 |
34-
| ---- | ----------------------------------- | -------------------------------------------------------------------------------------- | --------------- |
35-
| 1 | `gitCommit(types, scopes, options)` | `types: Array<CommitType>`, `scopes: Array<CommitScope>`, `options: GitCommitOptions)` | `Promise<void>` |
36-
| 2 | `gitCommitVerify()` | `--` | `Promise<void>` |
37-
| 3 | `cleanUp(paths)` | `paths: string[]` | `Promise<void>` |
38-
| 4 | `gitInitSimpleHooks(cwd)` | `cwd?: string` | `Promise<void>` |
39-
| 5 | `npmRun(cwd)` | `cwd?: string` | `Promise<void>` |
40-
| 6 | `eslintFix(cwd, options)` | `cwd?: string`,` options:(EsLintOptions)` | `Promise<void>` |
41-
| 7 | `prettierFormat(cwd, options)` | `cwd?: string`,` options:(PrettierFormatOptions)` | `Promise<void>` |
42-
43-
## API 示例
44-
45-
gitCommit()
46-
47-
```typescript
48-
// ./index.ts
49-
import { gitCommit, gitCommitScopes, gitCommitTypes } from "code-genius";
50-
51-
gitCommit(gitCommitTypes, gitCommitScopes, { enableEmoji: true });
52-
53-
// 运行
54-
npx esno index.ts
55-
```
56-
57-
gitCommitVerify()
58-
59-
```typescript
60-
// ./index.ts
61-
import { gitCommitVerify } from "code-genius";
62-
63-
gitCommitVerify();
64-
65-
// 运行
66-
npx esno index.ts
67-
```
68-
69-
cleanUp()
70-
71-
```typescript
72-
// ./index.ts
73-
import { cleanUp, cleanUpDirs } from "code-genius";
74-
75-
cleanUp(cleanUpDirs);
76-
77-
// 运行
78-
npx esno index.ts
79-
```
80-
81-
gitInitSimpleHooks()
82-
83-
```typescript
84-
// ./index.ts
85-
import { gitInitSimpleHooks, cwd } from "code-genius";
86-
87-
gitInitSimpleHooks(cwd);
88-
89-
// 运行
90-
npx esno index.ts
91-
```
92-
93-
npmRun()
94-
95-
```typescript
96-
// ./index.ts
97-
import { gitInnpmRunitSimpleHooks, cwd } from "code-genius";
98-
99-
npmRun(cwd);
100-
101-
// 运行
102-
npx esno index.ts
103-
```
104-
105-
eslintFix()
106-
107-
```typescript
108-
// ./index.ts
109-
import { eslintFix, cwd, esLintOptions } from "code-genius";
110-
111-
await eslintFix(cwd, esLintOptions);
112-
113-
// 运行
114-
npx esno index.ts
115-
```
116-
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-
```
21+
| 命令 | 参数 | 默认值 | 功能描述 |
22+
| ------ | --------------------- | --------- | ------------------------------------------------- |
23+
| commit | --no-emoji | true | 生成 angualr 规范的提交信息 |
24+
| verify | -- | -- | 校验 COMMIT_EDITMSG 中的信息是否符合 Angualr 规范 |
25+
| clear | --pattern \<pattern\> | './dist/' | 运行 rimraf 删除不再需要的文件或文件夹 |
26+
| hooks | -- | -- | 新增或修改 simple-git-hooks 配置后需要重新初始化 |
27+
| run | -- | -- | 列出可以运行的全部脚本 |
28+
| fix | --pattern \<pattern\> | './src' | 运行 eslint 静态扫描和修复代码中存在的问题 |
29+
| format | --pattern \<pattern\> | ./src' | 运行 prettier 格式化代码风格 |
12830

12931
## 执照
13032

output/002/2.ts

Whitespace-only changes.

output/003/001/2.ts

Whitespace-only changes.

output/003/2.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)