@cloudbase/cli 2.9.9 → 2.9.10-beta.0

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.
Files changed (164) hide show
  1. package/bin/cloudbase.js +2 -1
  2. package/bin/tcb.js +35 -28
  3. package/lib/auth/login.js +21 -13
  4. package/lib/commands/account/login.js +43 -42
  5. package/lib/commands/account/logout.js +3 -2
  6. package/lib/commands/ai/index.js +13 -12
  7. package/lib/commands/cloudfunction/base.js +24 -26
  8. package/lib/commands/cloudrun/base.js +87 -96
  9. package/lib/commands/common.js +11 -10
  10. package/lib/commands/config/delete.js +72 -0
  11. package/lib/commands/config/get.js +69 -0
  12. package/lib/commands/config/index.js +21 -0
  13. package/lib/commands/config/interface.js +24 -0
  14. package/lib/commands/config/list.js +72 -0
  15. package/lib/commands/config/set.js +89 -0
  16. package/lib/commands/db/base.js +33 -32
  17. package/lib/commands/env/base.js +12 -11
  18. package/lib/commands/env/domain.js +24 -23
  19. package/lib/commands/env/login.js +31 -30
  20. package/lib/commands/fun/base.js +37 -36
  21. package/lib/commands/functions/alias/getRoute.js +5 -4
  22. package/lib/commands/functions/alias/setRoute.js +7 -6
  23. package/lib/commands/functions/code-download.js +15 -11
  24. package/lib/commands/functions/code-update.js +8 -7
  25. package/lib/commands/functions/concurrency/delete.js +5 -4
  26. package/lib/commands/functions/concurrency/list.js +6 -5
  27. package/lib/commands/functions/concurrency/set.js +5 -4
  28. package/lib/commands/functions/config-update.js +8 -7
  29. package/lib/commands/functions/copy.js +7 -6
  30. package/lib/commands/functions/delete.js +8 -7
  31. package/lib/commands/functions/deploy.js +35 -34
  32. package/lib/commands/functions/detail.js +32 -31
  33. package/lib/commands/functions/invoke.js +16 -15
  34. package/lib/commands/functions/layer/bind.js +26 -25
  35. package/lib/commands/functions/layer/common.js +2 -1
  36. package/lib/commands/functions/layer/create.js +7 -6
  37. package/lib/commands/functions/layer/delete.js +9 -8
  38. package/lib/commands/functions/layer/download.js +10 -9
  39. package/lib/commands/functions/layer/list.js +10 -9
  40. package/lib/commands/functions/layer/sort.js +9 -8
  41. package/lib/commands/functions/list.js +9 -8
  42. package/lib/commands/functions/log.js +28 -27
  43. package/lib/commands/functions/run.js +21 -20
  44. package/lib/commands/functions/trigger-create.js +9 -8
  45. package/lib/commands/functions/trigger-delete.js +10 -9
  46. package/lib/commands/functions/version/list.js +9 -8
  47. package/lib/commands/functions/version/publish.js +5 -4
  48. package/lib/commands/gateway/create.js +14 -13
  49. package/lib/commands/gateway/delete.js +10 -9
  50. package/lib/commands/gateway/domain.js +25 -24
  51. package/lib/commands/gateway/list.js +11 -10
  52. package/lib/commands/gateway/switch.js +22 -19
  53. package/lib/commands/helpers/init.js +38 -37
  54. package/lib/commands/helpers/new.js +7 -6
  55. package/lib/commands/helpers/open.js +7 -6
  56. package/lib/commands/hosting/hosting.js +45 -44
  57. package/lib/commands/index.js +1 -0
  58. package/lib/commands/pull/pull.js +12 -11
  59. package/lib/commands/run/delete.js +16 -15
  60. package/lib/commands/run/image/common.js +2 -1
  61. package/lib/commands/run/image/delete.js +10 -9
  62. package/lib/commands/run/image/download.js +8 -7
  63. package/lib/commands/run/image/list.js +11 -10
  64. package/lib/commands/run/image/upload.js +9 -8
  65. package/lib/commands/run/list.js +10 -9
  66. package/lib/commands/run/service/config.js +13 -12
  67. package/lib/commands/run/service/deploy.js +24 -23
  68. package/lib/commands/run/service/list.js +10 -9
  69. package/lib/commands/run/service/update.js +22 -21
  70. package/lib/commands/run/standalonegateway/common.js +2 -1
  71. package/lib/commands/run/standalonegateway/create.js +14 -13
  72. package/lib/commands/run/standalonegateway/destroy.js +9 -8
  73. package/lib/commands/run/standalonegateway/list.js +7 -6
  74. package/lib/commands/run/standalonegateway/package.js +7 -6
  75. package/lib/commands/run/standalonegateway/turn.js +10 -9
  76. package/lib/commands/run/version/common.js +2 -1
  77. package/lib/commands/run/version/create.js +41 -40
  78. package/lib/commands/run/version/delete.js +10 -9
  79. package/lib/commands/run/version/list.js +13 -12
  80. package/lib/commands/run/version/modify.js +13 -12
  81. package/lib/commands/run/version/update.js +57 -54
  82. package/lib/commands/runf/base.js +42 -40
  83. package/lib/commands/self-update.js +11 -10
  84. package/lib/commands/smart.js +5 -4
  85. package/lib/commands/storage/storage.js +61 -56
  86. package/lib/commands/third/thirdAttach.js +6 -5
  87. package/lib/commands/utils.js +8 -5
  88. package/lib/constant.js +18 -17
  89. package/lib/decorators/deprecate.js +2 -1
  90. package/lib/function/alias.js +3 -2
  91. package/lib/function/base.js +9 -8
  92. package/lib/function/concurrency.js +4 -3
  93. package/lib/function/create.js +5 -4
  94. package/lib/function/delete.js +2 -1
  95. package/lib/function/layer/attach.js +2 -1
  96. package/lib/function/layer/create.js +2 -1
  97. package/lib/function/layer/download.js +2 -1
  98. package/lib/function/trigger.js +6 -5
  99. package/lib/function/update.js +3 -2
  100. package/lib/function/version.js +3 -2
  101. package/lib/help.js +22 -20
  102. package/lib/hosting.js +18 -17
  103. package/lib/i18n/index.js +81 -0
  104. package/lib/run/service/common.js +14 -13
  105. package/lib/run/service/config.js +4 -3
  106. package/lib/run/service/deployPackage.js +6 -5
  107. package/lib/run/service/showLogs.js +3 -2
  108. package/lib/run/service/update.js +7 -6
  109. package/lib/run/standalonegateway/list.js +5 -1
  110. package/lib/storage.js +2 -1
  111. package/lib/utils/ai/banner.js +12 -11
  112. package/lib/utils/ai/claudeWindows.js +5 -3
  113. package/lib/utils/ai/config.js +3 -2
  114. package/lib/utils/ai/const.js +4 -3
  115. package/lib/utils/ai/env.js +3 -2
  116. package/lib/utils/ai/envLocalManager.js +6 -5
  117. package/lib/utils/ai/nodeVersion.js +5 -1
  118. package/lib/utils/ai/router.js +129 -106
  119. package/lib/utils/ai/setup.js +95 -91
  120. package/lib/utils/checkTcbrEnv.js +22 -21
  121. package/lib/utils/cli-table.js +2 -1
  122. package/lib/utils/commonParamsCheck.js +4 -3
  123. package/lib/utils/debug-logger.js +2 -1
  124. package/lib/utils/dts.js +4 -3
  125. package/lib/utils/env.js +23 -21
  126. package/lib/utils/fs/index.js +5 -4
  127. package/lib/utils/function-packer.js +3 -2
  128. package/lib/utils/index.js +1 -0
  129. package/lib/utils/mcp-config-modifier.js +18 -17
  130. package/lib/utils/net/cloud-api-request.js +2 -1
  131. package/lib/utils/net/credential.js +2 -1
  132. package/lib/utils/net/http-request.js +2 -1
  133. package/lib/utils/progress-bar.js +2 -1
  134. package/lib/utils/prompt/select.js +8 -6
  135. package/lib/utils/store/auth.js +3 -2
  136. package/lib/utils/store/config.js +49 -0
  137. package/lib/utils/store/db.js +5 -0
  138. package/lib/utils/store/index.js +1 -1
  139. package/lib/utils/tcbrApi/callTcbrApi.js +2 -1
  140. package/lib/utils/template-manager.js +37 -36
  141. package/lib/utils/template.js +10 -9
  142. package/lib/utils/tools/common.js +3 -2
  143. package/lib/utils/url.js +19 -0
  144. package/lib/utils/validator.js +12 -4
  145. package/locales/README.md +160 -0
  146. package/locales/i18next-scanner.config.js +206 -0
  147. package/locales/langs/en.json +1235 -0
  148. package/locales/langs/zh.json +1235 -0
  149. package/locales/mapping.json +1235 -0
  150. package/package.json +9 -2
  151. package/types/commands/config/delete.d.ts +13 -0
  152. package/types/commands/config/get.d.ts +13 -0
  153. package/types/commands/config/index.d.ts +5 -0
  154. package/types/commands/config/interface.d.ts +17 -0
  155. package/types/commands/config/list.d.ts +13 -0
  156. package/types/commands/config/set.d.ts +13 -0
  157. package/types/commands/index.d.ts +1 -0
  158. package/types/i18n/index.d.ts +3 -0
  159. package/types/utils/ai/const.d.ts +1 -1
  160. package/types/utils/index.d.ts +1 -0
  161. package/types/utils/store/config.d.ts +8 -0
  162. package/types/utils/store/db.d.ts +2 -0
  163. package/types/utils/store/index.d.ts +1 -1
  164. package/types/utils/url.d.ts +18 -0
