@lark-apaas/miaoda-cli 0.1.0-alpha.c11e8f1 → 0.1.0-alpha.fff8344
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.
|
@@ -7,7 +7,9 @@ exports.withHelp = withHelp;
|
|
|
7
7
|
exports.failArgs = failArgs;
|
|
8
8
|
const commander_1 = require("commander");
|
|
9
9
|
const error_1 = require("../../utils/error");
|
|
10
|
-
/** --app-id option,需要应用上下文的命令自行 .addOption(appIdOption())
|
|
10
|
+
/** --app-id option,需要应用上下文的命令自行 .addOption(appIdOption())。
|
|
11
|
+
* Commander 的 .env() 只接受单个变量名,第二个兜底 `app_id` 在 resolveAppId 里手动检查。
|
|
12
|
+
*/
|
|
11
13
|
function appIdOption() {
|
|
12
14
|
return new commander_1.Option("--app-id <id>", "指定目标应用").env("MIAODA_APP_ID");
|
|
13
15
|
}
|
|
@@ -17,9 +19,12 @@ function appIdOption() {
|
|
|
17
19
|
function softRequiredOption(name, desc) {
|
|
18
20
|
return new commander_1.Option(name, desc);
|
|
19
21
|
}
|
|
20
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* 解析 appId,优先级:CLI flag > MIAODA_APP_ID > app_id > 抛错。
|
|
24
|
+
* app_id 是部分外部沙箱环境注入应用 ID 的别名,作为兜底兼容(小写下划线形态)。
|
|
25
|
+
*/
|
|
21
26
|
function resolveAppId(opts) {
|
|
22
|
-
const id = opts.appId ?? process.env.MIAODA_APP_ID;
|
|
27
|
+
const id = opts.appId ?? process.env.MIAODA_APP_ID ?? process.env.app_id;
|
|
23
28
|
if (!id) {
|
|
24
29
|
throw new error_1.AppError("APP_ID_MISSING", "未指定应用", {
|
|
25
30
|
next_actions: [
|