zero-ai 0.3.31 → 0.3.32
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/package.json +1 -1
- package/src/commander/ai.zero +1 -1
- package/src/commander-ai/fn.sync.js +118 -94
package/package.json
CHANGED
package/src/commander/ai.zero
CHANGED
|
@@ -8,5 +8,5 @@ key, executeKey, 为数据模板添加key属性(UUID格式),
|
|
|
8
8
|
str, executeString, 生成随机字符串,可直接拷贝, n=「1」生成的数量, l=「64」长度信息(默认64)
|
|
9
9
|
md5, executeMD5, 加密字符串,可直接拷贝, i=输入字符串
|
|
10
10
|
init, executeInit, 初始化Zero Ui工程, n=项目名称(必须填写,最终写入package.json)
|
|
11
|
-
sync, executeSync, 同步Zero Ui最新框架, p
|
|
11
|
+
sync, executeSync, 同步Zero Ui最新框架, p=配置文件路径,前端项目根目录,m=是否本地模式
|
|
12
12
|
|
|
@@ -1,6 +1,93 @@
|
|
|
1
1
|
const Ec = require("../epic");
|
|
2
2
|
const child = require('child_process');
|
|
3
3
|
|
|
4
|
+
const COMMANDS = [
|
|
5
|
+
"run-default.sh",
|
|
6
|
+
"run-doc.sh",
|
|
7
|
+
"run-zero.sh",
|
|
8
|
+
"run-zero.bat",
|
|
9
|
+
"run-update.sh",
|
|
10
|
+
// 核心配置
|
|
11
|
+
"document/",
|
|
12
|
+
"scripts/",
|
|
13
|
+
"config/",
|
|
14
|
+
// 资源文件:暂时只考虑中文
|
|
15
|
+
"src/cab/cn/cerebration/",
|
|
16
|
+
"src/cab/cn/extension/",
|
|
17
|
+
"src/cab/cn/economy/",
|
|
18
|
+
"src/cab/cn/shared.json",
|
|
19
|
+
// 层代码
|
|
20
|
+
"src/economy/",
|
|
21
|
+
"src/entity@em/",
|
|
22
|
+
"src/extension/",
|
|
23
|
+
"src/environment/",
|
|
24
|
+
// Skin 风格专用代码
|
|
25
|
+
"src/skin/index.d.ts",
|
|
26
|
+
"src/skin/index.entry.js",
|
|
27
|
+
"src/skin/index.js",
|
|
28
|
+
"src/skin/plot.fn.mix.attr.js",
|
|
29
|
+
"src/skin/plot.fn.of.document.js",
|
|
30
|
+
"src/skin/wait._.v.locale.definition.js",
|
|
31
|
+
"src/skin/wait.fn.skin.initialize.js",
|
|
32
|
+
"src/skin/aroma-library/index.js",
|
|
33
|
+
"src/skin/aroma-library/__.theme.shared/",
|
|
34
|
+
// SCSS 风格专用代码
|
|
35
|
+
// "src/style/@old/",
|
|
36
|
+
"src/style/connect/",
|
|
37
|
+
"src/style/macrocosm/index.scss",
|
|
38
|
+
"src/style/macrocosm/mod.screen.scss",
|
|
39
|
+
"src/style/microcosm/",
|
|
40
|
+
"src/style/uca/",
|
|
41
|
+
"src/style/unstable/",
|
|
42
|
+
"src/style/ux@legacy/",
|
|
43
|
+
// Ui
|
|
44
|
+
"src/ui/",
|
|
45
|
+
// Ex
|
|
46
|
+
"src/unfold/",
|
|
47
|
+
"src/upper/",
|
|
48
|
+
"src/utter/",
|
|
49
|
+
// Ux
|
|
50
|
+
"src/ux/",
|
|
51
|
+
"src/zero/",
|
|
52
|
+
"src/zest@web/",
|
|
53
|
+
"src/zion/",
|
|
54
|
+
"src/zither@em/",
|
|
55
|
+
"src/zodiac/",
|
|
56
|
+
"src/zoe@em/",
|
|
57
|
+
"src/zone/",
|
|
58
|
+
"src/index.js"
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
const executeRemote = (actual = {}, options = {}) => {
|
|
62
|
+
const path = actual.path;
|
|
63
|
+
// 2. 创建 .zero 目录
|
|
64
|
+
const cmdDir = `mkdir -p ${path}`;
|
|
65
|
+
child.execSync(cmdDir, options);
|
|
66
|
+
const pathSource = `${path}/scaffold-ui`
|
|
67
|
+
// 3. 删除 .zero/scaffold-ui 目录
|
|
68
|
+
if (Ec.isExist(pathSource)) {
|
|
69
|
+
Ec.info(`发现存在旧代码,正在删除:${pathSource}`);
|
|
70
|
+
const cmdDel = `rm -rf ${pathSource}`;
|
|
71
|
+
child.execSync(cmdDel, options);
|
|
72
|
+
}
|
|
73
|
+
// 4. 重新拉取代码
|
|
74
|
+
Ec.info(`拉取最新代码:${pathSource}`);
|
|
75
|
+
const cmdGit = `git clone https://gitee.com/silentbalanceyh/scaffold-ui.git ${pathSource}`;
|
|
76
|
+
child.execSync(cmdGit, options);
|
|
77
|
+
const cmdRm = `rm -rf ${pathSource}/.git`;
|
|
78
|
+
child.execSync(cmdRm, options);
|
|
79
|
+
return pathSource;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const executeLocal = (actual = {}, options = {}) => {
|
|
83
|
+
const pathEnv = process.env.Z_AI_SYNC;
|
|
84
|
+
if (!pathEnv) {
|
|
85
|
+
Ec.error("本地模式下,需要设置环境变量:Z_AI_SYNC");
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
return pathEnv;
|
|
89
|
+
}
|
|
90
|
+
|
|
4
91
|
module.exports = () => {
|
|
5
92
|
|
|
6
93
|
// 获取当前操作系统
|
|
@@ -20,7 +107,8 @@ module.exports = () => {
|
|
|
20
107
|
const actual = Ec.executeInput(
|
|
21
108
|
[],
|
|
22
109
|
[
|
|
23
|
-
['-p', '--path', '.zero']
|
|
110
|
+
['-p', '--path', '.zero'],
|
|
111
|
+
['-m', '--module', false] // 是否本地模式
|
|
24
112
|
]
|
|
25
113
|
);
|
|
26
114
|
// 1. 环境检查
|
|
@@ -28,101 +116,37 @@ module.exports = () => {
|
|
|
28
116
|
Ec.error("请选择带`.git`或`vertx-ui`的目录执行当前命令!");
|
|
29
117
|
return;
|
|
30
118
|
}
|
|
31
|
-
const path = actual.path;
|
|
32
|
-
// 2. 创建 .zero 目录
|
|
33
|
-
const cmdDir = `mkdir -p ${path}`;
|
|
34
|
-
child.execSync(cmdDir, options);
|
|
35
|
-
const pathSource = `${path}/scaffold-ui`
|
|
36
|
-
// 3. 删除 .zero/vertx-ui 目录
|
|
37
|
-
if (Ec.isExist(pathSource)) {
|
|
38
|
-
Ec.info(`发现存在旧代码,正在删除:${pathSource}`);
|
|
39
|
-
const cmdDel = `rm -rf ${pathSource}`;
|
|
40
|
-
child.execSync(cmdDel, options);
|
|
41
|
-
}
|
|
42
|
-
// 4. 重新拉取代码
|
|
43
|
-
Ec.info(`拉取最新代码:${pathSource}`);
|
|
44
|
-
const cmdGit = `git clone https://gitee.com/silentbalanceyh/scaffold-ui.git ${pathSource}`;
|
|
45
|
-
child.execSync(cmdGit, options);
|
|
46
|
-
const cmdRm = `rm -rf ${pathSource}/.git`;
|
|
47
|
-
child.execSync(cmdRm, options);
|
|
48
|
-
|
|
49
|
-
// 5. 拷贝 Ignore 文件全部指令
|
|
50
|
-
const commands = [
|
|
51
|
-
"run-default.sh",
|
|
52
|
-
"run-doc.sh",
|
|
53
|
-
"run-zero.sh",
|
|
54
|
-
"run-zero.bat",
|
|
55
|
-
"run-update.sh",
|
|
56
|
-
// 核心配置
|
|
57
|
-
"document/",
|
|
58
|
-
"scripts/",
|
|
59
|
-
"config/",
|
|
60
|
-
// 资源文件:暂时只考虑中文
|
|
61
|
-
"src/cab/cn/cerebration/",
|
|
62
|
-
"src/cab/cn/extension/",
|
|
63
|
-
"src/cab/cn/economy/",
|
|
64
|
-
"src/cab/cn/shared.json",
|
|
65
|
-
// 层代码
|
|
66
|
-
"src/economy/",
|
|
67
|
-
"src/entity@em/",
|
|
68
|
-
"src/extension/",
|
|
69
|
-
"src/environment/",
|
|
70
|
-
// Skin 风格专用代码
|
|
71
|
-
"src/skin/index.d.ts",
|
|
72
|
-
"src/skin/index.entry.js",
|
|
73
|
-
"src/skin/index.js",
|
|
74
|
-
"src/skin/plot.fn.mix.attr.js",
|
|
75
|
-
"src/skin/plot.fn.of.document.js",
|
|
76
|
-
"src/skin/wait._.v.locale.definition.js",
|
|
77
|
-
"src/skin/wait.fn.skin.initialize.js",
|
|
78
|
-
"src/skin/aroma-library/index.js",
|
|
79
|
-
"src/skin/aroma-library/__.theme.shared/",
|
|
80
|
-
// SCSS 风格专用代码
|
|
81
|
-
// "src/style/@old/",
|
|
82
|
-
"src/style/connect/",
|
|
83
|
-
"src/style/macrocosm/index.scss",
|
|
84
|
-
"src/style/macrocosm/mod.screen.scss",
|
|
85
|
-
"src/style/microcosm/",
|
|
86
|
-
"src/style/uca/",
|
|
87
|
-
"src/style/unstable/",
|
|
88
|
-
"src/style/ux@legacy/",
|
|
89
|
-
// Ui
|
|
90
|
-
"src/ui/",
|
|
91
|
-
// Ex
|
|
92
|
-
"src/unfold/",
|
|
93
|
-
"src/upper/",
|
|
94
|
-
"src/utter/",
|
|
95
|
-
// Ux
|
|
96
|
-
"src/ux/",
|
|
97
|
-
"src/zero/",
|
|
98
|
-
"src/zest@web/",
|
|
99
|
-
"src/zion/",
|
|
100
|
-
"src/zither@em/",
|
|
101
|
-
"src/zodiac/",
|
|
102
|
-
"src/zoe@em/",
|
|
103
|
-
"src/zone/",
|
|
104
|
-
"src/index.js"
|
|
105
|
-
]
|
|
106
119
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
let pathSource;
|
|
121
|
+
if (actual.module) {
|
|
122
|
+
// 本地模式
|
|
123
|
+
pathSource = executeLocal(actual, options);
|
|
124
|
+
} else {
|
|
125
|
+
// 远程模式
|
|
126
|
+
pathSource = executeRemote(actual, options);
|
|
127
|
+
}
|
|
128
|
+
if (pathSource) {
|
|
129
|
+
// 5. 拷贝 Ignore 文件全部指令
|
|
130
|
+
Ec.info(`开始更新主框架:......`.yellow);
|
|
131
|
+
COMMANDS.forEach(command => {
|
|
132
|
+
Ec.info(`处理目录:${command.green}`);
|
|
133
|
+
let cmd;
|
|
134
|
+
if (command.endsWith("/")) {
|
|
135
|
+
// 目录拷贝
|
|
136
|
+
if (!Ec.isExist(command)) {
|
|
137
|
+
const cmdDir = `mkdir -p ${command}`;
|
|
138
|
+
child.execSync(cmdDir, options);
|
|
139
|
+
}
|
|
140
|
+
cmd = `cp -rf ${pathSource}/${command}* ./${command}`;
|
|
141
|
+
child.execSync(cmd, options);
|
|
142
|
+
} else {
|
|
143
|
+
// 文件拷贝
|
|
144
|
+
cmd = `cp -rf ${pathSource}/${command} ./${command}`;
|
|
145
|
+
child.execSync(cmd, options);
|
|
116
146
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// 文件拷贝
|
|
121
|
-
cmd = `cp -rf ${pathSource}/${command} ./${command}`;
|
|
122
|
-
child.execSync(cmd, options);
|
|
123
|
-
}
|
|
124
|
-
})
|
|
125
|
-
Ec.info(`主框架更新完成:${pathSource}!`.help);
|
|
147
|
+
})
|
|
148
|
+
Ec.info(`主框架更新完成:${pathSource}!`.help);
|
|
149
|
+
}
|
|
126
150
|
}
|
|
127
151
|
/**
|
|
128
152
|
* ## `ai sync`
|