zero-ai 0.3.35 → 1.0.48

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 (47) hide show
  1. package/README.md +16 -1
  2. package/package.json +1 -1
  3. package/src/_template/MODULE/database/database-reinit.sh +1 -1
  4. package/src/_template/SPRING/database/init-db.sh +2 -2
  5. package/src/_template/SPRING/mvn-build.sh +1 -1
  6. package/src/_template/SPRING/pom.xml.ejs +4 -21
  7. package/src/_template/SPRING/source-api/pom.xml.ejs +1 -2
  8. package/src/_template/SPRING/source-domain/pom.xml.ejs +0 -1
  9. package/src/_template/ZERO/.placeholder +0 -0
  10. package/src/_template/ZERO/app.env.ejs +96 -0
  11. package/src/_template/ZERO/database/database-account.sql.ejs +3 -0
  12. package/src/_template/ZERO/database/database-reinit-history.sql.ejs +5 -0
  13. package/src/_template/ZERO/database/database-reinit-workflow.sql.ejs +5 -0
  14. package/src/_template/ZERO/database/database-reinit.sql.ejs +5 -0
  15. package/src/_template/ZERO/database/init-db.sh +49 -0
  16. package/src/_template/ZERO/mvn-build.sh +3 -0
  17. package/src/_template/ZERO/pom.xml.ejs +24 -0
  18. package/src/_template/ZERO/source-api/AppDev.java.ejs +13 -0
  19. package/src/_template/ZERO/source-api/Application.java.ejs +11 -0
  20. package/src/_template/ZERO/source-api/env.properties.ejs +18 -0
  21. package/src/_template/ZERO/source-api/flyway.conf +6 -0
  22. package/src/_template/ZERO/source-api/pom.xml.ejs +24 -0
  23. package/src/_template/ZERO/source-api/vertx.yml.ejs +70 -0
  24. package/src/_template/ZERO/source-domain/ModuleGeneration.java.ejs +8 -0
  25. package/src/_template/ZERO/source-domain/mvn-db.sh +5 -0
  26. package/src/_template/ZERO/source-domain/pom.xml.ejs +20 -0
  27. package/src/_template/ZERO/source-provider/ModuleSource.java.ejs +14 -0
  28. package/src/_template/ZERO/source-provider/pom.xml.ejs +21 -0
  29. package/src/_template/ZERO/source-test/pom.xml.ejs +28 -0
  30. package/src/_template/version +5 -0
  31. package/src/commander/zero.json +24 -0
  32. package/src/commander-ai/fn.source.spring.js +11 -7
  33. package/src/commander-ai/fn.source.zero.js +24 -0
  34. package/src/commander-ai/index.js +5 -4
  35. package/src/commander-shared/ai.fn.initialize.__.io.util.js +42 -37
  36. package/src/commander-shared/ai.fn.initialize.__.module.directory.js +63 -0
  37. package/src/commander-shared/ai.fn.initialize.__.module.file.js +81 -0
  38. package/src/commander-shared/ai.fn.initialize.__.spring.file.js +0 -1
  39. package/src/commander-shared/ai.fn.initialize.__.zero.directory.js +22 -9
  40. package/src/commander-shared/ai.fn.initialize.__.zero.file.js +93 -50
  41. package/src/commander-shared/ai.fn.initialize.module.js +1 -1
  42. package/src/commander-shared/ai.fn.initialize.spring.js +8 -3
  43. package/src/commander-shared/ai.fn.initialize.zero.js +84 -0
  44. package/src/commander-shared/ai.fn.parse.argument.js +9 -1
  45. package/src/commander-shared/index.js +2 -0
  46. /package/src/{commander → cab/removed}/app.json +0 -0
  47. /package/src/{commander → cab/removed}/mod.json +0 -0