@@ -28,34 +28,35 @@ const toolbox_1 = require("@cloudbase/toolbox");
28
28
  const decorators_1 = require("../../../decorators");
29
29
  const common_2 = require("./common");
30
30
  const error_1 = require("../../../error");
31
+ const i18n_1 = require("../../../i18n");
31
32
  let CreateStandalonegateway = class CreateStandalonegateway extends common_1.Command {
32
33
  get options() {
33
34
  return Object.assign(Object.assign({}, (0, common_2.standalonegatewayCommonOptions)('create')), { options: [
34
35
  {
35
36
  flags: '-e, --envId <envId>',
36
- desc: '环境 Id'
37
+ desc: (0, i18n_1.t)('环境 Id')
37
38
  },
38
39
  {
39
40
  flags: '-gA, --gatewayAlias <gatewayAlias>',
40
- desc: '网关 alias'
41
+ desc: (0, i18n_1.t)('网关 alias')
41
42
  },
42
43
  {
43
44
  flags: '-gD, --gatewayDesc <gatewayDesc>',
44
- desc: '网关描述'
45
+ desc: (0, i18n_1.t)('网关描述')
45
46
  },
46
47
  {
47
48
  flags: '-v --vpcId <vpcId>',
48
- desc: 'VPC'
49
+ desc: (0, i18n_1.t)('VPC')
49
50
  },
50
51
  {
51
52
  flags: '-s, --subnetIds <subnetIds...>',
52
- desc: '子网列表'
53
+ desc: (0, i18n_1.t)('子网列表')
53
54
  },
54
55
  {
55
56
  flags: '-p, --packageVersion <packageVersion>',
56
- desc: '套餐版本'
57
+ desc: (0, i18n_1.t)('套餐版本')
57
58
  }
58
- ], desc: '创建小租户网关' });
59
+ ], desc: (0, i18n_1.t)('创建小租户网关') });
59
60
  }
