agmd 0.3.14 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.EN.md +67 -175
  2. package/README.md +32 -19
  3. package/es6/package.json +26 -16
  4. package/es6/script/cli/handle.js +6 -0
  5. package/es6/script/cli/handle.js.map +1 -1
  6. package/es6/script/cli/index.js +8 -2
  7. package/es6/script/cli/index.js.map +1 -1
  8. package/es6/script/help/index.js +17 -18
  9. package/es6/script/help/index.js.map +1 -1
  10. package/es6/src/bin.js +1 -0
  11. package/es6/src/bin.js.map +1 -1
  12. package/es6/src/commands/agmd.js.map +1 -1
  13. package/es6/src/commands/change-path.js +49 -27
  14. package/es6/src/commands/change-path.js.map +1 -1
  15. package/es6/src/commands/command-actions.js +23 -10
  16. package/es6/src/commands/command-actions.js.map +1 -1
  17. package/es6/src/commands/command-handler.js +37 -28
  18. package/es6/src/commands/command-handler.js.map +1 -1
  19. package/es6/src/commands/get-file.js +9 -10
  20. package/es6/src/commands/get-file.js.map +1 -1
  21. package/es6/src/commands/get-router.js +3 -5
  22. package/es6/src/commands/get-router.js.map +1 -1
  23. package/es6/src/commands/mark-file.js +61 -43
  24. package/es6/src/commands/mark-file.js.map +1 -1
  25. package/es6/src/commands/mark-write-file.js +8 -3
  26. package/es6/src/commands/mark-write-file.js.map +1 -1
  27. package/es6/src/commands/rename-path.js +127 -61
  28. package/es6/src/commands/rename-path.js.map +1 -1
  29. package/es6/src/commands/wirte-md.js +49 -11
  30. package/es6/src/commands/wirte-md.js.map +1 -1
  31. package/es6/src/shared/constant.js +14 -3
  32. package/es6/src/shared/constant.js.map +1 -1
  33. package/es6/src/utils/router-utils.js.map +1 -1
  34. package/lib/package.json +26 -16
  35. package/lib/script/cli/handle.js +6 -0
  36. package/lib/script/cli/handle.js.map +1 -1
  37. package/lib/script/cli/index.js +8 -2
  38. package/lib/script/cli/index.js.map +1 -1
  39. package/lib/script/help/index.js +17 -18
  40. package/lib/script/help/index.js.map +1 -1
  41. package/lib/src/bin.js +1 -0
  42. package/lib/src/bin.js.map +1 -1
  43. package/lib/src/commands/agmd.js.map +1 -1
  44. package/lib/src/commands/change-path.js +55 -34
  45. package/lib/src/commands/change-path.js.map +1 -1
  46. package/lib/src/commands/command-actions.js +34 -20
  47. package/lib/src/commands/command-actions.js.map +1 -1
  48. package/lib/src/commands/command-handler.js +37 -29
  49. package/lib/src/commands/command-handler.js.map +1 -1
  50. package/lib/src/commands/get-file.js +13 -14
  51. package/lib/src/commands/get-file.js.map +1 -1
  52. package/lib/src/commands/get-router.js +24 -17
  53. package/lib/src/commands/get-router.js.map +1 -1
  54. package/lib/src/commands/mark-file.js +68 -51
  55. package/lib/src/commands/mark-file.js.map +1 -1
  56. package/lib/src/commands/mark-write-file.js +10 -6
  57. package/lib/src/commands/mark-write-file.js.map +1 -1
  58. package/lib/src/commands/rename-path.js +140 -71
  59. package/lib/src/commands/rename-path.js.map +1 -1
  60. package/lib/src/commands/wirte-md.js +52 -12
  61. package/lib/src/commands/wirte-md.js.map +1 -1
  62. package/lib/src/shared/constant.js +17 -3
  63. package/lib/src/shared/constant.js.map +1 -1
  64. package/lib/src/utils/router-utils.js +3 -4
  65. package/lib/src/utils/router-utils.js.map +1 -1
  66. package/package.json +16 -4