@@ -0,0 +1,84 @@
1
+ const fs = require("fs");
2
+ const Ec = require("../epic");
3
+ const IoUt = require("./ai.fn.initialize.__.io.util");
4
+ const Io = require("./ai.fn.initialize.__.zero.directory");
5
+ const initZeroConfiguration = async (parsed = {}) => {
6
+ Ec.execute(`初始化 Zero 项目,${`zero-ecotope`.green} 版本:${parsed.versionZero.red}`);
7
+ const name = parsed.name;
8
+ const configuration = IoUt.ioConfiguration(parsed, name);
9
+ configuration.groupId = "io.zerows.apps";
10
+ const appName = IoUt.ioAppName(name);
11
+ configuration.srcPackage = `io.zerows.apps.zero.${appName}`;
12
+ configuration.srcId = appName;
13
+ configuration.srcType = Symbol("ZERO");
14
+
15
+ configuration.dbName = "DB_ZERO_" + appName.toUpperCase();
16
+ configuration.dbUser = appName;
17
+ configuration.dbPassword = appName;
18
+ configuration.dbHost = "localhost";
19
+ configuration.dbPort = 3306;
20
+
21
+ configuration.framework = parsed.versionZero || "1.0.0";
22
+ await IoUt.ioApp(configuration);
23
+ configuration.appName = configuration.id;
24
+ // tenant, sigma, appId
25
+ // 三个库的相关设置
26
+ if(!configuration.appNs){
27
+ configuration.appNs = configuration.group;
28
+ }
29
+ if(!configuration.appTenant){
30
+ configuration.appTenant = Ec.strUuid();
31
+ }
32
+ if(!configuration.appSigma){
33
+ configuration.appSigma = Ec.strRandom(32);
34
+ }
35
+ if(!configuration.appId){
36
+ configuration.appId = Ec.strUuid();
37
+ }
38
+ return configuration;
39
+ }
40
+ const initZero = async (configuration = {}) => {
41
+ // 1. 先创建基本目录
42
+ Ec.execute("----------- 目录创建 -----------");
43
+ const baseDir = configuration.srcOut;
44
+ const created = await Io.ioDPAZeroStructure(baseDir, configuration);
45
+ if (!(created.every(item => true === item))) {
46
+ Ec.error(`目录初始化异常:${configuration.srcOut}`)
47
+ }
48
+
49
+ Ec.execute("----------- 文件生成 -----------");
50
+ // 2. 每个项目 pom.xml 文件初始化
51
+ const type = configuration.srcType;
52
+ const sourceTpl = Ec.ioRoot() + "/_template/" + type.description;
53
+ const genPom = await Io.ioDPAZeroPom(sourceTpl, configuration);
54
+ if (!genPom) {
55
+ Ec.error(`pom.xml 文件生成异常:${configuration.srcOut}`)
56
+ }
57
+
58
+ // 3. 数据库文件初始化
59
+ Ec.execute("----------- 数据库初始化 -----------");
60
+ const genDatabase = await Io.ioZeroDatabase(sourceTpl, configuration);
61
+ if (!genDatabase) {
62
+ Ec.error(`数据库文件生成异常:${configuration.srcOut}`)
63
+ }
64
+
65
+ // 4. 代码生成文件初始化
66
+ Ec.execute("----------- 代码生成 -----------");
67
+ const genModule = await Io.ioZeroConfiguration(sourceTpl, configuration);
68
+ if (!genModule) {
69
+ Ec.error(`配置文件生成异常:${configuration.srcOut}`)
70
+ }
71
+ const genSource = await Io.ioZeroSource(sourceTpl, configuration);
72
+ if (!genSource) {
73
+ Ec.error(`源代码文件生成异常:${configuration.srcOut}`)
74
+ }
75
+ // 5. 权限变更
76
+ const genChmod = await IoUt.ioChmod(configuration.srcOut + "/" + configuration.artifactId);
77
+ if (!genChmod) {
78
+ Ec.error(`权限变更异常:${configuration.srcOut}`)
79
+ }
80
+ }
81
+ module.exports = {
82
+ initZeroConfiguration,
83
+ initZero,
84
+ }
@@ -68,7 +68,6 @@ const parseArgument = (options = []) => {
68
68
  }
69
69
  }
70
70
  });
71
-
72
71
  return result;
73
72
  }
74
73
  const parseMetadata = () => {
@@ -86,7 +85,16 @@ const parseMetadata = () => {
86
85
  });
87
86
  return commandList;
88
87
  }
88
+ const parseVersion = async (result) => {
89
+ const versionPath = Ec.ioRoot() + "/_template/version";
90
+ const versionJ = Ec.ioJObject(versionPath);
91
+ result.versionMomo = versionJ?.momo;
92
+ result.versionR2mo = versionJ?.r2mo;
93
+ result.versionZero = versionJ?.zero;
94
+ return result;
95
+ }
89
96
  module.exports = {
97
+ parseVersion,
90
98
  parseArgument,
91
99
  parseMetadata
92
100
  }
@@ -2,11 +2,13 @@ const _ARGS = require("./ai.fn.parse.argument");
2
2
  const _MODS = require("./ai.fn.initialize.module");
3
3
  const _APPS = require("./ai.fn.initialize.app");
4
4
  const _SPRING = require("./ai.fn.initialize.spring");
5
+ const _ZERO = require("./ai.fn.initialize.zero");
5
6
  module.exports = {
6
7
  ..._ARGS,
7
8
  ..._MODS,
8
9
  ..._APPS,
9
10
  ..._SPRING,
11
+ ..._ZERO,
10
12
  nameValid: (str) => {
11
13
  if (typeof str !== 'string' || str.length === 0) {
12
14
  return false;
File without changes
File without changes