60
61
  execute(envId, options) {
61
62
  return __awaiter(this, void 0, void 0, function* () {
@@ -65,19 +66,19 @@ let CreateStandalonegateway = class CreateStandalonegateway extends common_1.Com
65
66
  vpcId = String(vpcId);
66
67
  packageVersion = String(packageVersion);
67
68
  if (vpcId === '') {
68
- throw new error_1.CloudBaseError('请输入 VPC');
69
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入 VPC'));
69
70
  }
70
71
  if (subnetIds.length === 0) {
71
- throw new error_1.CloudBaseError('请输入子网列表');
72
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入子网列表'));
72
73
  }
73
74
  if (gatewayDesc === '') {
74
- throw new error_1.CloudBaseError('请输入网关描述');
75
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入网关描述'));
75
76
  }
76
77
  if (packageVersion === '') {
77
- throw new error_1.CloudBaseError('请输入套餐版本');
78
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入套餐版本'));
78
79
  }
79
80
  const loading = (0, toolbox_1.loadingFactory)();
80
- loading.start('数据加载中...');
81
+ loading.start((0, i18n_1.t)('数据加载中...'));
81
82
  const data = yield (0, run_1.createStandaloneGateway)({
82
83
  envId,
83
84
  gatewayAlias,
@@ -87,7 +88,7 @@ let CreateStandalonegateway = class CreateStandalonegateway extends common_1.Com
87
88
  packageVersion
88
89
  });
89
90
  loading.stop();
90
- console.log('操作执行成功,网关名称:' + data);
91
+ console.log((0, i18n_1.t)('操作执行成功,网关名称:{{name}}', { name: data }));
91
92
  });
92
93
  }
93
94
  };
@@ -28,22 +28,23 @@ const toolbox_1 = require("@cloudbase/toolbox");
28
28
  const decorators_1 = require("../../../decorators");
29
29
  const common_2 = require("./common");
30
30
  const error_1 = require("../../../error");
31
+ const i18n_1 = require("../../../i18n");
31
32
  let DestroyStandalonegateway = class DestroyStandalonegateway extends common_1.Command {
32
33
  get options() {
33
34
  return Object.assign(Object.assign({}, (0, common_2.standalonegatewayCommonOptions)('destroy')), { options: [
34
35
  {
35
36
  flags: '-e, --envId <envId>',
36
- desc: '环境 Id'
37
+ desc: (0, i18n_1.t)('环境 Id')
37
38
  },
38
39
  {
39
40
  flags: '-gN, --gatewayName <gatewayName>',
40
- desc: '网关 name'
41
+ desc: (0, i18n_1.t)('网关 name')
41
42
  },
42
43
  {
43
44
  flags: '--isForce',
44
- desc: '强制确认删除资源'
45
+ desc: (0, i18n_1.t)('强制确认删除资源')
45
46
  }
46
- ], desc: '销毁小租户网关' });
47
+ ], desc: (0, i18n_1.t)('销毁小租户网关') });
47
48
  }
48
49
  execute(envId, options) {
49
50
  return __awaiter(this, void 0, void 0, function* () {
@@ -51,19 +52,19 @@ let DestroyStandalonegateway = class DestroyStandalonegateway extends common_1.C
51
52
  isForce = Boolean(isForce);
52
53
  gatewayName = String(gatewayName);
53
54
  if (gatewayName === '') {
54
- throw new error_1.CloudBaseError('请输入网关名称');
55
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入网关名称'));
55
56
  }
56
57
  if (!isForce) {
57
- throw new error_1.CloudBaseError('请使用 --isForce 选项确认销毁资源!');
58
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请使用 --isForce 选项确认销毁资源!'));
58
59
  }
59
60
  const loading = (0, toolbox_1.loadingFactory)();
60
- loading.start('数据加载中...');
61
+ loading.start((0, i18n_1.t)('数据加载中...'));
61
62
  yield (0, run_1.destroyStandalonegateway)({
62
63
  envId,
63
64
  gatewayName
64
65
  });
65
66
  loading.stop();
66
- console.log('网关已销毁');
67
+ console.log((0, i18n_1.t)('网关已销毁'));
67
68
  });
68
69
  }
69
70
  };
@@ -28,22 +28,23 @@ const toolbox_1 = require("@cloudbase/toolbox");
28
28
  const decorators_1 = require("../../../decorators");
29
29
  const common_2 = require("./common");
30
30
  const utils_1 = require("../../../utils");