package/README.EN.md CHANGED
@@ -1,175 +1,67 @@
1
- # agmd(auto generate md)
2
-
3
-
4
-
5
- >For any document that needs to be generated, enter 'AGMD' in the console under the folder to automatically generate the directory MD description
6
-
7
-
8
-
9
- [![]( https://camo.githubusercontent.com/28479a7a834310a667f36760a27283f7389e864a/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f6c2f76322d646174657069636b65722e737667 )]( https://camo.githubusercontent.com/28479a7a834310a667f36760a27283f7389e864a/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f6c2f76322d646174657069636b65722e737667 )
10
-
11
-
12
- 🚀 Features
13
-
14
- 🔥 Written in TypeScript
15
-
16
- 🔋 build with esbuild
17
-
18
- 💡 easy get foldName and fileName.
19
-
20
-
21
-
22
- ### Case
23
-
24
-
25
-
26
- ! [image]( https://github.com/kakajun/auto-generate-md/blob/master/md2.png )
27
-
28
-
29
-
30
- ### Method of use
31
-
32
- Node environment is required
33
-
34
- 1. Global installation
35
-
36
- > npm i agmd -g
37
-
38
-
39
-
40
- After installation, enter 'AGMD' under the folder where MD needs to be recorded, and the names of folders and files under the relative path will be automatically generated. If comments are written in the header of the file, it will be brought together to automatically generate MD files. The generated file name is' readme md.md ', and the path is the path just entered. At the same level, for the development of large projects, this script may save you some time.
41
-
42
-
43
-
44
- 2. Install as a dependency
45
-
46
- > npm i agmd -D
47
-
48
-
49
-
50
- In package Configure AGMD in scripts of JSON: NPX AGMD -- ignore lib, node_ modules,dist --include . js,. ts,. Vue can automatically update the document with the command line every time it is started or packaged
51
-
52
-
53
-
54
-
55
- Example is some of the files I prepared for the demonstration, which is of no other use
56
-
57
-
58
-
59
- 3. Advanced usage
60
-
61
- Some need to insert the automatically generated documents into an automatically generated MD. the plug-in exports the automatically generated MD data method, and 'getfilenodes' obtains the specific information of all files. You can DIY different documents (the method name does not need to be remembered, because it is written by TS, so it will be automatically clicked)
62
-
63
- >const agmd = require('agmd')
64
-
65
-
66
-
67
- In es:
68
-
69
- >import agmd from 'agmd'
70
-
71
-
72
-
73
- - AGMD Getfilenodes () can obtain information related to specific files, and this function can pass a parameter
74
-
75
-
76
-
77
- - agmd. Getmd() gets the final output information
78
-
79
- Note: the above two methods can pass an option input parameter in the following format:
80
-
81
- option: { ignore: string[] | undefined; include: string[] | undefined }
82
-
83
- #### Command line parameter description
84
-
85
- 1. Use AGMD - h to view help
86
-
87
- 2. You can bring -- ignore to ignore the output file or folder. The default is: IMG, styles, node_ modules,LICENSE,. git,. github,dist,. husky,. vscode,readme-file. js,readme-md.js
88
-
89
- 3. You can bring -- include. Only files with this suffix are required to be output. By default, only files are output js,. vue,. TS, you can add JSX, JSON, etc
90
-
91
-
92
-
93
- ### Creative background
94
-
95
- 1. Have you been asked to write a MD description of the directory file?
96
-
97
- 2. Or if the project directory and files are reconstructed after being moved, the directory description in the MD file needs to be modified again
98
-
99
- 3. After taking over the old project and reading the MD instructions, you can see the file functions in the folder at a glance, rather than clicking on the corresponding file
100
-
101
- 4. You need to take notes to analyze the source code project
102
-
103
-
104
-
105
- ### Function
106
-
107
- 1. Automatically generate folder names and files matching directories (sorted by name)
108
-
109
- 2. Automatically determine the hierarchical directory and indent it
110
-
111
- 3. If there is a comment at the top of the file, it will be judged automatically
112
-
113
- 4. Support recursive search of subordinate files in any file directory (do not execute in a large directory!!! Recursion until there are no files in this directory)
114
-
115
- 5. Support command line parameter configuration, and can customize ignore files and filter suffix files
116
-
117
- 6. Command line parsing
118
-
119
-
120
-
121
- `Usage: agmd--include str--ignore str
122
-
123
-
124
-
125
- Options:
126
-
127
- --include string / -i string.......... include file extension
128
-
129
- --ignore string / -in string........... ignore file or fold
130
-
131
-
132
-
133
- Str deafult:
134
-
135
- --ignore / -i img,styles,node_ modules,LICENSE,. git,. github,dist,. husky,. vscode,readme-file. js,readme-md.js
136
-
137
- --include / -in . js,. vue,. ts
138
-
139
-
140
-
141
- Note:
142
-
143
- There should be no space between strings in a configuration
144
-
145
-
146
-
147
- Examples:
148
-
149
- $ agmd --ignore lib,node_ modules,dist --include . js,. ts,. vue`
150
-
151
-
152
-
153
- ### Related articles
154
-
155
- [Nuggets - auto generate directory MD file]( https://juejin.cn/post/7030030599268073508 )
156
-
157
-
158
-
159
- ### Update record
160
-
161
- 0.1.3
162
-
163
- 1. Package with esbuild
164
-
165
- 2. It is written in eslint and preter specification
166
-
167
- 3. Rewrite with TS
168
-
169
- 4. Support gitee one key synchronization test11253123
170
-
171
-
172
-
173
- 0.2.0
174
- 1
175
- Support command-line parsing parameters, and can transfer parameters dynamically
1
+ # agmd (auto generate md)
2
+
3
+ > A CLI and library that scans your project to generate Markdown docs for directory structures, counts code metrics, and provides utilities to normalize imports, rename paths, and classify files via routes.
4
+
5
+ ## Features
6
+ - Count files and total lines/characters in the project
7
+ - Auto-complete missing suffixes like `.js` and `.vue`
8
+ - Rename files/folders from CamelCase to Kebab-Case
9
+ - Convert imports from absolute to relative paths for easy navigation
10
+ - Classify files by routes and export JSON of nodes
11
+ - Interactive CLI for all operations
12
+ - Output the full tree as JSON
13
+ - TypeScript implementation with extensive tests
14
+ - Convert relative imports to absolute alias-based paths using `@` (new)
15
+
16
+ ## Usage
17
+ - Global: `npm i agmd -g`
18
+ - Local: `npm i agmd -D`
19
+ - Run: `agmd` in the directory you want to document
20
+
21
+ The generated Markdown (`readme-md.md`) contains:
22
+ - A “Directory Structure” section
23
+ - A “Statistics” section with totals per suffix, lines and characters
24
+
25
+ ## Scripts
26
+ Add to `package.json`:
27
+
28
+ `npx agmd --ignore lib,node_modules,dist --include .js,.ts,.vue [--dry-run] [--silent]`
29
+
30
+ ## CLI Commands (interactive)
31
+ - Help
32
+ - Generate Structure Markdown
33
+ - Change Relative Path
34
+ - Change Absolute Path
35
+ - Completion suffix
36
+ - Rename folders to Kebab-Case
37
+ - Rename files to Kebab-Case
38
+ - Record nodes as JSON
39
+ - Mark files for classification
40
+ - Delete marks
41
+ - Classification
42
+
43
+ ## CLI Options
44
+ - `--include string` / `-in string` Include suffixes (space-separated)
45
+ - `--ignore string` / `-i string` Ignore file or directory names (space-separated)
46
+ - `--dry-run` / `-d` Preview changes without writing to disk
47
+ - `--silent` / `-s` Minimize logs
48
+
49
+ Defaults:
50
+ - `--ignore` img,styles,node_modules,LICENSE,.git,.github,dist,.husky,.vscode,readme-file.js,readme-md.js
51
+ - `--include` .js,.vue,.ts
52
+
53
+ Example:
54
+ `agmd --ignore lib node_modules dist --include .js .ts .vue --dry-run --silent`
55
+
56
+ ## Advanced
57
+ Create `classify.js` at the project root to define route-based classification. Use `@` alias paths in the config. If missing, the tool scans `router/` automatically.
58
+
59
+ ## API
60
+ - `getFileNodes(option?)` Get detailed file info
61
+ - `getMd(option?)` Get composed Markdown string and nodes
62
+
63
+ `option: { ignore?: string[]; include?: string[] }`
64
+
65
+ ## Notes
66
+ - Prefer running path operations inside `src` due to alias resolution conventions
67
+ - Dry-run and silent modes are supported across write operations
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # agmd(auto generate md)
2
2
 
3
- > 这是一个前端代码管理的辅助工具,在任何需要生成文档的,文件夹下的控制台中输入`agmd`, 就能自动生成目录 md 说明, 同时能够统计分析当前工程的各类型文件总量和代码总量,还提供一些实用的工具,具体看下面功能特征
3
+ > 这是一个前端代码管理的辅助工具,在任何需要生成文档的,文件夹下的控制台中输入`agmd`, 就能自动生成目录 md 说明(部分功能需要在src目录下), 同时能够统计分析当前工程的各类型文件总量和代码总量,还提供一些实用的工具,具体看下面功能特征
4
4
 
5
5
  [![]( https://camo.githubusercontent.com/28479a7a834310a667f36760a27283f7389e864a/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f6c2f76322d646174657069636b65722e737667)]( https://camo.githubusercontent.com/28479a7a834310a667f36760a27283f7389e864a/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f6c2f76322d646174657069636b65722e737667)
6
6
  [![]( https://github.com/kakajun/auto-generate-md/actions/workflows/test.yml/badge.svg?branch=master)]( https://github.com/kakajun/auto-generate-md/actions/workflows/test.yml)
@@ -17,6 +17,7 @@
17
17
  🚘 一键更改文件或者文件名,驼峰命名为kable-case
18
18
 
19
19
  ⛵ 把工程所有引用更改绝对路径为相对路径(方便点击下钻查看文件)
20
+ 🔧 支持将相对路径统一转换为基于 '@' 别名的绝对路径
20
21
 
21
22
  ♨️ 把工程按路由标记分类(对拆分工程很重要)
22
23
 
@@ -26,11 +27,16 @@
26
27
 
27
28
  😍 得到一个包含整个工程结构树的json
28
29
 
29
- 🔋 用esbuild进行打包
30
-
31
30
  💡 一键拿到文件和文件夹名字, 并生成JSON输出
32
31
 
33
- 🔥 用TypeScript书写,80%的代码全部书写了测试用例
32
+ 🔥 用TypeScript书写,85%的代码全部书写了测试用例
33
+
34
+ ## 设计初衷
35
+
36
+ 1. 统计工程量, 看看咱们工程究竟有多少个文件, 多少代码量
37
+ 2. 如果仅仅只是为了重命文件和文件夹, 那么其实这个库没有存在的必要, 因为我们可以自己随手写个node代码, 就全部重命名了, 问题的关键是, 我们内部工程有很多依赖, 像这样子 `import { replaceName } from '../src/commands/rename-path'` , 我们需要一个工具, 能够帮我们自动生成目录, 快速定位到文件,也进行重命名来减少重复劳动, 提升效率.
38
+ 3. 如果想把工程1分2做成按路由拆分的微服务, 那么需要知道哪些文件被工程1用到了, 哪些文件被工程2用到了, 那么就需要一个工具, 来进行标记,甚至清除没有被标记的文件.
39
+
34
40
 
35
41
  ### 操作界面
36
42
 
@@ -49,7 +55,7 @@
49
55
  2. 作为依赖安装
50
56
  > npm i agmd -D
51
57
 
52
- 在package.json的scripts 中配置 agmd: npx agmd --ignore lib,node_modules,dist --include .js,.ts,.vue 可以在每次启动或打包时,带上命令行来自动更新文档
58
+ 在package.json的scripts 中配置 agmd: npx agmd --ignore lib,node_modules,dist --include .js,.ts,.vue [--dry-run] [--silent] 可以在每次启动或打包时,带上命令行来自动更新文档
53
59
 
54
60
 
55
61
  example,是我为演示准备的一些文件,并没有其他用
@@ -57,14 +63,13 @@ example,是我为演示准备的一些文件,并没有其他用
57
63
 
58
64
  3. 命令说明
59
65
  - 帮助
60
- - 执行所有操作 (包含下面所有操作)
61
66
  - 生成结构树文档
62
- - 修改为相当路径
63
- - 修改为绝对路径(暂未实现)
67
+ - 修改为相对路径
68
+ - 修改为绝对路径
64
69
  - 补全文件后缀
65
- - 统一命名文件夹为KebabCase
66
- - 统一命名文件为KebabCase
67
- - 记录节点Json
70
+ - 统一命名文件夹为 Kebab-Case
71
+ - 统一命名文件为 Kebab-Case
72
+ - 记录节点 JSON
68
73
  - 给需要分类的都打上标记
69
74
  - 删除标记
70
75
  - 分类
@@ -87,8 +92,6 @@ example,是我为演示准备的一些文件,并没有其他用
87
92
  │ │ └── index.ts
88
93
  │ ├── help
89
94
  │ │ └── index.ts
90
- │ ├── build.js
91
- │ └── builder.js
92
95
  ├── src
93
96
  │ ├── commands
94
97
  │ │ ├── agmd.ts
@@ -100,7 +103,6 @@ example,是我为演示准备的一些文件,并没有其他用
100
103
  │ │ └── wirte-md.ts /* 生成md说明文档 */
101
104
  │ ├── shared
102
105
  │ │ ├── constant.ts
103
- │ │ └── logger.ts
104
106
  │ ├── bin.ts
105
107
  │ └── index.ts /* 这里抛出一些高级操作方法 */
106
108
  ├── test
@@ -149,11 +151,13 @@ note: 上面两个方法均可传一个option入参,其格式为:
149
151
  5. 支持命令行参数配置, 可以自定义忽略文件和过滤后缀名文件
150
152
  6. 命令行解析
151
153
 
152
- 控制台命令: agmd--include str--ignore str
154
+ 控制台命令: agmd --include <string> --ignore <string> [--dry-run] [--silent]
153
155
 
154
156
  可选项:
155
- --include string / -i string.......... 包含解析的后缀
156
- --ignore string / -in string........... 忽略文件名
157
+ --include string / -in string.......... 包含解析的后缀 (以空格分隔)
158
+ --ignore string / -i string........... 忽略文件名或目录 (以空格分隔)
159
+ --dry-run / -d.................. 预演模式, 不对文件系统进行写入
160
+ --silent / -s.................. 静默模式, 最小化日志输出
157
161
 
158
162
  例子:
159
163
  --ignore / -i img,styles,node_modules,LICENSE,.git,.github,dist,.husky,.vscode,readme-file.js,readme-md.js
@@ -163,7 +167,7 @@ note: 上面两个方法均可传一个option入参,其格式为:
163
167
  配置中的字符串之间不应有空格
164
168
 
165
169
  命令行例子:
166
- $ agmd --ignore lib,node_modules,dist --include .js,.ts,.vue`
170
+ $ agmd --ignore lib node_modules dist --include .js .ts .vue --dry-run --silent
167
171
 
168
172
  ### 相关文章
169
173
 
@@ -171,7 +175,7 @@ $ agmd --ignore lib,node_modules,dist --include .js,.ts,.vue`
171
175
 
172
176
  ### 写在最后
173
177
 
174
- 本工程有26个测试, 大家如果想扩展什么功能, 测试代码跑起来, 很方便, 也欢迎大家克隆本工程然后提交进行PR!
178
+ 本工程有36个测试, 大家如果想扩展什么功能, 测试代码跑起来, 很方便, 也欢迎大家克隆本工程然后提交进行PR!
175
179
 
176
180
  ### 更新记录
177
181
  0.1.3
@@ -210,3 +214,12 @@ $ agmd --ignore lib,node_modules,dist --include .js,.ts,.vue`
210
214
 
211
215
  0.3.8
212
216
  操作界面改成中文的, 我还是做不到大爱全世界, 先给自己和中国伙伴用好就行了, 同时增加功能只补全后缀, 但不更改路径
217
+
218
+ 0.3.14
219
+ 重构代码, 修改打包有esbuild转为tsc编译, 同时修改里面本身为异步操作的fs.readFileSync改为await readFile ,同时新增部分测试用例使得覆盖率达到85%
220
+
221
+ 0.4.1
222
+ 重构代码, 新增功能:
223
+ 1. 新增命令行参数 --dry-run / -d 预演模式, 不对文件系统进行写入
224
+ 2. 新增命令行参数 --silent / -s 静默模式, 最小化日志输出
225
+ 3. 新增命令行参数 --absolute-alias / -a 把工程所有引用文件都加上绝对路径别名(方便点击下钻查看文件)
package/es6/package.json CHANGED
@@ -1,9 +1,19 @@
1
1
  {
2
2
  "name": "agmd",
3
- "version": "0.3.13",
4
- "description": "auto generate markdown for node, Classification of engineering documents, Absolute path to relative path",
3
+ "version": "0.4.0",
4
+ "description": "Automatically generate a directory structure for any file or folder, create Markdown documentation for nodes, classify engineering documents, and convert absolute paths to relative paths.",
5
5
  "keywords": [
6
- "node",
6
+ "fs",
7
+ "filesystem",
8
+ "fs.js",
9
+ "memory-fs",
10
+ "file",
11
+ "file system",
12
+ "mount",
13
+ "memory",
14
+ "mock",
15
+ "in-memory",
16
+ "directory",
7
17
  "auto",
8
18
  "generate",
9
19
  "relative path",
@@ -34,33 +44,36 @@
34
44
  "type": "git",
35
45
  "url": "git@github.com:kakajun/auto-generate-md.git"
36
46
  },
47
+ "dependencies": {
48
+ "consola": "^3.2.3",
49
+ "fs-extra": "^11.2.0",
50
+ "arg": "5.0.2",
51
+ "commander": "^11.1.0",
52
+ "node-environment": "^0.5.1",
53
+ "prompts": "^2.4.2",
54
+ "@types/prompts": "^2.4.9"
55
+ },
37
56
  "devDependencies": {
38
57
  "@types/debug": "^4.1.12",
39
58
  "@types/fs-extra": "^11.0.4",
40
59
  "@types/jest": "^29.5.11",
41
60
  "@types/node": "^20.11.10",
42
- "@types/prompts": "^2.4.9",
43
61
  "eslint-plugin-import": "^2.29.1",
44
62
  "@typescript-eslint/eslint-plugin": "^6.19.1",
45
63
  "@typescript-eslint/parser": "^6.19.1",
46
- "arg": "5.0.2",
47
- "commander": "^11.1.0",
48
- "debug": "^4.3.4",
49
64
  "eslint": "^8.56.0",
50
65
  "eslint-config-prettier": "^9.1.0",
51
- "fs-extra": "^11.2.0",
52
66
  "husky": "^9.0.6",
53
67
  "jest": "^29.7.0",
54
68
  "lint-staged": "^15.2.0",
55
- "node-environment": "^0.5.1",
56
69
  "nodemon": "^3.0.3",
57
70
  "prettier": "^3.2.4",
58
- "prompts": "^2.4.2",
59
71
  "ts-jest": "^29.1.2",
60
72
  "ts-node": "^10.9.2",
61
- "consola": "^3.2.3",
62
73
  "typescript": "^5.3.3",
63
- "ts-node-dev": "^2.0.0"
74
+ "ts-node-dev": "^2.0.0",
75
+ "memfs": "^4.9.2",
76
+ "raf-stub": "3.0.0"
64
77
  },
65
78
  "lint-staged": {
66
79
  "*.{ts,tsx,js}": "prettier --write",
@@ -74,8 +87,5 @@
74
87
  "files": [
75
88
  "es6",
76
89
  "lib"
77
- ],
78
- "dependencies": {
79
- "node-environment": "^0.5.1"
80
- }
90
+ ]
81
91
  }
@@ -14,6 +14,12 @@ function handle(settings) {
14
14
  if (settings.include) {
15
15
  settings.includes = settings.include.split(' ');
16
16
  }
17
+ if (settings.dryRun) {
18
+ process.env.AGMD_DRY_RUN = '1';
19
+ }
20
+ if (settings.silent) {
21
+ process.env.AGMD_SILENT = '1';
22
+ }
17
23
  return settings;
18
24
  }
19
25
  export default handle;
@@ -1 +1 @@
1
- {"version":3,"file":"handle.js","sourceRoot":"","sources":["../../../script/cli/handle.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,M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AAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC/C,CAAC;IACD,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrB,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACjD,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,GAAG,CAAA;IAChC,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,GAAG,CAAA;IAC/B,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,eAAe,MAAM,CAAA"}
@@ -5,10 +5,14 @@ const stringToArgs = (rawArgs) => {
5
5
  '--include': String,
6
6
  '--version': Boolean,
7
7
  '--help': Boolean,
8
+ '--dry-run': Boolean,
9
+ '--silent': Boolean,
8
10
  '-h': '--help',
9
11
  '-i': '--ignore',
10
12
  '-in': '--include',
11
- '-v': '--version'
13
+ '-v': '--version',
14
+ '-d': '--dry-run',
15
+ '-s': '--silent'
12
16
  }, {
13
17
  argv: rawArgs.slice(2)
14
18
  });
@@ -16,7 +20,9 @@ const stringToArgs = (rawArgs) => {
16
20
  help: args['--help'],
17
21
  ignore: args['--ignore'],
18
22
  include: args['--include'],
19
- version: args['--version']
23
+ version: args['--version'],
24
+ dryRun: args['--dry-run'],
25
+ silent: args['--silent']
20
26
  };
21
27
  };
22
28
  export default stringToArgs;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../script/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,MAAM,YAAY,GAAG,CAAC,OAAiB,EAAE,EAAE;IACzC,MAAM,IAAI,GAAG,GAAG,CACd;QACE,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,MAAM;QACnB,WAAW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QACzB,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;KACzB,CAAA;AACH,CAAC,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -1,21 +1,20 @@
1
- const st = `使用说明:
2
- 1. 在控制台按上下切换功能并回车进行确认, 执行相对应的操作!
3
- 2. 可以在package.json中的scripts下面配置如下,然后运行命令:
4
- agmd --include str --ignore str
5
- 选项:
6
- --include string / -i string.......... 包括文件扩展名
7
- --ignore string / -in string........... 忽略文件或者文件夹
8
-
9
- 各选项的默认配置:
10
- --ignore img,styles,node_modules,LICENSE,.git,.github,dist,.husky,.vscode,readme-file.js,readme-md.js
11
- --include .js,.vue,.ts
12
-
13
- 说明:
14
- 配置中的字符串之间不应有空格
15
-
16
- 举例:
17
-
18
- $ agmd --ignore lib,node_modules,dist --include .js,.ts,.vue`;
1
+ const st = `使用说明:
2
+ 1. 在控制台按上下切换功能并回车进行确认, 执行相对应的操作!
3
+ 2. 可以在 package.jsonscripts 下配置如下, 然后运行命令:
4
+ agmd --include <string> --ignore <string> [--dry-run] [--silent]
5
+
6
+ 选项:
7
+ --include string / -in string.......... 包括文件扩展名 (以空格分隔)
8
+ --ignore string / -i string........... 忽略文件或文件夹 (以空格分隔)
9
+ --dry-run / -d.................. 预演模式, 不对文件系统进行写入
10
+ --silent / -s.................. 静默模式, 最小化日志输出
11
+
12
+ 默认配置:
13
+ --ignore img,styles,node_modules,LICENSE,.git,.github,dist,.husky,.vscode,readme-file.js,readme-md.js
14
+ --include .js,.vue,.ts,.tsx
15
+
16
+ 示例:
17
+ $ agmd --ignore lib node_modules dist --include .js .ts .vue --dry-run --silent`;
19
18
  function help() {
20
19
  console.log(st);
21
20
  process.exit(0);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../script/help/index.ts"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG;;;;;;;;;;;;;;;;;gEAiBqD,CAAA;AAEhE,SAAS,IAAI;IACX,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC;AACD,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../script/help/index.ts"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG;;;;;;;;;;;;;;;;kFAgBuE,CAAA;AAElF,SAAS,IAAI;IACX,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC;AACD,eAAe,IAAI,CAAA"}
package/es6/src/bin.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { Command } from 'commander';
3
3
  import { handleCommand } from './commands/command-handler';
4
4
  const program = new Command();
5
+ program.allowUnknownOption(true);
5
6
  program.action(handleCommand);
6
7
  program.parse(process.argv);
7
8
  //# sourceMappingURL=bin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAC7B,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;AAC7B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA"}
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAC7B,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAA;AAChC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;AAC7B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"agmd.js","sourceRoot":"","sources":["../../../src/commands/agmd.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,YAAY,MAAM,kBAAkB,CAAA;AAC3C,OAAO,MAAM,MAAM,yBAAyB,CAAA;AAC3C,SAAe,IAAI;;QAClB,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC1C,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;QAC9D,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAE,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;QACrD,MAAM,iBAAiB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACpC,CAAC;CAAA;AAED,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"agmd.js","sourceRoot":"","sources":["../../../src/commands/agmd.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,YAAY,MAAM,kBAAkB,CAAA;AAC3C,OAAO,MAAM,MAAM,yBAAyB,CAAA;AAE3C,SAAe,IAAI;;QAClB,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC1C,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;QAC9D,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAE,M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