zero-ai 0.3.25
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.
- package/CNAME +1 -0
- package/README.md +54 -0
- package/SUMMARY.md +15 -0
- package/_config.yml +1 -0
- package/_layouts/default.html +60 -0
- package/_sass/jekyll-theme-dinky.scss +440 -0
- package/_sass/rouge-github.scss +209 -0
- package/assets/css/style.scss +4 -0
- package/assets/images/arrow-down.png +0 -0
- package/assets/images/octocat-small.png +0 -0
- package/assets/js/scale.fix.js +20 -0
- package/configs/sorts.json +38 -0
- package/document/doc-config/jsdoc.json +89 -0
- package/document/doc-config/third-part/esdoc.json +9 -0
- package/document/doc-config/third-part/yuidoc-example.json +23 -0
- package/document/doc-config/third-part/yuidoc.json +11 -0
- package/document/doc-config/tpl/publish.js +778 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/document/doc-config/tpl/static/scripts/collapse.js +20 -0
- package/document/doc-config/tpl/static/scripts/linenumber.js +25 -0
- package/document/doc-config/tpl/static/scripts/nav.js +12 -0
- package/document/doc-config/tpl/static/scripts/polyfill.js +4 -0
- package/document/doc-config/tpl/static/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/document/doc-config/tpl/static/scripts/prettify/lang-css.js +2 -0
- package/document/doc-config/tpl/static/scripts/prettify/prettify.js +28 -0
- package/document/doc-config/tpl/static/scripts/search.js +83 -0
- package/document/doc-config/tpl/static/styles/jsdoc.css +765 -0
- package/document/doc-config/tpl/static/styles/prettify.css +79 -0
- package/document/doc-config/tpl/static/styles/zero.css +50 -0
- package/document/doc-config/tpl/tmpl/augments.tmpl +10 -0
- package/document/doc-config/tpl/tmpl/container.tmpl +197 -0
- package/document/doc-config/tpl/tmpl/details.tmpl +148 -0
- package/document/doc-config/tpl/tmpl/example.tmpl +2 -0
- package/document/doc-config/tpl/tmpl/examples.tmpl +13 -0
- package/document/doc-config/tpl/tmpl/exceptions.tmpl +32 -0
- package/document/doc-config/tpl/tmpl/layout.tmpl +98 -0
- package/document/doc-config/tpl/tmpl/mainpage.tmpl +15 -0
- package/document/doc-config/tpl/tmpl/members.tmpl +38 -0
- package/document/doc-config/tpl/tmpl/method.tmpl +138 -0
- package/document/doc-config/tpl/tmpl/modifies.tmpl +14 -0
- package/document/doc-config/tpl/tmpl/params.tmpl +132 -0
- package/document/doc-config/tpl/tmpl/properties.tmpl +107 -0
- package/document/doc-config/tpl/tmpl/returns.tmpl +19 -0
- package/document/doc-config/tpl/tmpl/source.tmpl +8 -0
- package/document/doc-config/tpl/tmpl/tutorial.tmpl +19 -0
- package/document/doc-config/tpl/tmpl/type.tmpl +7 -0
- package/document/doc-config/tpl/zero.css +0 -0
- package/document/doc-web/E.html +395 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/document/doc-web/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/document/doc-web/index.html +262 -0
- package/document/doc-web/module-_debug.html +1104 -0
- package/document/doc-web/module-_epic.html +1631 -0
- package/document/doc-web/module-ai.html +1701 -0
- package/document/doc-web/module-aj.html +1081 -0
- package/document/doc-web/scripts/collapse.js +20 -0
- package/document/doc-web/scripts/linenumber.js +25 -0
- package/document/doc-web/scripts/nav.js +12 -0
- package/document/doc-web/scripts/polyfill.js +4 -0
- package/document/doc-web/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/document/doc-web/scripts/prettify/lang-css.js +2 -0
- package/document/doc-web/scripts/prettify/prettify.js +28 -0
- package/document/doc-web/scripts/search.js +83 -0
- package/document/doc-web/styles/jsdoc.css +765 -0
- package/document/doc-web/styles/prettify.css +79 -0
- package/document/doc-web/styles/zero.css +50 -0
- package/document/markdown/README.md +0 -0
- package/document/markdown/gong-cheng-chu-shi-hua.md +79 -0
- package/document/markdown/t0002-uuidsheng-cheng-qi.md +142 -0
- package/document/markdown/t0003-shu-ju-mo-ni-qi.md +135 -0
- package/document/markdown/t0004-zerode-fu-wu-tong-xun-fen-xi-qi.md +64 -0
- package/document/markdown/t0005-liquibaseshu-ju-zhuan-huan-qi.md +68 -0
- package/document/markdown/zt0001-pagecardchuang-jian.md +71 -0
- package/document/markdown/zt0002-formchuang-jian.md +81 -0
- package/document/markdown/zt0003-tian-jia-card-an-niu.md +115 -0
- package/document/markdown/zt0004-chu-li-modal-zhe-zhao-xiao-guo.md +105 -0
- package/document/markdown/ztgong-ju.md +0 -0
- package/install-local.sh +3 -0
- package/package.json +53 -0
- package/run-authorize.sh +32 -0
- package/run-doc.sh +16 -0
- package/run-update.sh +6 -0
- package/script/bootstrap +6 -0
- package/script/cibuild +9 -0
- package/script/release +42 -0
- package/script/validate-html +28 -0
- package/script/zrun-doc-generate.sh +18 -0
- package/script/zrun-doc-server.sh +13 -0
- package/src/ai.js +11 -0
- package/src/aj.js +11 -0
- package/src/art.js +11 -0
- package/src/cab/form/UI.js.tpl +50 -0
- package/src/cab/form/UI.json.tpl +38 -0
- package/src/cab/list/Op.js.tpl +42 -0
- package/src/cab/list/UI.Add.json.tpl +32 -0
- package/src/cab/list/UI.Edit.json.tpl +34 -0
- package/src/cab/list/UI.Filter.json.tpl +29 -0
- package/src/cab/list/UI.Form.js.tpl +64 -0
- package/src/cab/list/UI.js.tpl +49 -0
- package/src/cab/list/UI.json.tpl +208 -0
- package/src/cab/perm/falcon.app.xlsx +0 -0
- package/src/cab/perm/falcon.authority.resource.perm.xlsx +0 -0
- package/src/cab/perm/falcon.authority.resource.resource.xlsx +0 -0
- package/src/cab/perm/falcon.authority.role.action.xlsx +0 -0
- package/src/cab/perm/falcon.authority.view.xlsx +0 -0
- package/src/cab/perm/falcon.battery.module.xlsx +0 -0
- package/src/cab/perm/falcon.epic.form.xlsx +0 -0
- package/src/cab/perm/falcon.epic.integration.xlsx +0 -0
- package/src/cab/perm/falcon.epic.modeling.entity.xlsx +0 -0
- package/src/cab/perm/falcon.epic.modeling.field.xlsx +0 -0
- package/src/cab/perm/falcon.epic.modeling.global.xlsx +0 -0
- package/src/cab/perm/falcon.epic.modeling.model.xlsx +0 -0
- package/src/cab/perm/falcon.epic.page.xlsx +0 -0
- package/src/cab/perm/falcon.epic.topology.xlsx +0 -0
- package/src/cab/perm/falcon.fm.bank.xlsx +0 -0
- package/src/cab/perm/falcon.fm.bill.process.xlsx +0 -0
- package/src/cab/perm/falcon.fm.book.xlsx +0 -0
- package/src/cab/perm/falcon.fm.currency.xlsx +0 -0
- package/src/cab/perm/falcon.fm.debt.xlsx +0 -0
- package/src/cab/perm/falcon.fm.settlement.xlsx +0 -0
- package/src/cab/perm/falcon.fm.subject.xlsx +0 -0
- package/src/cab/perm/falcon.fm.term.xlsx +0 -0
- package/src/cab/perm/falcon.i.directory.xlsx +0 -0
- package/src/cab/perm/falcon.i.integration.xlsx +0 -0
- package/src/cab/perm/falcon.lbs.city.xlsx +0 -0
- package/src/cab/perm/falcon.lbs.floor.xlsx +0 -0
- package/src/cab/perm/falcon.lbs.query.xlsx +0 -0
- package/src/cab/perm/falcon.lbs.state.xlsx +0 -0
- package/src/cab/perm/falcon.lbs.tent.xlsx +0 -0
- package/src/cab/perm/falcon.login.index.xlsx +0 -0
- package/src/cab/perm/falcon.my.menu.xlsx +0 -0
- package/src/cab/perm/falcon.organization.brand.xlsx +0 -0
- package/src/cab/perm/falcon.organization.company.xlsx +0 -0
- package/src/cab/perm/falcon.organization.contract.xlsx +0 -0
- package/src/cab/perm/falcon.organization.customer.xlsx +0 -0
- package/src/cab/perm/falcon.organization.dept.team.xlsx +0 -0
- package/src/cab/perm/falcon.organization.dept.xlsx +0 -0
- package/src/cab/perm/falcon.organization.employee.identity.xlsx +0 -0
- package/src/cab/perm/falcon.organization.employee.xlsx +0 -0
- package/src/cab/perm/falcon.organization.project.xlsx +0 -0
- package/src/cab/perm/falcon.psi.pos.xlsx +0 -0
- package/src/cab/perm/falcon.psi.wh.xlsx +0 -0
- package/src/cab/perm/falcon.rbac.group.xlsx +0 -0
- package/src/cab/perm/falcon.rbac.role.xlsx +0 -0
- package/src/cab/perm/falcon.rbac.user.xlsx +0 -0
- package/src/cab/perm/falcon.system.document.xlsx +0 -0
- package/src/cab/perm/falcon.system.job.xlsx +0 -0
- package/src/cab/perm/falcon.system.report.xlsx +0 -0
- package/src/cab/perm/falcon.system.sync_log.xlsx +0 -0
- package/src/cab/perm/falcon.system.todo.xlsx +0 -0
- package/src/cab/perm/falcon.system.workflow.xlsx +0 -0
- package/src/cab/perm/falcon.ui.app.xlsx +0 -0
- package/src/cab/perm/falcon.view.personal.xlsx +0 -0
- package/src/cab/perm/falcon.x.activity.xlsx +0 -0
- package/src/cab/perm/falcon.x.attachment.xlsx +0 -0
- package/src/cab/perm/falcon.x.category.xlsx +0 -0
- package/src/cab/perm/falcon.x.integration.xlsx +0 -0
- package/src/cab/perm/falcon.x.linkage.xlsx +0 -0
- package/src/cab/perm/falcon.x.menu.xlsx +0 -0
- package/src/cab/perm/falcon.x.notice.xlsx +0 -0
- package/src/cab/perm/falcon.x.tabular.xlsx +0 -0
- package/src/cab/perm/falcon.x.tag.xlsx +0 -0
- package/src/cab/plugin/Component.java.tpl +52 -0
- package/src/cab/plugin/Cv.java.tpl +21 -0
- package/src/cab/plugin/ErrorIo.java.tpl +26 -0
- package/src/cab/plugin/In.Abstract.java.tpl +30 -0
- package/src/cab/plugin/In.java.tpl +25 -0
- package/src/cab/plugin/Io.Abstract.java.tpl +36 -0
- package/src/cab/plugin/Io.Impl.java.tpl +21 -0
- package/src/cab/plugin/Io.java.tpl +73 -0
- package/src/cab/plugin/Plugin.After.java.tpl +22 -0
- package/src/cab/plugin/Plugin.Before.java.tpl +22 -0
- package/src/cab/plugin/Refine.Log.java.tpl +47 -0
- package/src/cab/plugin/Refine.Pin.java.tpl +70 -0
- package/src/cab/plugin/Refine.java.tpl +67 -0
- package/src/cab/plugin/configuration.json.tpl +3 -0
- package/src/cab/plugin/infix.xml.tpl +22 -0
- package/src/cab/plugin/integration.json.tpl +20 -0
- package/src/cab/resource/falcon.resource.xlsx +0 -0
- package/src/cab/resource/resource.json +8 -0
- package/src/cab/resource/resource.xlsx +0 -0
- package/src/commander/ai.zero +10 -0
- package/src/commander/aj.zero +8 -0
- package/src/commander/ar.zero +4 -0
- package/src/commander/option.zero +21 -0
- package/src/commander-ai/fn.csv.js +105 -0
- package/src/commander-ai/fn.data.js +404 -0
- package/src/commander-ai/fn.init.js +106 -0
- package/src/commander-ai/fn.key.js +81 -0
- package/src/commander-ai/fn.md5.js +76 -0
- package/src/commander-ai/fn.random.js +84 -0
- package/src/commander-ai/fn.uk.js +70 -0
- package/src/commander-ai/fn.uuid.js +80 -0
- package/src/commander-ai/index.js +19 -0
- package/src/commander-aj/bundle/specification.txt +49 -0
- package/src/commander-aj/fn.i.mod.js +26 -0
- package/src/commander-aj/fn.i.resource.js +33 -0
- package/src/commander-aj/fn.j.bundle.js +51 -0
- package/src/commander-aj/fn.j.init.js +72 -0
- package/src/commander-aj/fn.j.permission.js +60 -0
- package/src/commander-aj/fn.j.plugin.js +120 -0
- package/src/commander-aj/fn.j.row.js +5 -0
- package/src/commander-aj/index.js +16 -0
- package/src/commander-ar/fn.i.complex.js +112 -0
- package/src/commander-ar/fn.i.form.js +91 -0
- package/src/commander-ar/index.js +7 -0
- package/src/epic/ai.economy.impl.fn.excel.js +128 -0
- package/src/epic/ai.economy.impl.fn.execute.js +162 -0
- package/src/epic/ai.economy.impl.fn.java.js +140 -0
- package/src/epic/ai.economy.impl.fn.json.js +23 -0
- package/src/epic/ai.economy.impl.fn.plugin.js +160 -0
- package/src/epic/ai.economy.impl.fn.react.js +219 -0
- package/src/epic/ai.export.impl.fn.parse.js +345 -0
- package/src/epic/ai.export.impl.fn.seek.js +42 -0
- package/src/epic/ai.export.interface.fn.string.js +5 -0
- package/src/epic/ai.export.interface.io.js +69 -0
- package/src/epic/ai.export.interface.util.js +17 -0
- package/src/epic/ai.path.fn.dir.operation.js +87 -0
- package/src/epic/ai.path.fn.io.command.js +43 -0
- package/src/epic/ai.path.fn.io.specification.js +59 -0
- package/src/epic/ai.path.fn.io.typed.js +63 -0
- package/src/epic/ai.path.fn.out.content.js +47 -0
- package/src/epic/ai.string.fn.str.util.js +56 -0
- package/src/epic/ai.uncork.fn.element.feature.js +52 -0
- package/src/epic/ai.uncork.fn.it.feature.js +118 -0
- package/src/epic/ai.uncork.fn.to.typed.js +74 -0
- package/src/epic/ai.under.fn.cx.evaluate.js +81 -0
- package/src/epic/ai.under.fn.fx.terminal.js +143 -0
- package/src/epic/ai.unified.fn._.logging.js +45 -0
- package/src/epic/ai.unified.fn.fn.error.code.js +114 -0
- package/src/epic/ai.unified.fn.is.decision.js +20 -0
- package/src/epic/ai.unified.fn.sorter.element.js +26 -0
- package/src/epic/index.js +216 -0
- package/src/epic/zero.__.fn.find.util.js +37 -0
- package/src/epic/zero.__.v.constant.js +5 -0
- package/test/csv.json +12 -0
- package/test/csv.zero +2 -0
- package/test/data.zero +56 -0
- package/test/key/key1.json +15 -0
- package/test/key/key2.json +12 -0
- package/test/key/key3.json +5 -0
- package/test/key.json +12 -0
- package/test/uk.json +19 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
const __IO = require('./ai.export.interface.io');
|
|
2
|
+
const __FX = require('./ai.under.fn.fx.terminal');
|
|
3
|
+
const __LOG = require('./ai.unified.fn._.logging');
|
|
4
|
+
const __STR = require('./ai.export.interface.fn.string');
|
|
5
|
+
const __SK = require('./ai.export.impl.fn.seek');
|
|
6
|
+
const U = require('underscore');
|
|
7
|
+
const {config} = require("exceljs");
|
|
8
|
+
|
|
9
|
+
const ensureMaven = (path, module) => {
|
|
10
|
+
if (!__IO.isFile(path)) {
|
|
11
|
+
__FX.fxError(10017, module);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const ensureZero = (path, module) => {
|
|
15
|
+
if (!__IO.isDirectory(path)) {
|
|
16
|
+
__FX.fxError(10033, module);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const ensureOx = (path, module) => {
|
|
20
|
+
if (!__IO.isDirectory(path)) {
|
|
21
|
+
__FX.fxError(10034, module);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const detectMaven = (modulePath) => {
|
|
25
|
+
const configuration = {};
|
|
26
|
+
// pom.xml 文件检查
|
|
27
|
+
const pom = modulePath + `/pom.xml`;
|
|
28
|
+
ensureMaven(pom, modulePath);
|
|
29
|
+
configuration.pathPom = pom;
|
|
30
|
+
// 「Zero」src/main/java 检查
|
|
31
|
+
const source = modulePath + '/src/main/java';
|
|
32
|
+
ensureZero(source, modulePath);
|
|
33
|
+
configuration.pathSource = source;
|
|
34
|
+
// 「Zero」src/main/resources 检查
|
|
35
|
+
const resource = modulePath + '/src/main/resources';
|
|
36
|
+
ensureZero(resource, modulePath);
|
|
37
|
+
configuration.pathResource = resource;
|
|
38
|
+
return configuration;
|
|
39
|
+
}
|
|
40
|
+
const detectOx = (modulePath, configuration = {}) => {
|
|
41
|
+
const resource = configuration.pathResource;
|
|
42
|
+
// 「Ox」src/main/resources/cab
|
|
43
|
+
const cab = resource + '/cab';
|
|
44
|
+
ensureOx(cab, modulePath);
|
|
45
|
+
configuration.pathOxCab = cab;
|
|
46
|
+
// 「Ox」src/main/resources/init/oob
|
|
47
|
+
const oob = resource + '/init/oob';
|
|
48
|
+
ensureOx(oob, modulePath);
|
|
49
|
+
configuration.pathOxOOB = oob;
|
|
50
|
+
// 「Ox」src/main/resources/runtime
|
|
51
|
+
const runtime = resource + '/runtime';
|
|
52
|
+
ensureOx(runtime, modulePath);
|
|
53
|
+
configuration.pathOxRuntime = runtime;
|
|
54
|
+
return configuration;
|
|
55
|
+
}
|
|
56
|
+
const detectPlugin = (modulePath, configuration = {}) => {
|
|
57
|
+
const module = configuration.module;
|
|
58
|
+
const source = configuration.pathSource;
|
|
59
|
+
const resource = configuration.pathResource;
|
|
60
|
+
const packagePath = `/cn/originx/${module}/`;
|
|
61
|
+
configuration.modulePackage = `cn.originx.${module}`;
|
|
62
|
+
configuration.moduleAlias = __STR.strFirstUpper(module).substring(0, 2);
|
|
63
|
+
configuration.moduleLog = module.toUpperCase();
|
|
64
|
+
// 源代码
|
|
65
|
+
configuration.sourceComponent = source + packagePath + 'component';
|
|
66
|
+
configuration.sourceCv = source + packagePath + 'cv';
|
|
67
|
+
configuration.sourceError = source + packagePath + 'error';
|
|
68
|
+
configuration.sourceInput = source + packagePath + 'input';
|
|
69
|
+
configuration.sourceOutput = source + packagePath + 'output';
|
|
70
|
+
configuration.sourceRefine = source + packagePath + 'refine';
|
|
71
|
+
configuration.sourcePlugin = source + packagePath + 'plugin';
|
|
72
|
+
// 资源文件目录
|
|
73
|
+
configuration.resourcePlugin = resource + `/plugin/${module}`;
|
|
74
|
+
configuration.resourceLog = resource + `/plugin/${module}/annal`;
|
|
75
|
+
|
|
76
|
+
return configuration;
|
|
77
|
+
}
|
|
78
|
+
const detectWith = (modulePath, module, ...fnPlugin) => {
|
|
79
|
+
let configuration = detectMaven(modulePath);
|
|
80
|
+
if (module) {
|
|
81
|
+
configuration.module = module;
|
|
82
|
+
}
|
|
83
|
+
for (let idx = 0; idx < fnPlugin.length; idx++) {
|
|
84
|
+
const detectFn = fnPlugin[idx];
|
|
85
|
+
if (U.isFunction(detectFn)) {
|
|
86
|
+
// 会被改掉
|
|
87
|
+
configuration = detectFn(modulePath, configuration);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return configuration;
|
|
91
|
+
}
|
|
92
|
+
const javaConfig = (config = {}, path, ...fnPlugins) => {
|
|
93
|
+
const {
|
|
94
|
+
filename,
|
|
95
|
+
module,
|
|
96
|
+
tpl,
|
|
97
|
+
} = config;
|
|
98
|
+
let modulePath = path;
|
|
99
|
+
const inputConfig = __IO.ioJObject(filename);
|
|
100
|
+
const {ZF, ...prepared} = inputConfig;
|
|
101
|
+
if (!modulePath) {
|
|
102
|
+
modulePath = ZF;
|
|
103
|
+
}
|
|
104
|
+
__FX.fxError(!modulePath, 10029, modulePath, 'ZF');
|
|
105
|
+
if (modulePath) {
|
|
106
|
+
__LOG.info(`「Java环境」,后端工作路径:${modulePath.red}。`);
|
|
107
|
+
const configuration = detectWith.apply(this, [modulePath, module].concat(fnPlugins));
|
|
108
|
+
if (configuration) {
|
|
109
|
+
__LOG.info(`Zero AI `.cyan + ` 0. 基础环境......`.rainbow);
|
|
110
|
+
__LOG.info(`Zero AI `.cyan + ` 工作目录:${modulePath.blue}`);
|
|
111
|
+
configuration.input = prepared;
|
|
112
|
+
configuration.tpl = tpl;
|
|
113
|
+
return configuration;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const javaSmartMod = (path = ".") => {
|
|
118
|
+
// 目录基础检查
|
|
119
|
+
const pathStart = __IO.ioSwitch(path);
|
|
120
|
+
const pathFile = `${pathStart}/initialize.json`;
|
|
121
|
+
__FX.fxError(!__IO.isExist(pathFile), 10035, path);
|
|
122
|
+
// 查找带有 pom.xml 的根路径
|
|
123
|
+
__LOG.info(`Zero AI `.cyan + ` 检索模块目录构造配置信息。`);
|
|
124
|
+
const modulePath = __SK.seekResource(path);
|
|
125
|
+
// 构造模块规范,查找目录设置
|
|
126
|
+
const configuration = {};
|
|
127
|
+
configuration.pathBase = modulePath;
|
|
128
|
+
configuration.path = pathStart;
|
|
129
|
+
configuration.out = pathFile;
|
|
130
|
+
configuration.prefix = pathStart.replace(`${modulePath}/`, "");
|
|
131
|
+
return configuration;
|
|
132
|
+
}
|
|
133
|
+
module.exports = {
|
|
134
|
+
Cfg: {
|
|
135
|
+
detectOx,
|
|
136
|
+
detectPlugin,
|
|
137
|
+
},
|
|
138
|
+
javaConfig,
|
|
139
|
+
javaSmartMod,
|
|
140
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const __UT = require("./ai.export.interface.util");
|
|
2
|
+
const jsonCombine = (contentJ = [], normalized = [], mode = "REPLACE") => {
|
|
3
|
+
|
|
4
|
+
let contentT = [];
|
|
5
|
+
if ("REPLACE" === mode) {
|
|
6
|
+
// 替换模式
|
|
7
|
+
contentT = normalized.sort(__UT.sorterSAsc);
|
|
8
|
+
} else {
|
|
9
|
+
const result = [].concat(__UT.clone(contentJ));
|
|
10
|
+
// 非替换模式 APPEND
|
|
11
|
+
normalized.forEach(item => {
|
|
12
|
+
if (!contentJ.includes(item)) {
|
|
13
|
+
result.push(item);
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
contentT = result.sort(__UT.sorterSAsc);
|
|
17
|
+
}
|
|
18
|
+
return contentT;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = {
|
|
22
|
+
jsonCombine,
|
|
23
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
const __IO = require('./ai.export.interface.io');
|
|
2
|
+
const __STR = require('./ai.export.interface.fn.string');
|
|
3
|
+
const __LOG = require('./ai.unified.fn._.logging');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const writeFile = (config, params = {}) => {
|
|
7
|
+
const {source, target} = config;
|
|
8
|
+
if (fs.existsSync(source) && target) {
|
|
9
|
+
const content = __IO.ioString(source);
|
|
10
|
+
const normalized = __STR.strExpr(content, params);
|
|
11
|
+
__IO.outString(target, normalized, true);
|
|
12
|
+
} else {
|
|
13
|
+
__LOG.warn(`Zero AI 对不起,文件不存在`.yellow + `:${source}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const writeDir = (config = {}) => {
|
|
17
|
+
__LOG.info(`Zero AI `.cyan + ` \t1.1. 初始化源代码目录......`);
|
|
18
|
+
Object.keys(config)
|
|
19
|
+
.filter(key => key.startsWith("source"))
|
|
20
|
+
.map(field => config[field])
|
|
21
|
+
.forEach(__IO.dirCreate);
|
|
22
|
+
|
|
23
|
+
__LOG.info(`Zero AI `.cyan + ` \t1.2. 初始化资源目录......`);
|
|
24
|
+
Object.keys(config)
|
|
25
|
+
.filter(key => key.startsWith("resource"))
|
|
26
|
+
.map(field => config[field])
|
|
27
|
+
.forEach(__IO.dirCreate);
|
|
28
|
+
}
|
|
29
|
+
const fileRaw = (targetFile, tplFile, filename, filenameTpl) => {
|
|
30
|
+
const file = {};
|
|
31
|
+
file.target = `${targetFile}/${filename}`;
|
|
32
|
+
const fileTpl = filenameTpl ? filenameTpl : `${filename}.tpl`;
|
|
33
|
+
file.source = `${tplFile}/${fileTpl}`;
|
|
34
|
+
return file;
|
|
35
|
+
}
|
|
36
|
+
const fileInfix = (targetFile, tplFile, input = {}) => {
|
|
37
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.1. backlog日志配置......`);
|
|
38
|
+
const content = fileRaw(targetFile, tplFile, 'infix.xml');
|
|
39
|
+
const {params = {}} = input;
|
|
40
|
+
writeFile(content, params);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const fileConfiguration = (resourcePath, tplFile, input = {}) => {
|
|
44
|
+
const {params = {}} = input;
|
|
45
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.2.1. 「默认」集成配置......`);
|
|
46
|
+
let json = fileRaw(resourcePath, tplFile,
|
|
47
|
+
"integration.json");
|
|
48
|
+
writeFile(json, params);
|
|
49
|
+
|
|
50
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.2.2. 「开发」集成配置......`);
|
|
51
|
+
json = fileRaw(resourcePath, tplFile,
|
|
52
|
+
"integration-dev.json", "integration.json.tpl");
|
|
53
|
+
writeFile(json, params);
|
|
54
|
+
|
|
55
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.2.3. 「生产」集成配置......`);
|
|
56
|
+
json = fileRaw(resourcePath, tplFile,
|
|
57
|
+
"integration-prod.json", "integration.json.tpl");
|
|
58
|
+
writeFile(json, params);
|
|
59
|
+
|
|
60
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.2.4. 基础配置......`);
|
|
61
|
+
json = fileRaw(resourcePath, tplFile,
|
|
62
|
+
"configuration.json");
|
|
63
|
+
writeFile(json, params);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const fileJava = (tplFile, input = {}) => {
|
|
67
|
+
const {params = {}, config = {}} = input;
|
|
68
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.3.1. 常量处理......`);
|
|
69
|
+
let java = fileRaw(config.sourceCv, tplFile,
|
|
70
|
+
`${config.moduleAlias}Cv.java`, `Cv.java.tpl`);
|
|
71
|
+
writeFile(java, params);
|
|
72
|
+
|
|
73
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.3.2. Before/After 插件处理......`);
|
|
74
|
+
java = fileRaw(config.sourcePlugin, tplFile,
|
|
75
|
+
`Abstract${config.moduleAlias}Before.java`, `Plugin.Before.java.tpl`);
|
|
76
|
+
writeFile(java, params);
|
|
77
|
+
java = fileRaw(config.sourcePlugin, tplFile,
|
|
78
|
+
`Abstract${config.moduleAlias}After.java`, `Plugin.After.java.tpl`);
|
|
79
|
+
writeFile(java, params);
|
|
80
|
+
|
|
81
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.3.3. Refine 工具处理......`);
|
|
82
|
+
java = fileRaw(config.sourceRefine, tplFile,
|
|
83
|
+
`${config.moduleAlias}Log.java`, `Refine.Log.java.tpl`);
|
|
84
|
+
writeFile(java, params);
|
|
85
|
+
java = fileRaw(config.sourceRefine, tplFile,
|
|
86
|
+
`${config.moduleAlias}Pin.java`, `Refine.Pin.java.tpl`);
|
|
87
|
+
writeFile(java, params);
|
|
88
|
+
java = fileRaw(config.sourceRefine, tplFile,
|
|
89
|
+
`${config.moduleAlias}.java`, 'Refine.java.tpl');
|
|
90
|
+
writeFile(java, params);
|
|
91
|
+
|
|
92
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.3.4. Error 异常类处理......`);
|
|
93
|
+
java = fileRaw(config.sourceError, tplFile,
|
|
94
|
+
`_501${config.moduleAlias}IoNullException.java`, `ErrorIo.java.tpl`);
|
|
95
|
+
writeFile(java, params);
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.3.5. Component 通道组件......`);
|
|
99
|
+
java = fileRaw(config.sourceComponent, tplFile,
|
|
100
|
+
`Abstract${config.moduleAlias}Component.java`, `Component.java.tpl`);
|
|
101
|
+
writeFile(java, params);
|
|
102
|
+
|
|
103
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.3.6. In 组件处理......`);
|
|
104
|
+
java = fileRaw(config.sourceInput, tplFile,
|
|
105
|
+
`${config.moduleAlias}In.java`, `In.java.tpl`);
|
|
106
|
+
writeFile(java, params);
|
|
107
|
+
|
|
108
|
+
java = fileRaw(config.sourceInput, tplFile,
|
|
109
|
+
`Abstract${config.moduleAlias}In.java`, `In.Abstract.java.tpl`);
|
|
110
|
+
writeFile(java, params);
|
|
111
|
+
|
|
112
|
+
__LOG.info(`Zero AI `.cyan + ` \t2.3.7. Out 组件处理......`);
|
|
113
|
+
java = fileRaw(config.sourceOutput, tplFile,
|
|
114
|
+
`${config.moduleAlias}Io.java`, `Io.java.tpl`);
|
|
115
|
+
writeFile(java, params);
|
|
116
|
+
|
|
117
|
+
java = fileRaw(config.sourceOutput, tplFile,
|
|
118
|
+
`Abstract${config.moduleAlias}Io.java`, `Io.Abstract.java.tpl`);
|
|
119
|
+
writeFile(java, params);
|
|
120
|
+
|
|
121
|
+
java = fileRaw(config.sourceOutput, tplFile,
|
|
122
|
+
`${config.moduleAlias}IoAdd.java`, `Io.Impl.java.tpl`);
|
|
123
|
+
writeFile(java, {OP: "Add", ...params});
|
|
124
|
+
java = fileRaw(config.sourceOutput, tplFile,
|
|
125
|
+
`${config.moduleAlias}IoUpdate.java`, `Io.Impl.java.tpl`);
|
|
126
|
+
writeFile(java, {OP: "Update", ...params});
|
|
127
|
+
java = fileRaw(config.sourceOutput, tplFile,
|
|
128
|
+
`${config.moduleAlias}IoDelete.java`, `Io.Impl.java.tpl`);
|
|
129
|
+
writeFile(java, {OP: "Delete", ...params});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const pluginRun = (config = {}) => {
|
|
133
|
+
__LOG.info(`Zero AI `.cyan + ` 1. 执行Plugin命令......`.rainbow);
|
|
134
|
+
const {tpl = {}} = config;
|
|
135
|
+
const tplPath = path.join(__dirname, `../cab/${tpl.type}`);
|
|
136
|
+
writeDir(config);
|
|
137
|
+
|
|
138
|
+
const params = {};
|
|
139
|
+
__LOG.info(`Zero AI `.cyan + ` 2. 生成代码......`.rainbow);
|
|
140
|
+
params.LOG_L = config.module;
|
|
141
|
+
params.LOG_UP = config.module.toUpperCase();
|
|
142
|
+
params.ALIAS = config.moduleAlias;
|
|
143
|
+
params.PACKAGE = config.modulePackage;
|
|
144
|
+
params.MODULE = config.module;
|
|
145
|
+
|
|
146
|
+
const input = {};
|
|
147
|
+
input.config = config;
|
|
148
|
+
input.params = params;
|
|
149
|
+
|
|
150
|
+
// src/main/resources/plugin/xxx/annal/infix.xml
|
|
151
|
+
fileInfix(config.resourceLog, tplPath, input);
|
|
152
|
+
// src/main/resources/plugin/xxx/configuration.json
|
|
153
|
+
fileConfiguration(config.resourcePlugin, tplPath, input);
|
|
154
|
+
// src/main/java 源代码
|
|
155
|
+
fileJava(tplPath, input);
|
|
156
|
+
__LOG.info(`Zero AI `.cyan + ` 3. 执行完成......`.rainbow);
|
|
157
|
+
}
|
|
158
|
+
module.exports = {
|
|
159
|
+
pluginRun
|
|
160
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
const __IO = require('./ai.export.interface.io');
|
|
2
|
+
const __FX = require('./ai.under.fn.fx.terminal');
|
|
3
|
+
const __LOG = require('./ai.unified.fn._.logging');
|
|
4
|
+
const __STR = require('./ai.export.interface.fn.string');
|
|
5
|
+
const __CX = require('./ai.under.fn.cx.evaluate');
|
|
6
|
+
const __V = require("./zero.__.v.constant");
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const reactRoot = (path) => {
|
|
11
|
+
const current = path ? `${process.cwd()}${__V.FILE_DELIMITER}${path}` : process.cwd();
|
|
12
|
+
let root = __IO.dirParent(current, true);
|
|
13
|
+
// 检查哪个目录中包含了package.json来判断根路径
|
|
14
|
+
root = root.filter(item => fs.existsSync(`${item}${__V.FILE_DELIMITER}package.json`));
|
|
15
|
+
__FX.fxError(1 < root.length, 10010, root);
|
|
16
|
+
root = root[0];
|
|
17
|
+
return __IO.dirResolve(root);
|
|
18
|
+
};
|
|
19
|
+
const reactLanguage = () => {
|
|
20
|
+
const root = reactRoot();
|
|
21
|
+
// 生产环境无效
|
|
22
|
+
const env = __IO.ioProp(root + __V.FILE_DELIMITER + '.env.development');
|
|
23
|
+
return env['Z_LANGUAGE'] ? env['Z_LANGUAGE'] : 'cn';
|
|
24
|
+
};
|
|
25
|
+
const reactDetect = (module, component) => {
|
|
26
|
+
// 路径分析专用
|
|
27
|
+
const slash = __STR.strSlashCount(module);
|
|
28
|
+
// 10027:检查ZT环境的格式
|
|
29
|
+
__FX.fxError(1 !== slash, 10027, module);
|
|
30
|
+
if (1 === slash) {
|
|
31
|
+
// 配置
|
|
32
|
+
const configuration = {};
|
|
33
|
+
const language = reactLanguage();
|
|
34
|
+
configuration.module = module;
|
|
35
|
+
configuration.language = language;
|
|
36
|
+
|
|
37
|
+
configuration.pathRoot = reactRoot();
|
|
38
|
+
{
|
|
39
|
+
// 资源路径,组件路径
|
|
40
|
+
configuration.pathResource = `src/cab/${language}/${component}/${module}`;
|
|
41
|
+
configuration.pathUi = `src/${component}/${module}`;
|
|
42
|
+
configuration.namespace = `${component}/${module}`;
|
|
43
|
+
}
|
|
44
|
+
return configuration;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const reactEnsure = (category = 'components') => {
|
|
48
|
+
const module = process.env.ZT;
|
|
49
|
+
// 10029: 检查ZT环境变量
|
|
50
|
+
__FX.fxError(!module, 10029, module, 'ZT');
|
|
51
|
+
if (module) {
|
|
52
|
+
__LOG.info(`「启用ZT环境」,当前模块:${module.red},特殊命令只能在${`ZT`.red}环境使用。`)
|
|
53
|
+
const moduleConfig = reactDetect(module, category);
|
|
54
|
+
if (moduleConfig) {
|
|
55
|
+
__LOG.info(`Zero AI `.cyan + ` 0. 基础环境......`.rainbow);
|
|
56
|
+
__LOG.info(`环境变量:` + `ZT = ${module}`.red);
|
|
57
|
+
__LOG.info(`模块信息:${moduleConfig.module.blue}`);
|
|
58
|
+
__LOG.info(`语言信息:${moduleConfig.language.blue}`);
|
|
59
|
+
__LOG.info(`项目目录:${moduleConfig.pathRoot.blue}`);
|
|
60
|
+
return moduleConfig;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/*
|
|
65
|
+
* 目录创建专用
|
|
66
|
+
*/
|
|
67
|
+
const reactReady = (config = {}, files = {}) => {
|
|
68
|
+
__LOG.info(`Zero AI `.cyan + ` 1. 目录检查......`.rainbow);
|
|
69
|
+
// 资源目录
|
|
70
|
+
const runtime = {};
|
|
71
|
+
runtime.resource = config.pathRoot + '/' + config.pathResource;
|
|
72
|
+
runtime.resourceFiles = {};
|
|
73
|
+
__IO.dirCreate(runtime.resource);
|
|
74
|
+
// 组件目录
|
|
75
|
+
runtime.ui = config.pathRoot + '/' + config.pathUi;
|
|
76
|
+
runtime.uiFiles = {};
|
|
77
|
+
__IO.dirCreate(runtime.ui);
|
|
78
|
+
|
|
79
|
+
// 其他目录专用计算
|
|
80
|
+
__LOG.info(`Zero AI `.cyan + ` 2. 文件表:`.rainbow);
|
|
81
|
+
runtime.namespaceFile = runtime.ui + '/Cab.json';
|
|
82
|
+
|
|
83
|
+
// 资源文件/脚本文件
|
|
84
|
+
const {
|
|
85
|
+
resource = [],
|
|
86
|
+
ui = [],
|
|
87
|
+
} = files;
|
|
88
|
+
const tpl = config.tpl;
|
|
89
|
+
/*
|
|
90
|
+
* 如果配置了 tpl.target 则是单文件拷贝
|
|
91
|
+
*/
|
|
92
|
+
if (tpl.target) {
|
|
93
|
+
/*
|
|
94
|
+
* fileJs模式
|
|
95
|
+
*/
|
|
96
|
+
const filename = tpl.target;
|
|
97
|
+
runtime.resourceFiles[filename] = runtime.resource + '/' + filename + ".json";
|
|
98
|
+
runtime.uiFiles[filename] = runtime.ui + '/' + filename + ".js";
|
|
99
|
+
} else {
|
|
100
|
+
/*
|
|
101
|
+
* 非fileJs模式
|
|
102
|
+
*/
|
|
103
|
+
resource.filter(each => undefined !== each).forEach(each => {
|
|
104
|
+
const file = runtime.resource + '/' + each + ".json";
|
|
105
|
+
runtime.resourceFiles[each] = file;
|
|
106
|
+
__LOG.info(`${__STR.strWidth(each)} = ${file.blue}`);
|
|
107
|
+
});
|
|
108
|
+
ui.filter(each => undefined !== each).forEach(each => {
|
|
109
|
+
const file = runtime.ui + '/' + each + ".js";
|
|
110
|
+
runtime.uiFiles[each] = file;
|
|
111
|
+
__LOG.info(`${__STR.strWidth(each)} = ${file.yellow}`);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
config.runtime = __FX.fxSorter(runtime);
|
|
115
|
+
}
|
|
116
|
+
const reactTpl = (name, config = {}) => {
|
|
117
|
+
const {input = {}, tpl = {}} = config;
|
|
118
|
+
// 读取模板
|
|
119
|
+
let tplFile;
|
|
120
|
+
if (tpl.source) {
|
|
121
|
+
const extension = config.extension;
|
|
122
|
+
// 特殊参数注入`#NAME#`
|
|
123
|
+
input.params.NAME = tpl.target;
|
|
124
|
+
tplFile = path.join(__dirname, `../cab/${tpl.type}/${tpl.source}.${extension}.tpl`);
|
|
125
|
+
} else {
|
|
126
|
+
tplFile = path.join(__dirname, `../cab/${tpl.type}/${name}.tpl`);
|
|
127
|
+
}
|
|
128
|
+
if (fs.existsSync(tplFile)) {
|
|
129
|
+
// 读取文件内容
|
|
130
|
+
const content = __IO.ioString(tplFile);
|
|
131
|
+
return __STR.strExpr(content, input.params);
|
|
132
|
+
} else {
|
|
133
|
+
__LOG.warn(`Zero AI 对不起,文件不存在`.yellow + `:${tplFile.red}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// ==========================================================
|
|
137
|
+
// 名空间文件 Cab.json
|
|
138
|
+
// ==========================================================
|
|
139
|
+
const reactTplNamespace = (config) => {
|
|
140
|
+
const runtime = config.runtime;
|
|
141
|
+
__LOG.info(`Zero AI `.cyan + ` \t3.1. 创建名空间文件......`.rainbow);
|
|
142
|
+
if (!fs.existsSync(runtime.namespaceFile)) {
|
|
143
|
+
const namespace = {};
|
|
144
|
+
namespace.ns = config.namespace;
|
|
145
|
+
__IO.outJson(runtime.namespaceFile, namespace, true);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// ==========================================================
|
|
149
|
+
// 资源文件
|
|
150
|
+
// ==========================================================
|
|
151
|
+
const reactTplResource = (config) => {
|
|
152
|
+
const runtime = config.runtime;
|
|
153
|
+
__LOG.info(`Zero AI `.cyan + ` \t3.2. 构造资源文件......`.rainbow);
|
|
154
|
+
const resourceFiles = runtime.resourceFiles;
|
|
155
|
+
Object.keys(resourceFiles).forEach(filename => {
|
|
156
|
+
const fullName = `${filename}.json`;
|
|
157
|
+
const content = reactTpl(fullName, {
|
|
158
|
+
...config,
|
|
159
|
+
extension: 'json'
|
|
160
|
+
});
|
|
161
|
+
if (content) {
|
|
162
|
+
const contentJson = JSON.parse(content);
|
|
163
|
+
__IO.outJson(resourceFiles[filename], contentJson, true);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
// ==========================================================
|
|
168
|
+
// 脚本文件
|
|
169
|
+
// ==========================================================
|
|
170
|
+
const reactTplUi = (config) => {
|
|
171
|
+
const runtime = config.runtime;
|
|
172
|
+
__LOG.info(`Zero AI `.cyan + ` \t3.3. 构造界面文件......`.rainbow);
|
|
173
|
+
const uiFiles = runtime.uiFiles;
|
|
174
|
+
Object.keys(uiFiles).forEach(filename => {
|
|
175
|
+
const fullName = `${filename}.js`;
|
|
176
|
+
const content = reactTpl(fullName, {
|
|
177
|
+
...config,
|
|
178
|
+
extension: 'js'
|
|
179
|
+
});
|
|
180
|
+
if (content) {
|
|
181
|
+
__IO.outString(uiFiles[filename], content, true);
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
const reactRun = (config) => {
|
|
186
|
+
__LOG.info(`Zero AI `.cyan + ` 3. 执行React命令......`.rainbow);
|
|
187
|
+
// 1. 创建名空间文件
|
|
188
|
+
reactTplNamespace(config);
|
|
189
|
+
// 2. 资源文件
|
|
190
|
+
reactTplResource(config);
|
|
191
|
+
// 3. 构造代码文件
|
|
192
|
+
reactTplUi(config);
|
|
193
|
+
__LOG.info(`Zero AI `.cyan + ` 4. 命令执行完成!!!`.rainbow);
|
|
194
|
+
}
|
|
195
|
+
const reactConfig = (config = {}) => {
|
|
196
|
+
const {
|
|
197
|
+
filename,
|
|
198
|
+
tpl,
|
|
199
|
+
resource = [],
|
|
200
|
+
ui = []
|
|
201
|
+
} = config;
|
|
202
|
+
const configuration = reactEnsure();
|
|
203
|
+
if (configuration) {
|
|
204
|
+
__CX.cxExist(filename);
|
|
205
|
+
const inputConfig = __IO.ioJObject(filename);
|
|
206
|
+
configuration.tpl = tpl;
|
|
207
|
+
configuration.input = inputConfig;
|
|
208
|
+
// 构造和准备
|
|
209
|
+
reactReady(configuration, {
|
|
210
|
+
resource,
|
|
211
|
+
ui
|
|
212
|
+
});
|
|
213
|
+
return configuration;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
module.exports = {
|
|
217
|
+
reactConfig,
|
|
218
|
+
reactRun,
|
|
219
|
+
};
|