31
+ const i18n_1 = require("../../../i18n");
31
32
  let ListStandalonegateway = class ListStandalonegateway extends common_1.Command {
32
33
  get options() {
33
34
  return Object.assign(Object.assign({}, (0, common_2.standalonegatewayCommonOptions)('list')), { options: [
34
35
  {
35
36
  flags: '-e, --envId <envId>',
36
- desc: '环境 Id'
37
+ desc: (0, i18n_1.t)('环境 Id')
37
38
  },
38
39
  {
39
40
  flags: '-gN, --gatewayName <gatewayName>',
40
- desc: '网关 name'
41
+ desc: (0, i18n_1.t)('网关 name')
41
42
  },
42
43
  {
43
44
  flags: '-gA, --gatewayAlias <gatewayAlias>',
44
- desc: '网关 alias'
45
+ desc: (0, i18n_1.t)('网关 alias')
45
46
  }
46
- ], desc: '查询小租户网关' });
47
+ ], desc: (0, i18n_1.t)('查询小租户网关') });
47
48
  }
48
49
  execute(envId, options) {
49
50
  return __awaiter(this, void 0, void 0, function* () {
@@ -51,14 +52,14 @@ let ListStandalonegateway = class ListStandalonegateway extends common_1.Command
51
52
  gatewayName = String(gatewayName);
52
53
  gatewayAlias = String(gatewayAlias);
53
54
  const loading = (0, toolbox_1.loadingFactory)();
54
- loading.start('数据加载中...');
55
+ loading.start((0, i18n_1.t)('数据加载中...'));
55
56
  const data = yield (0, standalonegateway_1.listStandalonegateway)({
56
57
  envId,
57
58
  gatewayName,
58
59
  gatewayAlias
59
60
  });
60
61
  loading.stop();
61
- const head = ['名称', '状态', '别名', '套餐版本', '子网', '外网IP', '内网IP', '服务信息'];
62
+ const head = [(0, i18n_1.t)('名称'), (0, i18n_1.t)('状态'), (0, i18n_1.t)('别名'), (0, i18n_1.t)('套餐版本'), (0, i18n_1.t)('子网'), (0, i18n_1.t)('外网IP'), (0, i18n_1.t)('内网IP'), (0, i18n_1.t)('服务信息')];
62
63
  (0, utils_1.printHorizontalTable)(head, data);
63
64
  });
64
65
  }
@@ -29,24 +29,25 @@ const decorators_1 = require("../../../decorators");
29
29
  const common_2 = require("./common");
30
30
  const error_1 = require("../../../error");
31
31
  const utils_1 = require("../../../utils");
32
+ const i18n_1 = require("../../../i18n");
32
33
  let PackageStandalonegateway = class PackageStandalonegateway extends common_1.Command {
33
34
  get options() {
34
35
  return Object.assign(Object.assign({}, (0, common_2.standalonegatewayCommonOptions)('package <operation>')), { options: [
35
36
  {
36
37
  flags: '-e, --envId <envId>',
37
- desc: '环境 Id'
38
+ desc: (0, i18n_1.t)('环境 Id')
38
39
  },
39
40
  {
40
41
  flags: '-p, --packageVersion <packageVersion>',
41
- desc: '套餐版本'
42
+ desc: (0, i18n_1.t)('套餐版本')
42
43
  }
43
- ], desc: '套餐操作' });
44
+ ], desc: (0, i18n_1.t)('套餐操作') });
44
45
  }
