zero-ai 0.3.33 → 0.3.35

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 (89) hide show
  1. package/README.md +3 -20
  2. package/package.json +3 -4
  3. package/src/_template/APP/.placeholder +0 -0
  4. package/src/_template/MODULE/.placeholder +0 -0
  5. package/src/_template/MODULE/database/MYSQL.properties +4 -0
  6. package/src/_template/MODULE/database/MYSQL.yml +2 -0
  7. package/src/_template/MODULE/database/database-reinit.sh +3 -0
  8. package/src/_template/MODULE/database/database-reinit.sql +5 -0
  9. package/src/_template/MODULE/database/init-db.sh +5 -0
  10. package/src/_template/MODULE/pom.xml.ejs +20 -0
  11. package/src/_template/MODULE/source-api/pom.xml.ejs +21 -0
  12. package/src/_template/MODULE/source-domain/ExtensionGeneration.ejs +7 -0
  13. package/src/_template/MODULE/source-domain/configuration.yml.ejs +3 -0
  14. package/src/_template/MODULE/source-domain/pom.xml.ejs +37 -0
  15. package/src/_template/MODULE/source-provider/ExtensionSource.ejs +14 -0
  16. package/src/_template/MODULE/source-provider/pom.xml.ejs +21 -0
  17. package/src/_template/SPRING/.placeholder +0 -0
  18. package/src/_template/SPRING/database/database-account.sql.ejs +3 -0
  19. package/src/_template/SPRING/database/database-reinit.sql.ejs +5 -0
  20. package/src/_template/SPRING/database/init-db.sh +4 -0
  21. package/src/_template/SPRING/mvn-build.sh +3 -0
  22. package/src/_template/SPRING/mvn-env.sh.ejs +7 -0
  23. package/src/_template/SPRING/pom.xml.ejs +46 -0
  24. package/src/_template/SPRING/source-api/AppDev.java.ejs +13 -0
  25. package/src/_template/SPRING/source-api/Application.java.ejs +12 -0
  26. package/src/_template/SPRING/source-api/application.yml.ejs +64 -0
  27. package/src/_template/SPRING/source-api/env.properties.ejs +7 -0
  28. package/src/_template/SPRING/source-api/pom.xml.ejs +65 -0
  29. package/src/_template/SPRING/source-domain/ActOperationCommon.ejs +17 -0
  30. package/src/_template/SPRING/source-domain/GenConfigApp.ejs +22 -0
  31. package/src/_template/SPRING/source-domain/pom.xml.ejs +21 -0
  32. package/src/_template/SPRING/source-provider/GenAppModule.ejs +12 -0
  33. package/src/_template/SPRING/source-provider/pom.xml.ejs +21 -0
  34. package/src/_template/SPRING/source-test/pom.xml.ejs +28 -0
  35. package/src/ai.js +11 -5
  36. package/src/commander/ai.zero +7 -11
  37. package/src/commander/app.json +24 -0
  38. package/src/commander/help.json +7 -0
  39. package/src/commander/md5.json +12 -0
  40. package/src/commander/mod.json +24 -0
  41. package/src/commander/spring.json +24 -0
  42. package/src/commander/str.json +25 -0
  43. package/src/commander/sync.json +19 -0
  44. package/src/commander/uuid.json +13 -0
  45. package/src/commander/web.json +12 -0
  46. package/src/commander-ai/fn.help.metadata.js +20 -0
  47. package/src/commander-ai/{fn.md5.js → fn.random.md5.js} +6 -12
  48. package/src/commander-ai/{fn.random.js → fn.random.string.js} +7 -13
  49. package/src/commander-ai/{fn.uuid.js → fn.random.uuid.js} +5 -9
  50. package/src/commander-ai/fn.source.app.js +20 -0
  51. package/src/commander-ai/fn.source.front.js +106 -0
  52. package/src/commander-ai/fn.source.mod.js +15 -0
  53. package/src/commander-ai/fn.source.spring.js +20 -0
  54. package/src/commander-ai/{fn.sync.js → fn.source.sync.js} +12 -17
  55. package/src/commander-ai/index.js +20 -23
  56. package/src/commander-shared/ai.fn.initialize.__.io.util.js +161 -0
  57. package/src/commander-shared/ai.fn.initialize.__.spring.directory.js +73 -0
  58. package/src/commander-shared/ai.fn.initialize.__.spring.file.js +112 -0
  59. package/src/commander-shared/ai.fn.initialize.__.zero.directory.js +63 -0
  60. package/src/commander-shared/ai.fn.initialize.__.zero.file.js +81 -0
  61. package/src/commander-shared/ai.fn.initialize.app.js +26 -0
  62. package/src/commander-shared/ai.fn.initialize.module.js +63 -0
  63. package/src/commander-shared/ai.fn.initialize.spring.js +68 -0
  64. package/src/commander-shared/ai.fn.parse.argument.js +92 -0
  65. package/src/commander-shared/index.js +26 -0
  66. package/src/epic/ai.economy.impl.fn.execute.js +11 -56
  67. package/src/epic/ai.unified.fn._.logging.js +4 -25
  68. package/src/epic/ai.unified.fn.fn.error.code.js +1 -1
  69. package/src/epic/index.js +2 -2
  70. package/src/{aj.js → previous/aj.js} +1 -1
  71. package/src/{art.js → previous/art.js} +1 -1
  72. package/src/{commander-aj → previous/commander-aj}/fn.i.mod.js +1 -1
  73. package/src/{commander-aj → previous/commander-aj}/fn.i.resource.js +1 -1
  74. package/src/{commander-aj → previous/commander-aj}/fn.j.bundle.js +1 -1
  75. package/src/{commander-aj → previous/commander-aj}/fn.j.init.js +2 -2
  76. package/src/{commander-aj → previous/commander-aj}/fn.j.permission.js +1 -1
  77. package/src/{commander-aj → previous/commander-aj}/fn.j.plugin.js +1 -1
  78. package/src/{commander-ar → previous/commander-ar}/fn.i.complex.js +1 -1
  79. package/src/{commander-ar → previous/commander-ar}/fn.i.form.js +1 -1
  80. /package/src/{commander → previous}/aj.zero +0 -0
  81. /package/src/{commander → previous}/ar.zero +0 -0
  82. /package/src/{commander-aj → previous/commander-aj}/bundle/specification.txt +0 -0
  83. /package/src/{commander-aj → previous/commander-aj}/index.js +0 -0
  84. /package/src/{commander-ar → previous/commander-ar}/index.js +0 -0
  85. /package/src/{commander-ai → previous}/fn.csv.js +0 -0
  86. /package/src/{commander-ai → previous}/fn.data.js +0 -0
  87. /package/src/{commander-ai → previous}/fn.init.js +0 -0
  88. /package/src/{commander-ai → previous}/fn.key.js +0 -0
  89. /package/src/{commander-ai → previous}/fn.uk.js +0 -0
