1
- # @codegenius/clear -plugin
1
+ # @codegenius/quantity -plugin
2
2
3
- 运行 ` rimraf ` 删除不再需要的文件或文件夹, 支持命令模式, 询问模式和 ** API** 模式;
4
-
5
- 使用场景: 用于删除可以通过项目运行自动生成的文件, 如: ` dist ` 目录, 还有顽固的 ` node_modules ` .
3
+ 运行 ` cloc ` 分析并统计代码量
6
4
7
5
## 安装
8
6
9
7
``` bash
10
- npm i @codegenius/clear -plugin -D
8
+ npm i @codegenius/quantity -plugin -D
11
9
```
12
10
13
11
``` javascript
14
12
import { defineConfig } from " code-genius" ;
15
- import { clearInstaller } from " @codegenius/clear -plugin" ;
13
+ import { quantityInstaller } from " @codegenius/quantity -plugin" ;
16
14
17
15
export default defineConfig ({
18
- plugins: [
19
- clearInstaller ({
20
- files: [" ./dist" , " ./node_modules" ],
21
- }),
22
- ],
16
+ plugins: [quantityInstaller ()],
23
17
});
24
18
```
25
19
@@ -28,36 +22,20 @@ export default defineConfig({
28
22
### 命令模式
29
23
30
24
``` bash
31
- # 删除 dist 文件夹
32
- codeg clear -p ./dist
33
-
34
- # 删除 dist 和 node_modules 两个文件夹
35
- codeg clear -p ./dist -p ./node_modules
36
- ```
37
-
38
- | 选项 | 描述 |
39
- | ------------------------- | ------------ |
40
- | -p, --pattern \< pattern\> | 设置匹配规则 |
41
- | -a, --ask | 启用询问模式 |
42
-
43
- ### 询问模式
44
-
45
- ``` bash
46
- # 启动询问模式
47
- codeg clear --ask
25
+ # 统计 src 文件夹下代码情况
26
+ codeg quantity -p src
48
27
```
49
28
50
- ```
51
- # 询问过程
52
- 1. 请选择需要清理的文件/夹
53
- ```
29
+ | 选项 | 描述 |
30
+ | ------------------- | ------------ |
31
+ | -p, --path \< path\> | 设置代码路径 |
54
32
55
33
### API 模式
56
34
57
35
``` typescript
58
- import { clear } from " @codegenius/clear -plugin" ;
36
+ import { quantity } from " @codegenius/quantity -plugin" ;
59
37
60
38
(async () => {
61
- await clear ([ " ./dist " ] );
39
+ await quantity ( " ./src " );
62
40
})();
63
- ```
41
+ ```
0 commit comments