45
46
  execute(envId, params, options) {
46
47
  return __awaiter(this, void 0, void 0, function* () {
47
48
  const operation = params === null || params === void 0 ? void 0 : params[0];
48
49
  if (!operation || ['list'].indexOf(operation) === -1) {
49
- throw new error_1.CloudBaseError('请输入具体操作');
50
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入具体操作'));
50
51
  }
51
52
  switch (operation) {
52
53
  case 'list':
@@ -55,13 +56,13 @@ let PackageStandalonegateway = class PackageStandalonegateway extends common_1.C
55
56
  appId = String(appId);
56
57
  packageVersion = String(packageVersion);
57
58
  const loading = (0, toolbox_1.loadingFactory)();
58
- loading.start('数据加载中...');
59
+ loading.start((0, i18n_1.t)('数据加载中...'));
59
60
  const data = yield (0, run_1.listPackageStandalonegateway)({
60
61
  envId,
61
62
  packageVersion
62
63
  });
63
64
  loading.stop();
64
- const head = ['CPU', '内存', '版本'];
65
+ const head = [(0, i18n_1.t)('CPU'), (0, i18n_1.t)('内存'), (0, i18n_1.t)('版本')];
65
66
  (0, utils_1.printHorizontalTable)(head, data);
66
67
  }
67
68
  break;
@@ -28,46 +28,47 @@ const toolbox_1 = require("@cloudbase/toolbox");
28
28
  const decorators_1 = require("../../../decorators");
29
29
  const common_2 = require("./common");
30
30
  const error_1 = require("../../../error");
31
+ const i18n_1 = require("../../../i18n");
31
32
  let TurnStandalonegateway = class TurnStandalonegateway extends common_1.Command {
32
33
  get options() {
33
34
  return Object.assign(Object.assign({}, (0, common_2.standalonegatewayCommonOptions)('turn <status>')), { options: [
34
35
  {
35
36
  flags: '-e, --envId <envId>',
36
- desc: '环境 Id'
37
+ desc: (0, i18n_1.t)('环境 Id')
37
38
  },
38
39
  {
39
40
  flags: '-gN, --gatewayName <gatewayName>',
40
- desc: '网关名'
41
+ desc: (0, i18n_1.t)('网关名')
41
42
  },
42
43
  {
43
44
  flags: '-sL, --serviceList <serviceList...>',
44
- desc: '云托管服务列表'
45
+ desc: (0, i18n_1.t)('云托管服务列表')
45
46
  }
46
- ], desc: '启停小租户网关' });
47
+ ], desc: (0, i18n_1.t)('启停小租户网关') });
47
48
  }
48
49
  execute(envId, params, options) {
49
50
  return __awaiter(this, void 0, void 0, function* () {
50
51
  const status = params === null || params === void 0 ? void 0 : params[0];
51
52
  if (!status || ['on', 'off'].indexOf(status) === -1) {
52
- throw new error_1.CloudBaseError('请输入启停状态');
53
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入启停状态'));
53
54
  }
54
55
  let { gatewayName = '', serviceList = [] } = options;
55
56
  gatewayName = String(gatewayName);
56
57
  if (gatewayName === '') {
57
- throw new error_1.CloudBaseError('请输入网关名');
58
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入网关名'));
58
59
  }
59
60
  if (serviceList.length === 0) {
60
- throw new error_1.CloudBaseError('请输入云托管服务列表');
61
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入云托管服务列表'));
61
62
  }
62
63
  const loading = (0, toolbox_1.loadingFactory)();
63
- loading.start('数据加载中...');
64
+ loading.start((0, i18n_1.t)('数据加载中...'));
64
65
  yield (status === 'on' ? run_1.turnOnStandalonegateway : run_1.turnOffStandalonegateway)({
65
66
  envId,
66
67
  gatewayName,
67
68
  serviceList
68
69
  });
69
70
  loading.stop();
70
- console.log('操作执行成功');
71
+ console.log((0, i18n_1.t)('操作执行成功'));
71
72
  });
72
73
  }
73
74
  };
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.versionCommonOptions = void 0;
4
+ const i18n_1 = require("../../../i18n");
4
5
  const versionCommonOptions = (sub) => ({
5
6
  cmd: 'run:deprecated',
6
7
  childCmd: {
7
8
  cmd: 'version',
8
- desc: '云托管版本管理'
9
+ desc: (0, i18n_1.t)('云托管版本管理')
9
10
  },
10
11
  childSubCmd: sub
11
12
  });
@@ -30,10 +30,11 @@ const run_1 = require("../../../run");
30
30
  const utils_1 = require("../../../utils");
31
31
  const decorators_1 = require("../../../decorators");
32
32
  const common_2 = require("./common");
33
+ const i18n_1 = require("../../../i18n");
33
34
  const uploadTypeMap = {
34
- 本地代码: 'package',
35
- 代码库拉取: 'repository',
36
- 镜像拉取: 'image'
35
+ [(0, i18n_1.t)('本地代码')]: 'package',
36
+ [(0, i18n_1.t)('代码库拉取')]: 'repository',
37
+ [(0, i18n_1.t)('镜像拉取')]: 'image'
37
38
  };