@@ -1,12 +1,8 @@
1
1
  A;
2
- command, executor, description, option1,option2, option3, option4
3
- uuid, executeUuid, 生成UUID的值,可直接拷贝, n=「20」生成的数量
4
- csv, executeCsv, 将JsonArray数据转换成csv, p=输入数据文件路径, c=配置文件路径, s=分割符
5
- uk, executeUk, 检查数据文件中的Data数据是否符合唯一值规范, p=输入数据文件路径, f=需要检查的字段名
6
- data, executeData, 根据配置文件生成数据, c=配置文件路径, o=「.」输出文件基本路径, j=「false」是否Array, n=「23」如果是Array则生效
7
- key, executeKey, 为数据模板添加key属性(UUID格式), p=输入数据文件路径, f=「key」标识key的字段名
8
- str, executeString, 生成随机字符串,可直接拷贝, n=「1」生成的数量, l=「64」长度信息(默认64),f=是否完全生成
9
- md5, executeMD5, 加密字符串,可直接拷贝, i=输入字符串
10
- init, executeInit, 初始化Zero Ui工程, n=项目名称(必须填写,最终写入package.json)
11
- sync, executeSync, 同步Zero Ui最新框架, p=配置文件路径,前端项目根目录,m=是否本地模式
12
-
2
+ command, executor, description, option1,option2, option3, option4
3
+ uuid, executeUuid, 生成UUID的值,可直接拷贝, n=「20」生成的数量
4
+ str, executeString, 生成随机字符串,可直接拷贝, n=「1」生成的数量, l=「64」长度信息(默认64),f=是否完全生成
5
+ md5, executeMD5, 加密字符串,可直接拷贝, i=输入字符串
6
+ sync, executeFrontendSync, 同步Zero Ui最新框架, p=配置文件路径,前端项目根目录,m=是否本地模式
7
+ app, executeApp, 生成Zero 微服务实例, p=配置文件路径,n=名称(最小模式)
8
+ mod, executeMod, 生成Zero 扩展模块实例, p=配置文件路径,n=名称(完整模式)
@@ -0,0 +1,24 @@
1
+ {
2
+ "executor": "executeApp",
3
+ "description": "(后端)创建一个新的 Zero App 脚手架!",
4
+ "command": "app",
5
+ "options": [
6
+ {
7
+ "name": "name",
8
+ "alias": "n",
9
+ "description": "创建应用的名称!"
10
+ },
11
+ {
12
+ "name": "config",
13
+ "alias": "c",
14
+ "description": "配置文件路径,默认读取 app.json 文件!",
15
+ "default": "app.json"
16
+ },
17
+ {
18
+ "name": "output",
19
+ "alias": "o",
20
+ "description": "默认应用的输出路径,若不制定为当前路径!",
21
+ "default": "."
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "executor": "executeHelp",
3
+ "description": "显示帮助的详细信息!",
4
+ "command": "help",
5
+ "options": [
6
+ ]
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "executor": "executeMD5",
3
+ "description": "直接针对输入内容生成 MD5 加密值",
4
+ "command": "md5",
5
+ "options": [
6
+ {
7
+ "name": "input",
8
+ "alias": "i",
9
+ "description": "加密输入的字符串的值"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "executor": "executeMod",
3
+ "description": "(后端)创建一个新的 Zero Extension 模块脚手架!",
4
+ "command": "mod",
5
+ "options": [
6
+ {
7
+ "name": "module",
8
+ "alias": "m",
9
+ "description": "创建模块的名称!"
10
+ },
11
+ {
12
+ "name": "config",
13
+ "alias": "c",
14
+ "description": "配置文件路径,默认读取 mod.json 文件!",
15
+ "default": "mod.json"
16
+ },
17
+ {
18
+ "name": "output",
19
+ "alias": "o",
20
+ "description": "默认应用的输出路径,若不制定为当前路径!",
21
+ "default": "."
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "executor": "executeSpring",
3
+ "description": "(后端)创建一个新的 Spring 脚手架!",
4
+ "command": "spring",
5
+ "options": [
6
+ {
7
+ "name": "name",
8
+ "alias": "n",
9
+ "description": "创建应用的名称!"
10
+ },
11
+ {
12
+ "name": "config",
13
+ "alias": "c",
14
+ "description": "配置文件路径,默认读取 app.json 文件!",
15
+ "default": "app.json"
16
+ },
17
+ {
18
+ "name": "output",
19
+ "alias": "o",
20
+ "description": "默认应用的输出路径,若不制定为当前路径!",
21
+ "default": "."
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "executor": "executeString",
3
+ "description": "生成随机字符串",
4
+ "command": "str",
5
+ "options": [
6
+ {
7
+ "name": "number",
8
+ "alias": "n",
9
+ "description": "生成随机数的数量,默认 1 个",
10
+ "default": 1
11
+ },
12
+ {
13
+ "name": "length",
14
+ "alias": "l",
15
+ "description": "生成随机字符串的长度,默认 10 个字符",
16
+ "default": 10
17
+ },
18
+ {
19
+ "name": "full",
20
+ "alias": "f",
21
+ "description": "是否使用全字符集,默认 false,只使用字母和数字",
22
+ "default": false
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "executor": "executeFrontendSync",
3
+ "description": "同步 Zero Ui 的最新框架",
4
+ "command": "sync",
5
+ "options": [
6
+ {
7
+ "name": "path",
8
+ "alias": "p",
9
+ "description": "本地配置文件路径,默认 .zero",
10
+ "default": ".zero"
11
+ },
12
+ {
13
+ "name": "mode",
14
+ "alias": "m",
15
+ "description": "指定同步模块的模式,是否本地同步",
16
+ "default": false
17
+ }
18
+ ]
19
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "executor": "executeUuid",
3
+ "description": "生成 UUID 的值,可直接拷贝",
4
+ "command": "uuid",
5
+ "options": [
6
+ {
7
+ "name": "number",
8
+ "alias": "n",
9
+ "description": "生成 UUID 的数量,默认 1 个",
10
+ "default": 1
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "executor": "executeWeb",
3
+ "description": "(前端)创建一个新的 Zero Ui 的脚手架!",
4
+ "command": "web",
5
+ "options": [
6
+ {
7
+ "name": "name",
8
+ "alias": "n",
9
+ "description": "创建 Web 应用的名称!"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,20 @@
1
+ const Ec = require('../epic');
2
+ const os = require('os');
3
+ const Ut = require("../commander-shared");
4
+ module.exports = (options) => {
5
+ const metadata = Ut.parseMetadata();
6
+ metadata.forEach(runner => {
7
+ Ec.execute(`命令:` + `ai ${runner.command} [-options]`.green);
8
+ Ec.execute(`说明:${runner.description}`.yellow);
9
+ runner.options.forEach(option => {
10
+ if (option.hasOwnProperty('default')) {
11
+ const str = option.default + '';
12
+ Ec.execute(`\t-${option.alias},--${option.name}`.red + `\t${option.description}, 默认值:\uD83C\uDF37 ` + str.blue);
13
+ } else {
14
+ Ec.execute(`\t-${option.alias},--${option.name}`.red + `\t${option.description}`);
15
+ }
16
+ })
17
+ Ec.execute();
18
+ });
19
+ Ec.info("命令执行完成!")
20
+ }
@@ -1,28 +1,22 @@
1
1
  const Ec = require('../epic');
2
2
  const os = require('os');
3
+ const Ut = require("../commander-shared");
3
4
 
4
5
  const os_compatible = ['darwin', 'win32'];
5
6
 
6
- module.exports = () => {
7
- /*
8
- * 参数解析
9
- */
10
- const actual = Ec.executeInput(
11
- ['-i', '--input'],
12
- [
13
- ["-i", "--input"]
14
- ]
15
- );
7
+ module.exports = (options) => {
8
+ const parsed = Ut.parseArgument(options);
16
9
  /*
17
10
  * 基本信息
18
11
  */
19
- const input = actual.input;
12
+ const input = parsed.input;
20
13
  const platform = os.platform();
21
14
  Ec.info(`当前操作系统:${platform}`);
22
15
 
23
16
  if (os_compatible.indexOf(platform) > -1) {
24
17
  const content = Ec.strMD5(input);
25
- console.info(content);
18
+ Ec.execute(`明文值:${input}`)
19
+ Ec.execute(`加密值:${content}`);
26
20
  Ec.outCopy(content)
27
21
  .then(sign => Ec.info(`加密的字符串已经成功拷贝到剪切板中!`))
28
22
  } else {
@@ -1,25 +1,19 @@
1
1
  const Ec = require('../epic');
2
2
  const os = require('os');
3
+ const Ut = require("../commander-shared");
3
4
 
4
5
  const os_compatible = ['darwin', 'win32'];
5
6
 
6
- module.exports = () => {
7
+ module.exports = (options) => {
7
8
  /*
8
9
  * 参数解析
9
10
  */
10
- const actual = Ec.executeInput(
11
- [],
12
- [
13
- ['-n', '--number', 1],
14
- ['-l', '--length', 64],
15
- ['-f', '--full', false]
16
- ]
17
- );
11
+ const parsed = Ut.parseArgument(options);
18
12
  /*
19
13
  * 基本信息
20
14
  */
21
- const number = actual.number;
22
- const length = actual.length;
15
+ const number = parsed.number;
16
+ const length = parsed.length;
23
17
  const platform = os.platform();
24
18
  Ec.info(`随机字符串,生成数量:${number},长度:${length}`);
25
19
  Ec.info(`当前操作系统:${platform}`);
@@ -27,8 +21,8 @@ module.exports = () => {
27
21
  if (os_compatible.indexOf(platform) > -1) {
28
22
  const content = [];
29
23
  for (let idx = 0; idx < number; idx++) {
30
- const generated = Ec.strRandom(length, actual.full);
31
- console.info(generated);
24
+ const generated = Ec.strRandom(length, parsed.full);
25
+ Ec.execute(generated);
32
26
  content.push(generated);
33
27
  }
34
28
  Ec.outCopy(content.join('\n'))
@@ -1,22 +1,18 @@
1
1
  const Ec = require('../epic');
2
+ const Ut = require("../commander-shared");
2
3
  const os = require('os');
3
4
 
4
5
  const os_compatible = ['darwin', 'win32'];
5
6
 
6
- module.exports = () => {
7
+ module.exports = (options) => {
7
8
  /*
8
9
  * 参数解析
9
10
  */
10
- const actual = Ec.executeInput(
11
- [],
12
- [
13
- ['-n', '--number', 20]
14
- ]
15
- );
11
+ const parsed = Ut.parseArgument(options);
16
12
  /*
17
13
  * 基本信息
18
14
  */
19
- const number = actual.number;
15
+ const number = parsed.number;
20
16
  const platform = os.platform();
21
17
  Ec.info(`UUID生成器,生成数量:${number}`);
22
18
  Ec.info(`当前操作系统:${platform}`);
@@ -24,7 +20,7 @@ module.exports = () => {
24
20
  const content = [];
25
21
  for (let idx = 0; idx < number; idx++) {
26
22
  const generated = Ec.strUuid();
27
- console.info(generated);
23
+ Ec.execute(generated);
28
24
  content.push(generated);
29
25
  }
30
26
  Ec.outCopy(content.join('\n'))
@@ -0,0 +1,20 @@
1
+ const Ec = require("../epic");
2
+ const Ut = require("../commander-shared");
3
+
4
+ module.exports = (options) => {
5
+ /*
6
+ * 参数解析
7
+ */
8
+ const parsed = Ut.parseArgument(options);
9
+ /*
10
+ * 基本信息验证
11
+ */
12
+ if (!Ut.nameValid(parsed.name)) {
13
+ Ec.error("应用名称只能包含字母、数字、点(.)和短横线(-),且不能以数字、点(.)或短横线(-)开头!");
14
+ process.exit(1);
15
+ }
16
+ const configuration = Ut.initAppConfiguration(parsed);
17
+ Ec.info(`准备生成 Zero App 应用:${configuration.artifactId}`);
18
+ configuration.srcType = Symbol("APP");
19
+ Ut.initApp(configuration).then(() => Ec.info(`应用生成完成!`));
20
+ }
@@ -0,0 +1,106 @@
1
+ const Ec = require("../epic");
2
+ const Ut = require("../commander-shared");
3
+ const child = require('child_process');
4
+ module.exports = (options) => {
5
+ const parsed = Ut.parseArgument(options);
6
+ // 第一步:环境检查
7
+ if (Ec.isExist(".git")) {
8
+ Ec.error("请选择不带`.git`或`vertx-ui`的目录执行当前命令,最好使用空目录!");
9
+ return;
10
+ }
11
+ // 第二步:检查 vertx-ui
12
+ const target = parsed.name;
13
+ Ec.info(`工程构建目录:${target}`);
14
+ const cmd = `git clone https://gitee.com/silentbalanceyh/scaffold-ui.git ${target}`;
15
+ child.execSync(cmd, {stdio: 'inherit'});
16
+ // 删除目标目录中的 .git 文件夹
17
+ Ec.info(`执行工程初始化:${target}`);
18
+ const cmdGit = `rm -rf ${target}/.git`;
19
+ child.execSync(cmdGit, {stdio: 'inherit'});
20
+ // 读取目标目录
21
+ const content = Ec.ioJObject(`${target}/package.json`);
22
+ content.name = target;
23
+ Ec.outJson(`${target}/package.json`, content, true);
24
+ // 后期脚本
25
+ const commands = [
26
+ `rm -rf ${target}/.zero/*`,
27
+ `rm -rf ${target}/document/doc-web`,
28
+ `rm -rf ${target}/guide/`,
29
+ `rm -rf ${target}/_config.yml`,
30
+ `rm -rf ${target}/CNAME`,
31
+ `rm -rf ${target}/data.json`,
32
+ `rm -rf ${target}/LICENSE`,
33
+ `rm -rf ${target}/package-lock.json`,
34
+ `rm -rf ${target}/yarn.lock`,
35
+ `rm -rf ${target}/run-cache.sh`,
36
+ `rm -rf ${target}/run-ux.sh`,
37
+ `rm -rf ${target}/run-zero-dependency.sh`,
38
+ `rm -rf ${target}/SUMMARY.md`,
39
+ ]
40
+ Ec.info(`执行后期处理:......`.yellow);
41
+ commands.forEach(command => {
42
+ Ec.info(`资源清理中:${command.prompt}`);
43
+ child.execSync(command, {stdio: 'inherit'})
44
+ });
45
+ // 重铸 .gitignore 文件
46
+ Ec.info(`重铸 .gitignore`);
47
+ child.execSync(`mv ${target}/.gitignore.tpl ${target}/.gitignore`, {stdio: 'inherit'})
48
+ Ec.info(`工程初始化完成:${target},您可以开始您的Zero Ui之行了!`.help);
49
+ }
50
+ /**
51
+ * ## `ai init`
52
+ *
53
+ * ### 1. 命令
54
+ *
55
+ * ```shell
56
+ * ai init -name <name>
57
+ * ```
58
+ *
59
+ * |短参|全参|类型|默认|含义|
60
+ * |---|---|---|---|:---|
61
+ * |-n|--name|String|(无)|项目名称以及目录名称。|
62
+ *
63
+ * ### 2. 介绍
64
+ *
65
+ * vertx-ui项目脚手架初始化专用命令。
66
+ *
67
+ * ### 3. 执行
68
+ *
69
+ * ```shell
70
+ * ai init -name test-demo
71
+ * [Zero AI] Zero AI 代码生成工具 : <标准工具>
72
+ * [Zero AI] HomePage : http://www.vertxai.cn
73
+ * [Zero AI] Github : https://github.com/silentbalanceyh/vertx-ai.git
74
+ * [Zero AI] Version : 0.3.2 「确认您的Node版本 ( >= 14.x ) 支持ES6, ES7.」
75
+ * [Zero AI] Zero AI 系统启动......
76
+ * [Zero AI] Zero AI 加载输入参数:
77
+ * {
78
+ "name": "test-demo"
79
+ * }
80
+ * [Zero AI] 工程构建目录:test-demo
81
+ * Cloning into 'test-demo'...
82
+ * remote: Enumerating objects: 888, done.
83
+ * remote: Counting objects: 100% (888/888), done.
84
+ * remote: Compressing objects: 100% (538/538), done.
85
+ * remote: Total 36593 (delta 445), reused 610 (delta 339), pack-reused 35705
86
+ * Receiving objects: 100% (36593/36593), 29.09 MiB | 151.00 KiB/s, done.
87
+ * Resolving deltas: 100% (24009/24009), done.
88
+ * [Zero AI] 执行工程初始化:test-demo
89
+ * [Zero AI] (Sync)成功将数据写入到文件:test-demo/package.json!
90
+ * [Zero AI] 执行后期处理:......
91
+ * [Zero AI] 资源清理中:rm -rf test-demo/.zero/*
92
+ * [Zero AI] 资源清理中:rm -rf test-demo/document/doc-web/*
93
+ * [Zero AI] 资源清理中:rm -rf test-demo/document/doc-web-extension/*
94
+ * [Zero AI] 资源清理中:rm -rf test-demo/guide/
95
+ * [Zero AI] 资源清理中:rm -rf test-demo/_config.yml
96
+ * [Zero AI] 资源清理中:rm -rf test-demo/CNAME
97
+ * [Zero AI] 资源清理中:rm -rf test-demo/data.json
98
+ * [Zero AI] 资源清理中:rm -rf test-demo/LICENSE
99
+ * [Zero AI] 资源清理中:rm -rf test-demo/package-lock.json
100
+ * [Zero AI] 资源清理中:rm -rf test-demo/yarn.lock
101
+ * [Zero AI] 工程初始化完成:test-demo,您可以开始您的Zero Ui之行了!
102
+ * ```
103
+ *
104
+ * @memberOf module:ai
105
+ * @method init
106
+ */
@@ -0,0 +1,15 @@
1
+ const Ec = require("../epic");
2
+ const Ut = require("../commander-shared");
3
+
4
+ module.exports = (options) => {
5
+ /*
6
+ * 参数解析
7
+ */
8
+ const parsed = Ut.parseArgument(options);
9
+ /*
10
+ * 基本信息验证
11
+ */
12
+ const configuration = Ut.initModuleConfiguration(parsed);
13
+ Ec.info(`准备生成 Zero Extension 扩展模块:${configuration.artifactId}`);
14
+ Ut.initMod(configuration).then(() => Ec.info(`模块生成完成!`));
15
+ }
@@ -0,0 +1,20 @@
1
+ const Ec = require("../epic");
2
+ const Ut = require("../commander-shared");
3
+
4
+ module.exports = (options) => {
5
+ /*
6
+ * 参数解析
7
+ */
8
+ const parsed = Ut.parseArgument(options);
9
+ /*
10
+ * 基本信息验证
11
+ */
12
+ if (!Ut.nameValid(parsed.name)) {
13
+ Ec.error("应用名称只能包含字母、数字、点(.)和短横线(-),且不能以数字、点(.)或短横线(-)开头!");
14
+ process.exit(1);
15
+ }
16
+ const configuration = Ut.initSpringConfiguration(parsed);
17
+ Ec.info(`准备生成 Rapid Spring App 应用:${configuration.artifactId}`);
18
+ configuration.srcType = Symbol("SPRING");
19
+ Ut.initSpring(configuration).then(() => Ec.info(`应用生成完成!`));
20
+ }
@@ -1,5 +1,6 @@
1
1
  const Ec = require("../epic");
2
2
  const child = require('child_process');
3
+ const Ut = require("../commander-shared");
3
4
 
4
5
  const COMMANDS = [
5
6
  "run-default.sh",
@@ -88,29 +89,23 @@ const executeLocal = (actual = {}, options = {}) => {
88
89
  return pathEnv;
89
90
  }
90
91
 
91
- module.exports = () => {
92
+ module.exports = (options) => {
92
93
 
93
94
  // 获取当前操作系统
94
95
  const platform = process.platform;
95
96
 
96
97
  // 根据操作系统设置不同的 options 对象
97
- let options;
98
+ let optionsWait;
98
99
  if (platform === 'win32') {
99
100
  // Windows 系统,使用指定的命令解释器
100
101
  Ec.info(`您正在使用WINDOWS系统,请使用随git附带的bash运行此脚本!`.red.bgYellow);
101
- options = {stdio: 'inherit', shell: 'bash.exe'};
102
+ optionsWait = {stdio: 'inherit', shell: 'bash.exe'};
102
103
  } else {
103
104
  // 非 Windows 系统,不需要额外的 options
104
- options = {stdio: 'inherit'};
105
+ optionsWait = {stdio: 'inherit'};
105
106
  }
106
107
 
107
- const actual = Ec.executeInput(
108
- [],
109
- [
110
- ['-p', '--path', '.zero'],
111
- ['-m', '--module', false] // 是否本地模式
112
- ]
113
- );
108
+ const parsed = Ut.parseArgument(options);
114
109
  // 1. 环境检查
115
110
  if (!Ec.isExist(".git")) {
116
111
  Ec.error("请选择带`.git`或`vertx-ui`的目录执行当前命令!");
@@ -118,12 +113,12 @@ module.exports = () => {
118
113
  }
119
114
 
120
115
  let pathSource;
121
- if (actual.module) {
116
+ if (parsed.mode) {
122
117
  // 本地模式
123
- pathSource = executeLocal(actual, options);
118
+ pathSource = executeLocal(parsed, optionsWait);
124
119
  } else {
125
120
  // 远程模式
126
- pathSource = executeRemote(actual, options);
121
+ pathSource = executeRemote(parsed, optionsWait);
127
122
  }
128
123
  if (pathSource) {
129
124
  // 5. 拷贝 Ignore 文件全部指令
@@ -135,14 +130,14 @@ module.exports = () => {
135
130
  // 目录拷贝
136
131
  if (!Ec.isExist(command)) {
137
132
  const cmdDir = `mkdir -p ${command}`;
138
- child.execSync(cmdDir, options);
133
+ child.execSync(cmdDir, optionsWait);
139
134
  }
140
135
  cmd = `cp -rf ${pathSource}/${command}* ./${command}`;
141
- child.execSync(cmd, options);
136
+ child.execSync(cmd, optionsWait);
142
137
  } else {
143
138
  // 文件拷贝
144
139
  cmd = `cp -rf ${pathSource}/${command} ./${command}`;
145
- child.execSync(cmd, options);
140
+ child.execSync(cmd, optionsWait);
146
141
  }
147
142
  })
148
143
  Ec.info(`主框架更新完成:${pathSource}!`.help);
@@ -1,22 +1,22 @@
1
- const executeUuid = require('./fn.uuid');
2
- const executeCsv = require('./fn.csv');
3
- const executeUk = require('./fn.uk');
4
- const executeKey = require('./fn.key');
5
- const executeData = require('./fn.data');
6
- const executeInit = require('./fn.init');
7
- const executeString = require('./fn.random');
8
- const executeMD5 = require('./fn.md5');
9
- const executeSync = require('./fn.sync');
1
+ const executeUuid = require('./fn.random.uuid');
2
+ const executeString = require('./fn.random.string');
3
+ const executeMD5 = require('./fn.random.md5');
4
+ const executeFrontendSync = require('./fn.source.sync');
5
+ const executeApp = require('./fn.source.app');
6
+ const executeMod = require('./fn.source.mod');
7
+ const executeHelp = require('./fn.help.metadata');
8
+ const executeWeb = require('./fn.source.front');
9
+ const executeSpring = require('./fn.source.spring');
10
10
  const exported = {
11
- executeUuid, // ai uuid
12
- executeCsv, // ai csv
13
- executeUk, // ai uk
14
- executeKey, // ai key
15
- executeData, // ai data
16
- executeInit, // ai init
17
- executeString, // ai str
18
- executeMD5, // ai md5
19
- executeSync, // ai sync
11
+ executeUuid, // ai uuid
12
+ executeString, // ai str
13
+ executeMD5, // ai md5
14
+ executeFrontendSync, // ai sync
15
+ executeApp, // ai app
16
+ executeMod, // ai mod
17
+ executeHelp, // ai help
18
+ executeWeb, // ai web
19
+ executeSpring, // ai spring
20
20
  };
21
21
  module.exports = exported;
22
22
  /**
@@ -37,14 +37,11 @@ module.exports = exported;
37
37
  * |命令执行|含义|
38
38
  * |---|:---|
39
39
  * |ai uuid|(M) 随机生成一定数量的UUID字符串|
40
- * |ai csv|读取数据文件中的Array数组数据,然后转换成csv的文件格式输出。|
41
- * |ai uk|检查数据文件中的 Data 数据是否符合唯一性约束,可直接针对批量数据执行唯一性检查。|
42
- * |ai data|专用数据生成器,可根据您的输入生成两个格式的Json数据:`Object/Array`。|
43
- * |ai key|为输入数据中的Array或Object追加`UUID`格式的字段,字段可配置,默认为`field = key`属性。|
44
40
  * |ai str|(M) 生成随机字符串。
45
41
  * |ai md5|(M) 针对输入字符串进行符合 Zero 规范的 MD5 加密处理。|
46
- * |ai init|「工程命令」Zero前端工程初始化专用命令。|
47
42
  * |ai sync|「工程命令」Zero前端工程框架同步专用命令(更新Zero Ui框架专用)。|
43
+ * |ai app| 应用工程初始化。|
44
+ * |ai mod| 扩展模块初始化(Domain/Provider/Api)。|
48
45
  *
49
46
  * ### 3. 数据通用格式
50
47
  *