i18-fe-automator-beta 2.1.1 → 2.1.2

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.
@@ -196,11 +196,23 @@ function importExcel({ uploadFilePath, token, env }) {
196
196
  }
197
197
  function readExcel({ uploadFilePath }) {
198
198
  return new Promise((resolve, reject) => {
199
- // 读取文件
200
- const workSheetsFromFile = xlsx.parse(uploadFilePath);
201
- const data = workSheetsFromFile[0].data;
202
- // 获取第一行
203
- const titleList = data[0];
199
+ // 读取文件(损坏/非excel文件解析会同步抛错, 转为友好提示)
200
+ let workSheetsFromFile;
201
+ try {
202
+ workSheetsFromFile = xlsx.parse(uploadFilePath);
203
+ } catch (e) {
204
+ reject(
205
+ new Error(`${uploadFilePath} 解析失败, 请检查是否为有效的excel文件`)
206
+ );
207
+ return;
208
+ }
209
+ // 空 sheet 防护: 无sheet或首个sheet无数据时给出友好提示而非TypeError
210
+ const data = workSheetsFromFile[0]?.data;
211
+ const titleList = data?.[0];
212
+ if (!titleList || !titleList.length) {
213
+ reject(new Error(`${uploadFilePath} 文件无数据, 请检查首个sheet是否为空`));
214
+ return;
215
+ }
204
216
  // 获取项目所在的列
205
217
  let projectIndex;
206
218
  if (titleList.indexOf("项目") > -1) {
@@ -386,271 +398,295 @@ async function resolveSecretQuestions({
386
398
  return resolved;
387
399
  }
388
400
 
389
- const sleep = (time) =>
390
- new Promise((resolve = 2000) => {
391
- setTimeout(() => resolve, time);
392
- });
393
- // 上传翻译包(支持 --env/--files/--username/--password/--cache 一键, 参数齐全时跳过确认/选择)
401
+ const sleep = (time) =>
402
+ new Promise((resolve) => {
403
+ setTimeout(resolve, time);
404
+ });
405
+ // 上传翻译包(支持 --env/--files/--username/--password/--cache 一键, 参数齐全时跳过确认/选择)
394
406
  async function upload$1(cliOpts = {}) {
395
- // 空字符串视为未传(与askOrUse语义一致)
396
- const cliEnv = cliOpts.env || undefined;
397
- const cliFiles = cliOpts.files || undefined;
398
- const cliUsername = cliOpts.username || undefined;
399
- const cliPassword = cliOpts.password || undefined;
400
- const cache = Boolean(cliOpts.cache);
401
- // 传了任一CLI参数即视为一键意图, 跳过"是否上传"确认(传参即意图)
402
- const oneClick =
403
- cliEnv !== undefined ||
404
- cliFiles !== undefined ||
405
- cliUsername !== undefined ||
406
- cliPassword !== undefined ||
407
- cache;
408
- // CLI参数校验前置(快速失败, 不进交互)
409
- if (cliEnv !== undefined) {
410
- const envArr = cliEnv
411
- .split(",")
412
- .map((item) => item.trim())
413
- .filter(Boolean);
414
- if (envArr.length === 1) {
415
- if (!["mit", "sit", "uat", "pro"].includes(envArr[0])) {
416
- console.log(
417
- chalk.red(
418
- `参数 --env 的值 "${cliEnv}" 不合法, 可选值: mit | sit | uat | pro, 多环境逗号分隔(仅mit/sit/uat, pro须单独传)`
419
- )
420
- );
421
- process.exit(1);
422
- }
423
- } else {
424
- const invalid = envArr.filter(
425
- (item) => !["mit", "sit", "uat"].includes(item)
426
- );
427
- if (invalid.length) {
428
- console.log(
429
- chalk.red(
430
- `多环境仅支持 mit | sit | uat 逗号分隔, 不支持: ${invalid.join(
431
- " | "
432
- )} (pro须单独传)`
433
- )
434
- );
435
- process.exit(1);
436
- }
437
- }
438
- }
439
- const excelChoices = fs
440
- .readdirSync("./")
441
- .filter((item) => item.indexOf(".xlsx") > -1 || item.indexOf(".xls") > -1);
442
- if (excelChoices.length === 0) {
443
- console.log(chalk.red("当前目录下没有excel文件(.xlsx/.xls)"));
444
- process.exit(1);
445
- }
446
- let cliFileArr;
447
- if (cliFiles !== undefined) {
448
- if (cliFiles === "all") {
449
- cliFileArr = excelChoices;
450
- } else {
451
- cliFileArr = cliFiles
452
- .split(",")
453
- .map((item) => item.trim())
454
- .filter(Boolean);
455
- const invalid = cliFileArr.filter((item) => !excelChoices.includes(item));
456
- if (invalid.length) {
457
- console.log(
458
- chalk.red(`当前目录不存在excel文件: ${invalid.join(", ")}`)
459
- );
460
- process.exit(1);
461
- }
462
- }
463
- }
464
- // 1.是否上传(一键模式跳过, 选否属用户主动取消, exit 0)
465
- if (!oneClick) {
466
- const { isUpload } = await inquirer.prompt([
467
- {
468
- message: "是否上传到sass平台",
469
- name: "isUpload",
470
- type: "confirm",
471
- default: true,
472
- },
473
- ]);
474
- if (!isUpload) {
475
- return;
476
- }
477
- }
478
- // 2.选择环境(CLI参数 > 交互)
479
- let envValue;
480
- if (cliEnv !== undefined) {
481
- envValue = cliEnv
482
- .split(",")
483
- .map((item) => item.trim())
484
- .filter(Boolean)
485
- .join(",");
486
- } else {
487
- const res = await inquirer.prompt([
488
- {
489
- message: "请选择环境",
490
- name: "env",
491
- type: "rawlist",
492
- choices: [
493
- {
494
- name: "mit",
495
- value: "mit",
496
- },
497
- {
498
- name: "sit",
499
- value: "sit",
500
- },
501
- {
502
- name: "uat",
503
- value: "uat",
504
- },
505
- {
506
- name: "pro",
507
- value: "pro",
508
- },
509
- {
510
- name: "一键发布uat(mit->sit->uat)",
511
- value: "to-mit,sit,uat",
512
- },
513
- {
514
- name: "一键发布sit(mit->sit)",
515
- value: "to-mit,sit",
516
- },
517
- ],
518
- validate: function (val) {
519
- if (val.length > 0) {
520
- return true;
521
- }
522
- return "请选择环境";
523
- },
524
- },
525
- ]);
526
- envValue = res.env;
527
- }
528
- // 统一解析: 去掉to-前缀(兼容交互选择值) → 按逗号拆分
529
- const envList = envValue
530
- .replace(/^to-/, "")
531
- .split(",")
532
- .map((item) => item.trim())
533
- .filter(Boolean);
534
- const isPro = envList.length === 1 && envList[0] === "pro";
535
- // 3.凭据: CLI参数 > --cache缓存 > 交互(展示缓存默认值), 解析后回写缓存
536
- const secret = await resolveSecretQuestions({
537
- questions: [
538
- {
539
- message: isPro ? "请输入生产域账号" : "请输入域账号",
540
- name: "username",
541
- // 必填
542
- validate: function (val) {
543
- if (val) {
544
- return true;
545
- }
546
- return isPro ? "请输入生产域账号" : "请输入域账号";
547
- },
548
- },
549
- {
550
- message: isPro ? "请输入生产域密码" : "请输入域密码",
551
- name: "password",
552
- // 必填
553
- validate: function (val) {
554
- if (val) {
555
- return true;
556
- }
557
- return isPro ? "请输入生产域密码" : "请输入域密码";
558
- },
559
- },
560
- ],
561
- cliValues: { username: cliUsername, password: cliPassword },
562
- useCache: cache,
563
- cacheKey: isPro ? "sass_pro" : "sass",
564
- });
565
- const { username, password } = secret;
566
- // 4.选择上传文件(CLI参数 > 交互, 交互带全选联动)
567
- let excelFileNames;
568
- if (cliFileArr !== undefined) {
569
- excelFileNames = cliFileArr;
570
- } else {
571
- inquirer.registerPrompt("checkbox-all", CheckboxAllPrompt);
572
- // 选项拼接序号,与数字键选择对应(按1选全选,按2选第一个文件...)
573
- const promptChoices = [
574
- { name: "全选", value: SELECT_ALL, short: "全选" },
575
- ...excelChoices.map((file) => ({ name: file, value: file, short: file })),
576
- ].map((choice, index) => ({
577
- ...choice,
578
- name: `${index + 1}. ${choice.name}`,
579
- }));
580
- const res = await inquirer.prompt([
581
- {
582
- type: "checkbox-all",
583
- name: "excelFileNames",
584
- message: "请选择要上传的excel文件(可多选)",
585
- choices: promptChoices,
586
- validate: function (val) {
587
- if (val.length > 0) {
588
- return true;
589
- }
590
- return "请选择要上传的excel文件";
591
- },
592
- },
593
- ]);
594
- excelFileNames = res.excelFileNames;
595
- // 勾选了全选则上传所有文件
596
- if (excelFileNames.includes(SELECT_ALL)) {
597
- excelFileNames = excelChoices;
598
- }
599
- }
600
- // 环境外层循环(每个环境只登录一次),文件内层循环批量上传
601
- const failList = [];
602
- for (const env of envList) {
603
- // 1.登录
604
- let token;
605
- try {
606
- token = await login({
607
- env,
608
- username,
609
- password,
610
- });
611
- } catch (e) {
612
- console.log(chalk.red(`${env} 登录失败: ${e.message || e}`));
613
- failList.push(`${env} 登录`);
614
- continue;
615
- }
616
- for (const excelFileName of excelFileNames) {
617
- const uploadFilePath = "./" + excelFileName;
618
- try {
619
- // 2.读取excel
620
- const projectList = await readExcel({ uploadFilePath });
621
- // 3.导入excel
622
- await importExcel({
623
- uploadFilePath,
624
- token,
625
- env,
626
- });
627
- await sleep(2000);
628
- // 4.上传
629
- await uploadExcel({
630
- data: {
631
- projectList,
632
- },
633
- token,
634
- env,
635
- });
636
- console.log(
637
- `🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀${env} ${excelFileName} 成功`
638
- );
639
- } catch (e) {
640
- console.log(
641
- chalk.red(`${env} ${excelFileName} 失败: ${e.message || e}`)
642
- );
643
- failList.push(`${env} ${excelFileName}`);
644
- }
645
- }
646
- }
647
- // 汇总失败项(登录失败也计入, 统一失败退出码1)
648
- if (failList.length > 0) {
649
- console.log(
650
- chalk.red(`\n以下 ${failList.length} 项上传失败,请检查:\n- ${failList.join("\n- ")}`)
651
- );
652
- process.exit(1);
653
- }
407
+ // 空字符串视为未传(与askOrUse语义一致); 兼容交互菜单的to-前缀值(如 to-mit,sit,uat)
408
+ const cliEnv = (cliOpts.env || undefined)?.replace(/^to-/, "");
409
+ const cliFiles = cliOpts.files || undefined;
410
+ const cliUsername = cliOpts.username || undefined;
411
+ const cliPassword = cliOpts.password || undefined;
412
+ const cache = Boolean(cliOpts.cache);
413
+ // 传了任一CLI参数即视为一键意图, 跳过"是否上传"确认(传参即意图)
414
+ const oneClick =
415
+ cliEnv !== undefined ||
416
+ cliFiles !== undefined ||
417
+ cliUsername !== undefined ||
418
+ cliPassword !== undefined ||
419
+ cache;
420
+ // CLI参数校验前置(快速失败, 不进交互)
421
+ if (cliEnv !== undefined) {
422
+ const envArr = cliEnv
423
+ .split(",")
424
+ .map((item) => item.trim())
425
+ .filter(Boolean);
426
+ // 纯分隔符/空白值( ",")解析后为空数组, 须快速失败避免静默零上传
427
+ if (envArr.length === 0) {
428
+ console.log(
429
+ chalk.red(
430
+ `参数 --env 的值 "${cliEnv}" 不合法, 可选值: mit | sit | uat | pro, 多环境逗号分隔(仅mit/sit/uat, pro须单独传)`
431
+ )
432
+ );
433
+ process.exit(1);
434
+ }
435
+ if (envArr.length === 1) {
436
+ if (!["mit", "sit", "uat", "pro"].includes(envArr[0])) {
437
+ console.log(
438
+ chalk.red(
439
+ `参数 --env 的值 "${cliEnv}" 不合法, 可选值: mit | sit | uat | pro, 多环境逗号分隔(仅mit/sit/uat, pro须单独传)`
440
+ )
441
+ );
442
+ process.exit(1);
443
+ }
444
+ } else {
445
+ const invalid = envArr.filter(
446
+ (item) => !["mit", "sit", "uat"].includes(item)
447
+ );
448
+ if (invalid.length) {
449
+ console.log(
450
+ chalk.red(
451
+ `多环境仅支持 mit | sit | uat 逗号分隔, 不支持: ${invalid.join(
452
+ " | "
453
+ )} (pro须单独传)`
454
+ )
455
+ );
456
+ process.exit(1);
457
+ }
458
+ }
459
+ }
460
+ const excelChoices = fs
461
+ .readdirSync("./")
462
+ .filter(
463
+ (item) =>
464
+ // 后缀精确匹配(.xls/.xlsx), 排除Excel锁文件(~$开头)与目录
465
+ /\.xlsx?$/i.test(item) &&
466
+ !item.startsWith("~$") &&
467
+ fs.statSync(item).isFile()
468
+ );
469
+ if (excelChoices.length === 0) {
470
+ console.log(chalk.red("当前目录下没有excel文件(.xlsx/.xls)"));
471
+ process.exit(1);
472
+ }
473
+ let cliFileArr;
474
+ if (cliFiles !== undefined) {
475
+ if (cliFiles === "all") {
476
+ cliFileArr = excelChoices;
477
+ } else {
478
+ cliFileArr = cliFiles
479
+ .split(",")
480
+ .map((item) => item.trim())
481
+ .filter(Boolean);
482
+ // 纯分隔符/空白值(如 ",")解析后为空数组, 须快速失败避免静默零上传
483
+ if (!cliFileArr.length) {
484
+ console.log(
485
+ chalk.red(
486
+ `参数 --files 的值 "${cliFiles}" 不合法, 可选值: 逗号分隔的excel文件名或all(全部)`
487
+ )
488
+ );
489
+ process.exit(1);
490
+ }
491
+ const invalid = cliFileArr.filter((item) => !excelChoices.includes(item));
492
+ if (invalid.length) {
493
+ console.log(
494
+ chalk.red(`当前目录不存在excel文件: ${invalid.join(", ")}`)
495
+ );
496
+ process.exit(1);
497
+ }
498
+ }
499
+ }
500
+ // 1.是否上传(一键模式跳过, 选否属用户主动取消, exit 0)
501
+ if (!oneClick) {
502
+ const { isUpload } = await inquirer.prompt([
503
+ {
504
+ message: "是否上传到sass平台",
505
+ name: "isUpload",
506
+ type: "confirm",
507
+ default: true,
508
+ },
509
+ ]);
510
+ if (!isUpload) {
511
+ return;
512
+ }
513
+ }
514
+ // 2.选择环境(CLI参数 > 交互)
515
+ let envValue;
516
+ if (cliEnv !== undefined) {
517
+ envValue = cliEnv
518
+ .split(",")
519
+ .map((item) => item.trim())
520
+ .filter(Boolean)
521
+ .join(",");
522
+ } else {
523
+ const res = await inquirer.prompt([
524
+ {
525
+ message: "请选择环境",
526
+ name: "env",
527
+ type: "rawlist",
528
+ choices: [
529
+ {
530
+ name: "mit",
531
+ value: "mit",
532
+ },
533
+ {
534
+ name: "sit",
535
+ value: "sit",
536
+ },
537
+ {
538
+ name: "uat",
539
+ value: "uat",
540
+ },
541
+ {
542
+ name: "pro",
543
+ value: "pro",
544
+ },
545
+ {
546
+ name: "一键发布uat(mit->sit->uat)",
547
+ value: "to-mit,sit,uat",
548
+ },
549
+ {
550
+ name: "一键发布sit(mit->sit)",
551
+ value: "to-mit,sit",
552
+ },
553
+ ],
554
+ validate: function (val) {
555
+ if (val.length > 0) {
556
+ return true;
557
+ }
558
+ return "请选择环境";
559
+ },
560
+ },
561
+ ]);
562
+ envValue = res.env;
563
+ }
564
+ // 统一解析: 去掉to-前缀(兼容交互选择值) → 按逗号拆分
565
+ const envList = envValue
566
+ .replace(/^to-/, "")
567
+ .split(",")
568
+ .map((item) => item.trim())
569
+ .filter(Boolean);
570
+ const isPro = envList.length === 1 && envList[0] === "pro";
571
+ // 3.凭据: CLI参数 > --cache缓存 > 交互(展示缓存默认值), 解析后回写缓存
572
+ const secret = await resolveSecretQuestions({
573
+ questions: [
574
+ {
575
+ message: isPro ? "请输入生产域账号" : "请输入域账号",
576
+ name: "username",
577
+ // 必填
578
+ validate: function (val) {
579
+ if (val) {
580
+ return true;
581
+ }
582
+ return isPro ? "请输入生产域账号" : "请输入域账号";
583
+ },
584
+ },
585
+ {
586
+ message: isPro ? "请输入生产域密码" : "请输入域密码",
587
+ name: "password",
588
+ // 必填
589
+ validate: function (val) {
590
+ if (val) {
591
+ return true;
592
+ }
593
+ return isPro ? "请输入生产域密码" : "请输入域密码";
594
+ },
595
+ },
596
+ ],
597
+ cliValues: { username: cliUsername, password: cliPassword },
598
+ useCache: cache,
599
+ cacheKey: isPro ? "sass_pro" : "sass",
600
+ });
601
+ const { username, password } = secret;
602
+ // 4.选择上传文件(CLI参数 > 交互, 交互带全选联动)
603
+ let excelFileNames;
604
+ if (cliFileArr !== undefined) {
605
+ excelFileNames = cliFileArr;
606
+ } else {
607
+ inquirer.registerPrompt("checkbox-all", CheckboxAllPrompt);
608
+ // 选项拼接序号,与数字键选择对应(按1选全选,按2选第一个文件...)
609
+ const promptChoices = [
610
+ { name: "全选", value: SELECT_ALL, short: "全选" },
611
+ ...excelChoices.map((file) => ({ name: file, value: file, short: file })),
612
+ ].map((choice, index) => ({
613
+ ...choice,
614
+ name: `${index + 1}. ${choice.name}`,
615
+ }));
616
+ const res = await inquirer.prompt([
617
+ {
618
+ type: "checkbox-all",
619
+ name: "excelFileNames",
620
+ message: "请选择要上传的excel文件(可多选)",
621
+ choices: promptChoices,
622
+ validate: function (val) {
623
+ if (val.length > 0) {
624
+ return true;
625
+ }
626
+ return "请选择要上传的excel文件";
627
+ },
628
+ },
629
+ ]);
630
+ excelFileNames = res.excelFileNames;
631
+ // 勾选了全选则上传所有文件
632
+ if (excelFileNames.includes(SELECT_ALL)) {
633
+ excelFileNames = excelChoices;
634
+ }
635
+ }
636
+ // 环境外层循环(每个环境只登录一次),文件内层循环批量上传
637
+ const failList = [];
638
+ for (const env of envList) {
639
+ // 1.登录
640
+ let token;
641
+ try {
642
+ token = await login({
643
+ env,
644
+ username,
645
+ password,
646
+ });
647
+ } catch (e) {
648
+ console.log(chalk.red(`${env} 登录失败: ${e.message || e}`));
649
+ failList.push(`${env} 登录`);
650
+ continue;
651
+ }
652
+ for (const excelFileName of excelFileNames) {
653
+ const uploadFilePath = "./" + excelFileName;
654
+ try {
655
+ // 2.读取excel
656
+ const projectList = await readExcel({ uploadFilePath });
657
+ // 3.导入excel
658
+ await importExcel({
659
+ uploadFilePath,
660
+ token,
661
+ env,
662
+ });
663
+ await sleep(2000);
664
+ // 4.上传
665
+ await uploadExcel({
666
+ data: {
667
+ projectList,
668
+ },
669
+ token,
670
+ env,
671
+ });
672
+ console.log(
673
+ `🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀${env} ${excelFileName} 成功`
674
+ );
675
+ } catch (e) {
676
+ console.log(
677
+ chalk.red(`${env} ${excelFileName} 失败: ${e.message || e}`)
678
+ );
679
+ failList.push(`${env} ${excelFileName}`);
680
+ }
681
+ }
682
+ }
683
+ // 汇总失败项(登录失败也计入, 统一失败退出码1)
684
+ if (failList.length > 0) {
685
+ console.log(
686
+ chalk.red(`\n以下 ${failList.length} 项上传失败,请检查:\n- ${failList.join("\n- ")}`)
687
+ );
688
+ process.exit(1);
689
+ }
654
690
  }
655
691
 
656
692
  // 百度翻译接口
@@ -867,7 +903,13 @@ async function excelFn(cliOpts = {}) {
867
903
  // 1.获取excel文件列表, CLI传入file先校验存在性(快速失败, 不进交互)
868
904
  const choices = fs
869
905
  .readdirSync("./")
870
- .filter((item) => item.indexOf(".xlsx") > -1 || item.indexOf(".xls") > -1);
906
+ .filter(
907
+ (item) =>
908
+ // 后缀精确匹配(.xls/.xlsx), 排除Excel锁文件(~$开头)与目录
909
+ /\.xlsx?$/i.test(item) &&
910
+ !item.startsWith("~$") &&
911
+ fs.statSync(item).isFile()
912
+ );
871
913
  if (choices.length === 0) {
872
914
  console.log(chalk.red("当前目录下没有excel文件(.xlsx/.xls)"));
873
915
  process.exit(1);
@@ -1046,7 +1088,6 @@ function getApplicationList({ appName, env, token }) {
1046
1088
  );
1047
1089
  } else {
1048
1090
  const errorData = error || JSON.stringify(res.data);
1049
- console.log(chalk.red(errorData));
1050
1091
  reject(errorData);
1051
1092
  }
1052
1093
  }
@@ -1078,7 +1119,6 @@ function getApplicationConfig({ appId, env, token }) {
1078
1119
  } else {
1079
1120
  Loading$1.fail(`获取应用配置失败`);
1080
1121
  const errorData = error || JSON.stringify(res.data);
1081
- console.log(chalk.red(errorData));
1082
1122
  reject(errorData);
1083
1123
  }
1084
1124
  }
@@ -1110,7 +1150,6 @@ function getApplicationButtonConfig({ appId, env, token }) {
1110
1150
  } else {
1111
1151
  Loading$1.fail(`获取${env}环境按钮权限配置失败`);
1112
1152
  const errorData = error || JSON.stringify(res.data);
1113
- console.log(chalk.red(errorData));
1114
1153
  reject(errorData);
1115
1154
  }
1116
1155
  }
@@ -1139,7 +1178,6 @@ function deleteApplicationButtonConfig({ data, env, token }) {
1139
1178
  resolve(res.data);
1140
1179
  } else {
1141
1180
  const errorData = error || JSON.stringify(res.data);
1142
- console.log(chalk.red(errorData));
1143
1181
  reject(errorData);
1144
1182
  }
1145
1183
  }
@@ -1171,7 +1209,6 @@ function addApplicationButtonConfig({ data, env, token }) {
1171
1209
  } else {
1172
1210
  Loading$1.fail(`${data.code}`);
1173
1211
  const errorData = error || JSON.stringify(res.data);
1174
- console.log(chalk.red(errorData));
1175
1212
  reject(errorData);
1176
1213
  }
1177
1214
  }
@@ -1405,7 +1442,9 @@ async function syncSassFlow(cliOpts) {
1405
1442
  Loading$1.succeed(`删除${to}环境按钮权限配置成功`);
1406
1443
  }
1407
1444
  } catch (error) {
1408
- console.log(chalk.red(`删除${to}环境按钮权限配置失败`));
1445
+ console.log(
1446
+ chalk.red(`删除${to}环境按钮权限配置失败: ${error.message || error}`)
1447
+ );
1409
1448
  } finally {
1410
1449
  try {
1411
1450
  for (const item of fromButtonList) {
@@ -3100,9 +3139,9 @@ const rules = [
3100
3139
  },
3101
3140
  ];
3102
3141
  if (sass) {
3103
- sassMain(cliOpts);
3142
+ sassMain(cliOpts).catch((error) => console.error(error));
3104
3143
  } else if (upload) {
3105
- upload$1(cliOpts);
3144
+ upload$1(cliOpts).catch((error) => console.error(error));
3106
3145
  } else if (lint !== undefined) {
3107
3146
  // 必须传入路径
3108
3147
  if (!lint || !lint.trim()) {
@@ -3126,7 +3165,7 @@ if (sass) {
3126
3165
  } else if (lintc) {
3127
3166
  runLintc().catch((error) => console.error(error));
3128
3167
  } else if (excel) {
3129
- excelFn(cliOpts);
3168
+ excelFn(cliOpts).catch((error) => console.error(error));
3130
3169
  } else {
3131
3170
  runTranslate().catch((error) => console.error(error));
3132
3171
  }