38
39
  const memMap = {
39
40
  0.25: [2, 8],
@@ -49,69 +50,69 @@ let CreateVersion = class CreateVersion extends common_1.Command {
49
50
  return Object.assign(Object.assign({}, (0, common_2.versionCommonOptions)('create')), { options: [
50
51
  {
51
52
  flags: '-e, --envId <envId>',
52
- desc: '环境 Id'
53
+ desc: (0, i18n_1.t)('环境 Id')
53
54
  },
54
55
  {
55
56
  flags: '-s, --serviceName <serviceName>',
56
- desc: '托管服务 name'
57
+ desc: (0, i18n_1.t)('托管服务 name')
57
58
  },
58
59
  {
59
60
  flags: '-p, --path <path>',
60
- desc: '本地代码路径,选择本地代码上传时使用'
61
+ desc: (0, i18n_1.t)('本地代码路径,选择本地代码上传时使用')
61
62
  },
62
63
  {
63
64
  flags: '--repo <repo>',
64
- desc: '仓库信息,形如 channel|fullName|branch,channel为github、gitlab或gitee,选择代码库拉取时使用'
65
+ desc: (0, i18n_1.t)('仓库信息,形如 channel|fullName|branch,channel为github、gitlab或gitee,选择代码库拉取时使用')
65
66
  },
66
67
  {
67
68
  flags: '-i, --image <image>',
68
- desc: '镜像url,选择镜像拉取时使用'
69
+ desc: (0, i18n_1.t)('镜像url,选择镜像拉取时使用')
69
70
  },
70
71
  {
71
72
  flags: '--port <port>',
72
- desc: '监听端口,默认为80'
73
+ desc: (0, i18n_1.t)('监听端口,默认为80')
73
74
  },
74
75
  {
75
76
  flags: '-f, --flow <flow>',
76
- desc: '流量策略(%),0或100,默认为0'
77
+ desc: (0, i18n_1.t)('流量策略(%),0或100,默认为0')
77
78
  },
78
79
  {
79
80
  flags: '-m, --remark <remark>',
80
- desc: '备注信息,默认为空'
81
+ desc: (0, i18n_1.t)('备注信息,默认为空')
81
82
  },
82
83
  {
83
84
  flags: '-c, --cpu <cpu>',
84
- desc: 'cpu规格(核数),默认为0.5'
85
+ desc: (0, i18n_1.t)('cpu规格(核数),默认为0.5')
85
86
  },
86
87
  {
87
88
  flags: '--mem <mem>',
88
- desc: '内存规格(G),默认为1'
89
+ desc: (0, i18n_1.t)('内存规格(G),默认为1')
89
90
  },
90
91
  {
91
92
  flags: '--copy <copy>',
92
- desc: '副本个数,格式为最小个数~最大个数,默认为0~50'
93
+ desc: (0, i18n_1.t)('副本个数,格式为最小个数~最大个数,默认为0~50')
93
94
  },
94
95
  {
95
96
  flags: '--policy <policy>',
96
- desc: '扩缩容条件,格式为条件类型|条件比例(%),cpu条件为cpu,内存为条件mem,默认为cpu|60'
97
+ desc: (0, i18n_1.t)('扩缩容条件,格式为条件类型|条件比例(%),cpu条件为cpu,内存为条件mem,默认为cpu|60')
97
98
  },
98
99
  {
99
100
  flags: '--dockerFile <dockerFile>',
100
- desc: 'dockerfile名称,非镜像拉取时使用,默认为Dockerfile'
101
+ desc: (0, i18n_1.t)('dockerfile名称,非镜像拉取时使用,默认为Dockerfile')
101
102
  },
102
103
  {
103
104
  flags: '-l, --log <log>',
104
- desc: '日志采集路径,默认为stdout'
105
+ desc: (0, i18n_1.t)('日志采集路径,默认为stdout')
105
106
  },
106
107
  {
107
108
  flags: '-d, --delay <delay>',
108
- desc: '初始延迟时间(秒),默认为2'
109
+ desc: (0, i18n_1.t)('初始延迟时间(秒),默认为2')
109
110
  },
110
111
  {
111
112
  flags: '--env <env>',
112
- desc: '环境变量,格式为xx=a&yy=b,默认为空'
113
+ desc: (0, i18n_1.t)('环境变量,格式为xx=a&yy=b,默认为空')
113
114
  }
114
- ], desc: '创建云开发环境下云托管服务的版本' });
115
+ ], desc: (0, i18n_1.t)('创建云开发环境下云托管服务的版本') });
115
116
  }
