@lark-apaas/miaoda-cli 0.1.24-alpha.28e47ce → 0.1.24-alpha.fb2cf0a
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,9 +96,6 @@ 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
|
-
|
|
102
99
|
JSON 输出
|
|
103
100
|
{"data": {"stack": "...",
|
|
104
101
|
"appliedRules": [{"type": "...", "action": "...", "path": "...", "detail": "..."}],
|
|
@@ -106,7 +103,6 @@ JSON 输出
|
|
|
106
103
|
"mergedJsonFiles": [{"path": "...", "keys": [...]}],
|
|
107
104
|
"patchedScripts": [...],
|
|
108
105
|
"upgradedPackages": [{"name": "...", "from": "...", "to": "...", "section": "..."}]}}
|
|
109
|
-
跳过时:{"data": {"stack": "...", "skipped": true, "reason": "stack_not_in_sync_scope", ...空数组}}
|
|
110
106
|
|
|
111
107
|
示例
|
|
112
108
|
$ miaoda app sync
|
|
@@ -197,11 +193,11 @@ function registerAppInit(parent) {
|
|
|
197
193
|
source-path 不存在 → 报错;非 modern_html 传了 source-path → 警告并忽略,继续正常 init。
|
|
198
194
|
app_type 不写入 .spark/meta.json。
|
|
199
195
|
|
|
200
|
-
|
|
201
|
-
init
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
196
|
+
平台同步(upgrade/templates)
|
|
197
|
+
init 内嵌一次 upgrade/templates 同步(跟 app upgrade 共用同一份 util):
|
|
198
|
+
从 miaoda-cli 自带的 upgrade/templates/<stack>/ 同步 files/(覆盖)+ patches/
|
|
199
|
+
(JSON deep merge,含 scripts.dev:local 等)。目标 stack 未纳入 upgrade/templates/
|
|
200
|
+
时跳过(不报错)。后续要把 @lark-apaas/* 平台包统一指 latest,跑 'miaoda app upgrade'。
|
|
205
201
|
|
|
206
202
|
依赖安装
|
|
207
203
|
默认:npm install --no-audit --no-fund
|
|
@@ -54,8 +54,7 @@ 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
|
|
58
|
-
* upgrade/templates/<stack>/)→ 跳过同步(no-op, skipped=true),不报错。
|
|
57
|
+
* 旧 platform-sync 兜底(兼容尚未迁移的 stack)。
|
|
59
58
|
* 2. 平台 deps 指 latest —— user app 已装的 @lark-apaas/* 按 MANAGED_PLATFORM_PACKAGES
|
|
60
59
|
* 白名单改写为 "latest"(紧急止血时表里可填具体版本)。
|
|
61
60
|
* 3. activateGitHooks —— 设置 core.hooksPath(template 自带 .githooks/pre-commit)。
|
|
@@ -72,31 +71,14 @@ async function handleAppSync(opts) {
|
|
|
72
71
|
if (meta.stack === undefined || meta.stack === '') {
|
|
73
72
|
throw new error_1.AppError('SYNC_META_INCOMPLETE', '.spark/meta.json missing stack — run `miaoda app init` first');
|
|
74
73
|
}
|
|
75
|
-
// 1. apply SyncRule[],stack 没注册时回退到旧 platform-sync
|
|
74
|
+
// 1. apply SyncRule[],stack 没注册时回退到旧 platform-sync 兜底;都不识别就报错
|
|
76
75
|
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)不该阻断启动链路。
|
|
80
76
|
if (!syncResults.stackFound) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
},
|
|
77
|
+
throw new error_1.AppError('SYNC_STACK_NOT_SUPPORTED', `stack '${meta.stack}' has no SyncConfig and no upgrade/templates/${meta.stack}/ — 该 stack 暂未纳入 sync 范围`, {
|
|
78
|
+
next_actions: [
|
|
79
|
+
`src/config/sync-configs/${meta.stack}.ts 加 SyncConfig 并在 STACK_REGISTRY 注册`,
|
|
80
|
+
],
|
|
98
81
|
});
|
|
99
|
-
return;
|
|
100
82
|
}
|
|
101
83
|
// 2. activate git hooks(template 自带 .githooks/pre-commit,core.hooksPath 一次性设置)
|
|
102
84
|
const hookActivation = (0, githooks_1.activateGitHooks)(targetDir);
|
|
@@ -156,8 +138,8 @@ exports.handleAppUpgrade = handleAppSync;
|
|
|
156
138
|
* stack 在 STACK_REGISTRY 注册时走新 SyncRule 机制,否则回落到旧 platform-sync。
|
|
157
139
|
*
|
|
158
140
|
* stack 完全不识别(既不在 STACK_REGISTRY 也无 upgrade/templates/<stack>/ 目录)时返回
|
|
159
|
-
* `stackFound: false` 而非抛错 —— 让调用方按场景决定:sync handler
|
|
160
|
-
*
|
|
141
|
+
* `stackFound: false` 而非抛错 —— 让调用方按场景决定:sync handler 抛 AppError,init handler
|
|
142
|
+
* 允许(fresh init 时 stack 还在加注册的过渡期)。
|
|
161
143
|
*/
|
|
162
144
|
function runStackSync(stack, targetDir, logPrefix) {
|
|
163
145
|
const config = (0, sync_configs_1.getSyncConfig)(stack);
|