@lark-apaas/miaoda-cli 0.1.24 → 0.1.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.
|
@@ -96,6 +96,9 @@ function registerAppSync(parent) {
|
|
|
96
96
|
action-plugin postinstall 在 npm install 时缺平台 env 的卡点(需要时再
|
|
97
97
|
FORCE_AUTHN_INNERAPI_DOMAIN=... npm install 手动跑一次)。
|
|
98
98
|
|
|
99
|
+
stack 未纳入 sync 范围(无 SyncConfig 且无 upgrade/templates/<stack>/,如 design-html
|
|
100
|
+
buildless 静态 HTML)→ 跳过同步(no-op, skipped=true),退出码 0,不阻断 dev/启动链路。
|
|
101
|
+
|
|
99
102
|
JSON 输出
|
|
100
103
|
{"data": {"stack": "...",
|
|
101
104
|
"appliedRules": [{"type": "...", "action": "...", "path": "...", "detail": "..."}],
|
|
@@ -103,6 +106,7 @@ JSON 输出
|
|
|
103
106
|
"mergedJsonFiles": [{"path": "...", "keys": [...]}],
|
|
104
107
|
"patchedScripts": [...],
|
|
105
108
|
"upgradedPackages": [{"name": "...", "from": "...", "to": "...", "section": "..."}]}}
|
|
109
|
+
跳过时:{"data": {"stack": "...", "skipped": true, "reason": "stack_not_in_sync_scope", ...空数组}}
|
|
106
110
|
|
|
107
111
|
示例
|
|
108
112
|
$ miaoda app sync
|
|
@@ -183,8 +187,8 @@ function registerAppInit(parent) {
|
|
|
183
187
|
env 未设置时回退到 meta.json.app_id。
|
|
184
188
|
|
|
185
189
|
技术栈解析(--template / --app-type)
|
|
186
|
-
--template 传了 → 直接用(vite-react / html / nestjs-react-fullstack)
|
|
187
|
-
否则 --app-type 传了 → 查表:html→html, modern_html→html, jspage→vite-react, full_stack→nestjs-react-fullstack
|
|
190
|
+
--template 传了 → 直接用(vite-react / html / design-html / nestjs-react-fullstack)
|
|
191
|
+
否则 --app-type 传了 → 查表:html→design-html, modern_html→html, jspage→vite-react, full_stack→nestjs-react-fullstack
|
|
188
192
|
两者都没传 → 报错 ARGS_INVALID
|
|
189
193
|
|
|
190
194
|
源码导入(--source-path)
|
|
@@ -193,11 +197,11 @@ function registerAppInit(parent) {
|
|
|
193
197
|
source-path 不存在 → 报错;非 modern_html 传了 source-path → 警告并忽略,继续正常 init。
|
|
194
198
|
app_type 不写入 .spark/meta.json。
|
|
195
199
|
|
|
196
|
-
|
|
197
|
-
init
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
200
|
+
平台同步(不在 init 内做)
|
|
201
|
+
init 不跑 'miaoda app sync' 的任何子动作(SyncRule 应用 / 平台脚本覆盖 / patches /
|
|
202
|
+
升 @lark-apaas/* 到 latest)。渲染出的 scripts/ 等是 template 包发版时的版本,
|
|
203
|
+
package.json 与 template 完全一致。首次同步交给 'miaoda app sync':本地 dev.sh 入口
|
|
204
|
+
起服务前会先跑一次,沙箱 pod 启动阶段平台侧也会做,init 不重复。
|
|
201
205
|
|
|
202
206
|
依赖安装
|
|
203
207
|
默认:npm install --no-audit --no-fund
|
|
@@ -54,7 +54,8 @@ const MANAGED_PLATFORM_PACKAGES = {
|
|
|
54
54
|
* 执行流:
|
|
55
55
|
* 1. SyncRule[] 全量 apply —— 来自 src/config/sync-configs/<stack>.ts。每个 stack
|
|
56
56
|
* 自带模板资源在 upgrade/templates/<stack>/templates/。表里没有该 stack 时回退到
|
|
57
|
-
* 旧 platform-sync 兜底(兼容尚未迁移的 stack
|
|
57
|
+
* 旧 platform-sync 兜底(兼容尚未迁移的 stack);两者都识别不了(无 SyncConfig 且无
|
|
58
|
+
* upgrade/templates/<stack>/)→ 跳过同步(no-op, skipped=true),不报错。
|
|
58
59
|
* 2. 平台 deps 指 latest —— user app 已装的 @lark-apaas/* 按 MANAGED_PLATFORM_PACKAGES
|
|
59
60
|
* 白名单改写为 "latest"(紧急止血时表里可填具体版本)。
|
|
60
61
|
* 3. activateGitHooks —— 设置 core.hooksPath(template 自带 .githooks/pre-commit)。
|
|
@@ -71,14 +72,31 @@ async function handleAppSync(opts) {
|
|
|
71
72
|
if (meta.stack === undefined || meta.stack === '') {
|
|
72
73
|
throw new error_1.AppError('SYNC_META_INCOMPLETE', '.spark/meta.json missing stack — run `miaoda app init` first');
|
|
73
74
|
}
|
|
74
|
-
// 1. apply SyncRule[],stack 没注册时回退到旧 platform-sync
|
|
75
|
+
// 1. apply SyncRule[],stack 没注册时回退到旧 platform-sync 兜底
|
|
75
76
|
const syncResults = runStackSync(meta.stack, targetDir, 'sync');
|
|
77
|
+
// stack 未纳入 sync 范围(既无 SyncConfig 也无 upgrade/templates/<stack>/):跳过同步(no-op),
|
|
78
|
+
// 不报错。sync 会在 dev.sh 本地入口 / 沙箱 pod 启动阶段被调用,对不需要 cli 侧 sync 的 stack
|
|
79
|
+
// (如 design-html buildless 静态 HTML)不该阻断启动链路。
|
|
76
80
|
if (!syncResults.stackFound) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
(0, logger_1.log)('sync', `stack '${meta.stack}' 未纳入 sync 范围,跳过同步 (no-op)`);
|
|
82
|
+
if (!(0, output_1.isJsonMode)()) {
|
|
83
|
+
process.stdout.write(`⚠ stack '${meta.stack}' 未纳入 sync 范围,已跳过同步\n`);
|
|
84
|
+
}
|
|
85
|
+
(0, output_1.emit)({
|
|
86
|
+
data: {
|
|
87
|
+
stack: meta.stack,
|
|
88
|
+
skipped: true,
|
|
89
|
+
reason: 'stack_not_in_sync_scope',
|
|
90
|
+
appliedRules: [],
|
|
91
|
+
syncedFiles: [],
|
|
92
|
+
mergedJsonFiles: [],
|
|
93
|
+
patchedScripts: [],
|
|
94
|
+
upgradedPackages: [],
|
|
95
|
+
gitHooks: 'skipped',
|
|
96
|
+
installError: undefined,
|
|
97
|
+
},
|
|
81
98
|
});
|
|
99
|
+
return;
|
|
82
100
|
}
|
|
83
101
|
// 2. activate git hooks(template 自带 .githooks/pre-commit,core.hooksPath 一次性设置)
|
|
84
102
|
const hookActivation = (0, githooks_1.activateGitHooks)(targetDir);
|
|
@@ -138,8 +156,8 @@ exports.handleAppUpgrade = handleAppSync;
|
|
|
138
156
|
* stack 在 STACK_REGISTRY 注册时走新 SyncRule 机制,否则回落到旧 platform-sync。
|
|
139
157
|
*
|
|
140
158
|
* stack 完全不识别(既不在 STACK_REGISTRY 也无 upgrade/templates/<stack>/ 目录)时返回
|
|
141
|
-
* `stackFound: false` 而非抛错 —— 让调用方按场景决定:sync handler
|
|
142
|
-
*
|
|
159
|
+
* `stackFound: false` 而非抛错 —— 让调用方按场景决定:sync handler 跳过同步(no-op),init handler
|
|
160
|
+
* 也允许(fresh init 时 stack 还在加注册的过渡期)。
|
|
143
161
|
*/
|
|
144
162
|
function runStackSync(stack, targetDir, logPrefix) {
|
|
145
163
|
const config = (0, sync_configs_1.getSyncConfig)(stack);
|
|
@@ -32,7 +32,7 @@ exports.SUPPORTED_STACKS = Object.keys(exports.TEMPLATE_PACKAGE_BY_STACK);
|
|
|
32
32
|
* 与 src/api/app/types.ts 的 AppType 枚举无关,是独立的业务类型概念。
|
|
33
33
|
*/
|
|
34
34
|
exports.STACK_BY_APP_TYPE = {
|
|
35
|
-
html: 'html',
|
|
35
|
+
html: 'design-html',
|
|
36
36
|
modern_html: 'html',
|
|
37
37
|
jspage: 'vite-react',
|
|
38
38
|
full_stack: 'nestjs-react-fullstack',
|