116
117
  execute(envId, options) {
117
118
  return __awaiter(this, void 0, void 0, function* () {
@@ -122,7 +123,7 @@ let CreateVersion = class CreateVersion extends common_1.Command {
122
123
  }
123
124
  let { serviceName = '', path: _path = '', repo: _repo = '', image: _image = '', port: _port = '80', flow: _flow = '0', remark: _remark = '', cpu: _cpu = '0.5', mem: _mem = '1', copy: _copy = '0~50', policy: _policy = 'cpu|60', dockerfile: _dockerfile = 'Dockerfile', log: _log = 'stdout', delay: _delay = '2', env: _env = '' } = options;
124
125
  if (!serviceName) {
125
- throw new error_1.CloudBaseError('必须输入 serviceName');
126
+ throw new error_1.CloudBaseError((0, i18n_1.t)('必须输入 serviceName'));
126
127
  }
127
128
  let path;
128
129
  let repositoryType;
@@ -147,9 +148,9 @@ let CreateVersion = class CreateVersion extends common_1.Command {
147
148
  if (_path) {
148
149
  path = _path;
149
150
  if ((0, fs_1.statSync)(path).isDirectory()) {
150
- loading.start('正在压缩中');
151
+ loading.start((0, i18n_1.t)('正在压缩中'));
151
152
  yield (0, toolbox_1.zipDir)(path, `./code${uid}.zip`);
152
- loading.succeed('压缩完成');
153
+ loading.succeed((0, i18n_1.t)('压缩完成'));
153
154
  path = `./code${uid}.zip`;
154
155
  }
155
156
  }
@@ -166,58 +167,58 @@ let CreateVersion = class CreateVersion extends common_1.Command {
166
167
  };
167
168
  }
168
169
  else {
169
- throw new error_1.CloudBaseError('请至少选择一个上传方式');
170
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请至少选择一个上传方式'));
170
171
  }
171
172
  containerPort = Number(_port);
172
173
  if (isNaN(containerPort)) {
173
- throw new error_1.CloudBaseError('请输入合法的端口号');
174
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入合法的端口号'));
174
175
  }
175
176
  flowRatio = Number(_flow);
176
177
  if (![100, 0].includes(flowRatio)) {
177
- throw new error_1.CloudBaseError('请输入合法的流量策略');
178
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入合法的流量策略'));
178
179
  }
179
180
  versionRemark = _remark;
180
181
  cpu = Number(_cpu);
181
182
  mem = Number(_mem);
182
183
  if (isNaN(cpu) || isNaN(mem)) {
183
- throw new error_1.CloudBaseError('请输入合法的cpu和内存规格');
184
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入合法的cpu和内存规格'));
184
185
  }
185
186
  minNum = Number(_copy.split('~')[0]);
186
187
  maxNum = Number(_copy.split('~')[1]);
187
188
  if (isNaN(maxNum) || isNaN(minNum)) {
188
- throw new error_1.CloudBaseError('请输入合法的副本个数');
189
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入合法的副本个数'));
189
190
  }
190
191
  policyType = _policy.split('|')[0];
191
192
  policyThreshold = Number(_policy.split('|')[1]);
192
193
  if (!['cpu', 'mem'].includes(policyType) || isNaN(policyThreshold)) {
193
- throw new error_1.CloudBaseError('请输入合法的扩缩容条件');
194
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入合法的扩缩容条件'));
194
195
  }
195
196
  dockerfilePath = _dockerfile;
196
197
  customLogs = _log;
197
198
  initialDelaySeconds = Number(_delay);
198
199
  if (isNaN(initialDelaySeconds)) {
199
- throw new error_1.CloudBaseError('请输入合法的延迟时间');
200
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入合法的延迟时间'));
200
201
  }
201
202
  let _envParams = {};
202
203
  _env.split('&').forEach((item) => {
203
204
  _envParams[item.split('=')[0]] = item.split('=')[1];
204
205
  });
205
206
  envParams = JSON.stringify(_envParams);
206
- loading.start('加载中...');
207
+ loading.start((0, i18n_1.t)('加载中...'));
207
208
  let res = '';
208
209
  let runId = '';
209
210
  if (_path) {
210
- loading.start('正在上传中');
211
+ loading.start((0, i18n_1.t)('正在上传中'));
211
212
  let { PackageName, PackageVersion, UploadHeaders, UploadUrl } = yield (0, run_1.createBuild)({
212
213
  envId,
213
214
  serviceName
214
215
  });
215
216
  yield (0, run_1.uploadZip)(path, UploadUrl, UploadHeaders[0]);
216
- loading.succeed('上传成功');
217
+ loading.succeed((0, i18n_1.t)('上传成功'));
217
218
  if (path === `./code${uid}.zip`) {
218
- loading.start('删除本地压缩包');
219
+ loading.start((0, i18n_1.t)('删除本地压缩包'));
219
220
  (0, fs_1.unlinkSync)(path);
220
- loading.succeed('成功删除本地压缩包');
221
+ loading.succeed((0, i18n_1.t)('成功删除本地压缩包'));
221
222
  }
222
223
  let response = yield (0, run_1.createVersion)({
223
224
  envId,
@@ -293,24 +294,24 @@ let CreateVersion = class CreateVersion extends common_1.Command {
293
294
  runId = response.RunId;
294
295
  }
295
296
  if (res !== 'succ')
296
- throw new error_1.CloudBaseError('提交构建任务失败');
297
- loading.start('正在部署中');
297
+ throw new error_1.CloudBaseError((0, i18n_1.t)('提交构建任务失败'));
298
+ loading.start((0, i18n_1.t)('正在部署中'));
298
299
  while (true) {
299
300
  let { Percent, Status } = yield (0, run_1.basicOperate)({ envId, runId });
300
301
  if (Status === 'build_fail') {
301
302
  let logs = yield (0, run_1.logCreate)({ envId, runId });
302
303
  (0, fs_1.writeFileSync)(`./log${runId}`, logs.reduce((res, item) => res + item + '\n', ''));
303
- throw new error_1.CloudBaseError(`构建失败,日志写入./log${runId}中`);
304
+ throw new error_1.CloudBaseError((0, i18n_1.t)('构建失败,日志写入{{file}}中', { file: `./log${runId}` }));
304
305
  }
305
306
  else if (Status !== 'creating') {
306
307
  break;
307
308
  }
308
- loading.start(`目前构建进度${Percent}%`);
309
+ loading.start((0, i18n_1.t)('目前构建进度{{percent}}%', { percent: Percent }));
309
310
  yield new Promise((resolve) => {
310
311
  setTimeout((_) => resolve('again'), 2000);
311
312
  });
312
313
  }
313
- loading.succeed('构建成功');
314
+ loading.succeed((0, i18n_1.t)('构建成功'));
314
315
  });
315
316
  }
316
317
  };
@@ -28,22 +28,23 @@ const run_1 = require("../../../run");
28
28
  const utils_1 = require("../../../utils");
29
29
  const decorators_1 = require("../../../decorators");
30
30
  const common_2 = require("./common");
31
+ const i18n_1 = require("../../../i18n");
31
32
  let DeleteVersion = class DeleteVersion extends common_1.Command {
32
33
  get options() {
33
34
  return Object.assign(Object.assign({}, (0, common_2.versionCommonOptions)('delete')), { options: [
34
35
  {
35
36
  flags: '-e, --envId <envId>',
36
- desc: '环境 Id'
37
+ desc: (0, i18n_1.t)('环境 Id')
37
38
  },
38
39
  {
39
40
  flags: '-s, --serviceName <serviceName>',
40
- desc: '托管服务 name'
41
+ desc: (0, i18n_1.t)('托管服务 name')
41
42
  },
42
43
  {
43
44
  flags: '-v, --versionName <versionName>',
44
- desc: '版本名称 Name'
45
+ desc: (0, i18n_1.t)('版本名称 Name')
45
46
  }
46
- ], desc: '删除云开发环境下云托管服务的版本' });
47
+ ], desc: (0, i18n_1.t)('删除云开发环境下云托管服务的版本') });
47
48
  }
48
49
  execute(envId, options) {
49
50
  return __awaiter(this, void 0, void 0, function* () {
@@ -54,10 +55,10 @@ let DeleteVersion = class DeleteVersion extends common_1.Command {
54
55
  }
55
56
  let { serviceName = '', versionName = '' } = options;
56
57
  if (versionName.length === 0 || serviceName.length === 0) {
57
- throw new error_1.CloudBaseError('必须输入 serviceName 和 versionName');
58
+ throw new error_1.CloudBaseError((0, i18n_1.t)('必须输入 serviceName 和 versionName'));
58
59
  }
59
60
  const loading = (0, utils_1.loadingFactory)();
60
- loading.start('数据加载中...');
61
+ loading.start((0, i18n_1.t)('数据加载中...'));
61
62
  try {
62
63
  const res = yield (0, run_1.deleteVersion)({
63
64
  envId,
@@ -65,12 +66,12 @@ let DeleteVersion = class DeleteVersion extends common_1.Command {
65
66
  versionName
66
67
  });
67
68
  if (res === 'succ')
68
- loading.succeed(`成功删除 ${serviceName} 服务下的 ${versionName} 版本`);
69
+ loading.succeed((0, i18n_1.t)('成功删除 {{serviceName}} 服务下的 {{versionName}} 版本', { serviceName, versionName }));
69
70
  else
70
- throw new error_1.CloudBaseError('删除失败,请查看版本是否存在, 或者先清空版本灰度流量');
71
+ throw new error_1.CloudBaseError((0, i18n_1.t)('删除失败,请查看版本是否存在, 或者先清空版本灰度流量'));
71
72
  }
72
73
  catch (e) {
73
- throw new error_1.CloudBaseError('删除失败,请查看版本是否存在, 或者先清空版本灰度流量');
74
+ throw new error_1.CloudBaseError((0, i18n_1.t)('删除失败,请查看版本是否存在, 或者先清空版本灰度流量'));
74
75
  }
75
76
  });
76
77
  }
@@ -28,30 +28,31 @@ const run_1 = require("../../../run");
28
28
  const utils_1 = require("../../../utils");
29
29
  const decorators_1 = require("../../../decorators");
30
30
  const common_2 = require("./common");
31
+ const i18n_1 = require("../../../i18n");
31
32
  const StatusMap = {
32
- normal: '正常',
33
- deploy_fail: '部署失败'
33
+ normal: (0, i18n_1.t)('正常'),
34
+ deploy_fail: (0, i18n_1.t)('部署失败')
34
35
  };
35
36
  let ListVersion = class ListVersion extends common_1.Command {
36
37
  get options() {
37
38
  return Object.assign(Object.assign({}, (0, common_2.versionCommonOptions)('list')), { options: [
38
39
  {
39
40
  flags: '-e, --envId <envId>',
40
- desc: '环境 Id'
41
+ desc: (0, i18n_1.t)('环境 Id')
41
42
  },
42
43
  {
43
44
  flags: '-s, --serviceName <serviceName>',
44
- desc: '托管服务 name'
45
+ desc: (0, i18n_1.t)('托管服务 name')
45
46
  },
46
47
  {
47
48
  flags: '-l, --limit <limit>',
48
- desc: '返回数据长度,默认值为 20'
49
+ desc: (0, i18n_1.t)('返回数据长度,默认值为 20')
49
50
  },
50
51
  {
51
52
  flags: '-o, --offset <offset>',
52
- desc: '数据偏移量,默认值为 0'
53
+ desc: (0, i18n_1.t)('数据偏移量,默认值为 0')
53
54
  }
54
- ], desc: '展示选择的云托管服务的版本列表' });
55
+ ], desc: (0, i18n_1.t)('展示选择的云托管服务的版本列表') });
55
56
  }
56
57
  execute(envId, options) {
57
58
  return __awaiter(this, void 0, void 0, function* () {
@@ -64,16 +65,16 @@ let ListVersion = class ListVersion extends common_1.Command {
64
65
  limit = Number(limit);
65
66
  offset = Number(offset);
66
67
  if (!Number.isInteger(limit) || !Number.isInteger(offset)) {
67
- throw new error_1.CloudBaseError('limit 和 offset 必须为整数');
68
+ throw new error_1.CloudBaseError((0, i18n_1.t)('limit 和 offset 必须为整数'));
68
69
  }
69
70
  if (limit < 0 || offset < 0) {
70
- throw new error_1.CloudBaseError('limit 和 offset 必须为大于 0 的整数');
71
+ throw new error_1.CloudBaseError((0, i18n_1.t)('limit 和 offset 必须为大于 0 的整数'));
71
72
  }
72
73
  if (serviceName.length === 0) {
73
- throw new error_1.CloudBaseError('请输入查询的服务名');
74
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入查询的服务名'));
74
75
  }
75
76
  const loading = (0, utils_1.loadingFactory)();
76
- loading.start('数据加载中...');
77
+ loading.start((0, i18n_1.t)('数据加载中...'));
77
78
  const data = yield (0, run_1.listVersion)({
78
79
  envId,
79
80
  limit: Number(limit),
@@ -81,7 +82,7 @@ let ListVersion = class ListVersion extends common_1.Command {
81
82
  serverName: serviceName
82
83
  });
83
84
  loading.stop();
84
- const head = ['版本名称', '状态', '流量', '备注', '创建时间', '更新时间'];
85
+ const head = [(0, i18n_1.t)('版本名称'), (0, i18n_1.t)('状态'), (0, i18n_1.t)('流量'), (0, i18n_1.t)('备注'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('更新时间')];
85
86
  const tableData = data.map((item) => [
86
87
  item.VersionName,
87
88
  StatusMap[item.Status],