@cloudbase/cli 2.10.0-beta.0 → 2.11.0-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.
- package/lib/auth/login.js +51 -65
- package/lib/auth/logout.js +3 -14
- package/lib/commands/account/login.js +136 -149
- package/lib/commands/account/logout.js +3 -14
- package/lib/commands/ag/base.js +203 -0
- package/lib/commands/ag/create.js +301 -0
- package/lib/commands/ag/debug/index.html +699 -0
- package/lib/commands/ag/delete.js +200 -0
- package/lib/commands/ag/deploy.js +185 -0
- package/lib/commands/ag/detail.js +113 -0
- package/lib/commands/ag/index.js +22 -0
- package/lib/commands/ag/list.js +155 -0
- package/lib/commands/ag/run.js +644 -0
- package/lib/commands/ai/index.js +76 -95
- package/lib/commands/cloudfunction/base.js +182 -203
- package/lib/commands/cloudrun/base.js +578 -603
- package/lib/commands/common.js +48 -63
- package/lib/commands/config/delete.js +16 -27
- package/lib/commands/config/get.js +13 -24
- package/lib/commands/config/list.js +16 -27
- package/lib/commands/config/set.js +33 -44
- package/lib/commands/db/base.js +221 -240
- package/lib/commands/env/base.js +36 -49
- package/lib/commands/env/domain.js +79 -94
- package/lib/commands/env/login.js +120 -135
- package/lib/commands/framework/index.js +32 -49
- package/lib/commands/fun/base.js +223 -244
- package/lib/commands/functions/alias/getRoute.js +33 -44
- package/lib/commands/functions/alias/setRoute.js +36 -47
- package/lib/commands/functions/code-download.js +43 -54
- package/lib/commands/functions/code-update.js +23 -34
- package/lib/commands/functions/concurrency/delete.js +11 -22
- package/lib/commands/functions/concurrency/list.js +20 -31
- package/lib/commands/functions/concurrency/set.js +13 -24
- package/lib/commands/functions/config-update.js +30 -41
- package/lib/commands/functions/copy.js +12 -23
- package/lib/commands/functions/delete.js +30 -41
- package/lib/commands/functions/deploy.js +184 -202
- package/lib/commands/functions/detail.js +23 -34
- package/lib/commands/functions/invoke.js +69 -75
- package/lib/commands/functions/layer/bind.js +102 -105
- package/lib/commands/functions/layer/create.js +29 -35
- package/lib/commands/functions/layer/delete.js +42 -48
- package/lib/commands/functions/layer/download.js +52 -58
- package/lib/commands/functions/layer/list.js +44 -50
- package/lib/commands/functions/layer/sort.js +39 -45
- package/lib/commands/functions/list.js +25 -36
- package/lib/commands/functions/log.js +65 -73
- package/lib/commands/functions/run.js +118 -116
- package/lib/commands/functions/trigger-create.js +32 -43
- package/lib/commands/functions/trigger-delete.js +50 -61
- package/lib/commands/functions/version/list.js +29 -40
- package/lib/commands/functions/version/publish.js +11 -22
- package/lib/commands/gateway/create.js +50 -61
- package/lib/commands/gateway/delete.js +38 -49
- package/lib/commands/gateway/domain.js +65 -80
- package/lib/commands/gateway/list.js +31 -42
- package/lib/commands/gateway/switch.js +48 -61
- package/lib/commands/helpers/init.js +226 -249
- package/lib/commands/helpers/new.js +35 -46
- package/lib/commands/helpers/open.js +22 -33
- package/lib/commands/hosting/hosting.js +157 -178
- package/lib/commands/index.js +1 -0
- package/lib/commands/lowcode/app.js +114 -144
- package/lib/commands/lowcode/comps.js +136 -127
- package/lib/commands/lowcode/utils.js +11 -22
- package/lib/commands/pull/pull.js +33 -46
- package/lib/commands/run/delete.js +35 -46
- package/lib/commands/run/image/delete.js +32 -39
- package/lib/commands/run/image/download.js +26 -33
- package/lib/commands/run/image/list.js +41 -48
- package/lib/commands/run/image/upload.js +26 -33
- package/lib/commands/run/list.js +32 -43
- package/lib/commands/run/service/config.js +17 -28
- package/lib/commands/run/service/deploy.js +15 -26
- package/lib/commands/run/service/list.js +48 -59
- package/lib/commands/run/service/update.js +7 -18
- package/lib/commands/run/standalonegateway/create.js +35 -42
- package/lib/commands/run/standalonegateway/destroy.js +23 -30
- package/lib/commands/run/standalonegateway/list.js +19 -26
- package/lib/commands/run/standalonegateway/package.js +31 -38
- package/lib/commands/run/standalonegateway/turn.js +27 -34
- package/lib/commands/run/version/create.js +198 -205
- package/lib/commands/run/version/delete.js +31 -38
- package/lib/commands/run/version/list.js +42 -49
- package/lib/commands/run/version/modify.js +27 -34
- package/lib/commands/run/version/update.js +201 -208
- package/lib/commands/runf/base.js +216 -237
- package/lib/commands/self-update.js +59 -72
- package/lib/commands/smart.js +66 -79
- package/lib/commands/storage/storage.js +192 -219
- package/lib/commands/third/thirdAttach.js +16 -27
- package/lib/commands/utils.js +119 -149
- package/lib/db/index.js +48 -67
- package/lib/decorators/captureError.js +10 -21
- package/lib/decorators/guard.js +11 -22
- package/lib/decorators/injectParams.js +29 -40
- package/lib/decorators/params/common.js +5 -2
- package/lib/decorators/params/index.js +3 -12
- package/lib/env/domain.js +13 -28
- package/lib/env/index.js +25 -44
- package/lib/env/login.js +30 -45
- package/lib/function/alias.js +31 -44
- package/lib/function/base.js +187 -215
- package/lib/function/code.js +8 -19
- package/lib/function/concurrency.js +43 -58
- package/lib/function/create.js +43 -53
- package/lib/function/delete.js +22 -35
- package/lib/function/layer/attach.js +33 -46
- package/lib/function/layer/create.js +34 -45
- package/lib/function/layer/delete.js +5 -16
- package/lib/function/layer/download.js +11 -22
- package/lib/function/layer/list.js +12 -25
- package/lib/function/layer/sort.js +6 -17
- package/lib/function/trigger.js +65 -82
- package/lib/function/update.js +24 -32
- package/lib/function/version.js +29 -42
- package/lib/function/vpc.js +12 -25
- package/lib/gateway/index.js +77 -104
- package/lib/hosting.js +157 -188
- package/lib/run/delete.js +3 -12
- package/lib/run/image/build.js +6 -15
- package/lib/run/image/delete.js +3 -12
- package/lib/run/image/info.js +3 -12
- package/lib/run/image/list.js +6 -15
- package/lib/run/list.js +19 -30
- package/lib/run/repo.js +6 -15
- package/lib/run/service/common.js +160 -173
- package/lib/run/service/config.js +44 -57
- package/lib/run/service/deployPackage.js +33 -44
- package/lib/run/service/list.js +8 -14
- package/lib/run/service/showLogs.js +69 -90
- package/lib/run/service/update.js +50 -63
- package/lib/run/standalonegateway/create.js +3 -12
- package/lib/run/standalonegateway/destroy.js +3 -12
- package/lib/run/standalonegateway/list.js +3 -12
- package/lib/run/standalonegateway/package/list.js +3 -12
- package/lib/run/standalonegateway/turn/off.js +3 -12
- package/lib/run/standalonegateway/turn/on.js +3 -12
- package/lib/run/version/create.js +41 -31
- package/lib/run/version/delete.js +3 -12
- package/lib/run/version/list.js +3 -12
- package/lib/run/version/modify.js +3 -12
- package/lib/run/version/repo.js +6 -15
- package/lib/run/version/update.js +37 -26
- package/lib/storage.js +62 -93
- package/lib/third/index.js +6 -17
- package/lib/utils/ai/banner.js +49 -60
- package/lib/utils/ai/claudeWindows.js +2 -2
- package/lib/utils/ai/config.js +169 -206
- package/lib/utils/ai/ensureFiles.js +6 -17
- package/lib/utils/ai/env.js +16 -27
- package/lib/utils/ai/envLocalManager.js +35 -52
- package/lib/utils/ai/router.js +927 -1005
- package/lib/utils/ai/setup.js +527 -563
- package/lib/utils/auth.js +3 -14
- package/lib/utils/checkTcbrEnv.js +20 -31
- package/lib/utils/cli-table.js +6 -1
- package/lib/utils/config.js +4 -13
- package/lib/utils/dts.js +98 -113
- package/lib/utils/env.js +154 -175
- package/lib/utils/function-packer.js +29 -42
- package/lib/utils/log.js +10 -21
- package/lib/utils/mcp-config-modifier.js +105 -120
- package/lib/utils/net/cloud-api-request.js +15 -23
- package/lib/utils/net/credential.js +26 -39
- package/lib/utils/net/http-request.js +63 -80
- package/lib/utils/net/manager-service.js +22 -35
- package/lib/utils/notice.js +16 -27
- package/lib/utils/output/loading.js +3 -12
- package/lib/utils/parallel.js +32 -43
- package/lib/utils/platform/mac.js +4 -15
- package/lib/utils/platform/port.js +4 -15
- package/lib/utils/prompt/select.js +6 -15
- package/lib/utils/report.js +28 -33
- package/lib/utils/reporter/agree.js +11 -22
- package/lib/utils/reporter/download.js +17 -28
- package/lib/utils/reporter/usage.js +12 -23
- package/lib/utils/store/auth.js +17 -30
- package/lib/utils/store/config.js +11 -25
- package/lib/utils/store/db.js +17 -36
- package/lib/utils/tcbrApi/callTcbrApi.js +19 -28
- package/lib/utils/template-manager.js +215 -242
- package/lib/utils/template.js +81 -96
- package/lib/utils/tools/common.js +45 -56
- package/lib/utils/tools/time.js +5 -16
- package/lib/utils/url.js +10 -4
- package/package.json +2 -2
- package/specs/ag-command/design.md +421 -0
- package/specs/ag-command/doc.md +204 -0
- package/specs/ag-command/requirements.md +173 -0
- package/specs/ag-command/summary.md +174 -0
- package/specs/ag-command/tasks.md +197 -0
- package/specs/ag-command/usage-guide.md +420 -0
- package/tsconfig.json +1 -1
- package/types/commands/ag/base.d.ts +44 -0
- package/types/commands/ag/create.d.ts +25 -0
- package/types/commands/ag/delete.d.ts +32 -0
- package/types/commands/ag/deploy.d.ts +31 -0
- package/types/commands/ag/detail.d.ts +28 -0
- package/types/commands/ag/index.d.ts +6 -0
- package/types/commands/ag/list.d.ts +35 -0
- package/types/commands/ag/run.d.ts +52 -0
- package/types/commands/cloudrun/base.d.ts +10 -0
- package/types/commands/index.d.ts +1 -0
package/lib/utils/template.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -27,105 +18,99 @@ const reporter_1 = require("./reporter");
|
|
|
27
18
|
const i18n_1 = require("../i18n");
|
|
28
19
|
const listUrl = 'https://tcli.service.tcloudbase.com/templates';
|
|
29
20
|
const getTemplateAddress = (templatePath) => `https://7463-tcli-1258016615.tcb.qcloud.la/cloudbase-templates/${templatePath}.zip`;
|
|
30
|
-
function downloadTemplate(options = {}) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
async function downloadTemplate(options = {}) {
|
|
22
|
+
let { templateUri, appName, newProject, projectPath = process.cwd() } = options;
|
|
23
|
+
const templates = await (0, output_1.execWithLoading)(() => (0, net_1.fetch)(listUrl), {
|
|
24
|
+
startTip: (0, i18n_1.t)('获取应用模板列表中')
|
|
25
|
+
});
|
|
26
|
+
let templateName;
|
|
27
|
+
let tempateId;
|
|
28
|
+
if (templateUri) {
|
|
29
|
+
tempateId = templateUri;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const { selectTemplateName } = await (0, enquirer_1.prompt)({
|
|
33
|
+
type: 'select',
|
|
34
|
+
name: 'selectTemplateName',
|
|
35
|
+
message: (0, i18n_1.t)('请选择应用模板'),
|
|
36
|
+
choices: templates.map((item) => item.name)
|
|
35
37
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
templateName = selectTemplateName;
|
|
39
|
+
}
|
|
40
|
+
const selectedTemplate = templateName
|
|
41
|
+
? templates.find((item) => item.name === templateName)
|
|
42
|
+
: templates.find((item) => item.path === tempateId);
|
|
43
|
+
if (!selectedTemplate) {
|
|
44
|
+
log_1.logger.info((0, i18n_1.t)('模板 `{{template}}` 不存在', { template: templateName || tempateId }));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (newProject) {
|
|
48
|
+
if (!appName) {
|
|
49
|
+
const { projectName } = await (0, enquirer_1.prompt)({
|
|
50
|
+
type: 'input',
|
|
51
|
+
name: 'projectName',
|
|
52
|
+
message: (0, i18n_1.t)('请输入项目名称'),
|
|
53
|
+
initial: selectedTemplate.path
|
|
47
54
|
});
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
const selectedTemplate = templateName
|
|
51
|
-
? templates.find((item) => item.name === templateName)
|
|
52
|
-
: templates.find((item) => item.path === tempateId);
|
|
53
|
-
if (!selectedTemplate) {
|
|
54
|
-
log_1.logger.info((0, i18n_1.t)('模板 `{{template}}` 不存在', { template: templateName || tempateId }));
|
|
55
|
-
return;
|
|
55
|
+
appName = projectName;
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
projectPath = path_1.default.join(process.cwd(), appName);
|
|
58
|
+
if ((0, fs_2.checkFullAccess)(projectPath)) {
|
|
59
|
+
const { cover } = await (0, enquirer_1.prompt)({
|
|
60
|
+
type: 'confirm',
|
|
61
|
+
name: 'cover',
|
|
62
|
+
message: (0, i18n_1.t)('已存在同名文件夹:{{name}},是否覆盖?', { name: appName }),
|
|
63
|
+
initial: false
|
|
64
|
+
});
|
|
65
|
+
if (!cover) {
|
|
66
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('操作终止!'));
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const { cover } = yield (0, enquirer_1.prompt)({
|
|
70
|
-
type: 'confirm',
|
|
71
|
-
name: 'cover',
|
|
72
|
-
message: (0, i18n_1.t)('已存在同名文件夹:{{name}},是否覆盖?', { name: appName }),
|
|
73
|
-
initial: false
|
|
74
|
-
});
|
|
75
|
-
if (!cover) {
|
|
76
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('操作终止!'));
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
fs_extra_1.default.removeSync(projectPath);
|
|
80
|
-
}
|
|
68
|
+
else {
|
|
69
|
+
fs_extra_1.default.removeSync(projectPath);
|
|
81
70
|
}
|
|
82
71
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return projectPath;
|
|
72
|
+
}
|
|
73
|
+
await (0, output_1.execWithLoading)(async () => {
|
|
74
|
+
await (0, reporter_1.templateDownloadReport)(selectedTemplate.path, selectedTemplate.name);
|
|
75
|
+
await extractTemplate(projectPath, selectedTemplate.path, selectedTemplate.url);
|
|
76
|
+
}, {
|
|
77
|
+
startTip: (0, i18n_1.t)('下载文件中')
|
|
90
78
|
});
|
|
79
|
+
return projectPath;
|
|
91
80
|
}
|
|
92
81
|
exports.downloadTemplate = downloadTemplate;
|
|
93
|
-
function extractTemplate(projectPath, templatePath, remoteUrl) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
yield (0, toolbox_1.unzipStream)(res.body, projectPath);
|
|
104
|
-
}));
|
|
82
|
+
async function extractTemplate(projectPath, templatePath, remoteUrl) {
|
|
83
|
+
const url = remoteUrl || getTemplateAddress(templatePath);
|
|
84
|
+
return (0, net_1.fetchStream)(url).then(async (res) => {
|
|
85
|
+
if (!res) {
|
|
86
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请求异常'));
|
|
87
|
+
}
|
|
88
|
+
if (res.status !== 200) {
|
|
89
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('未找到文件'));
|
|
90
|
+
}
|
|
91
|
+
await (0, toolbox_1.unzipStream)(res.body, projectPath);
|
|
105
92
|
});
|
|
106
93
|
}
|
|
107
94
|
exports.extractTemplate = extractTemplate;
|
|
108
|
-
function initProjectConfig(envId, region, projectPath = process.cwd()) {
|
|
95
|
+
async function initProjectConfig(envId, region, projectPath = process.cwd()) {
|
|
109
96
|
var _a;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
});
|
|
97
|
+
let filepath = (_a = (await (0, toolbox_1.searchConfig)(projectPath))) === null || _a === void 0 ? void 0 : _a.filepath;
|
|
98
|
+
if (!filepath) {
|
|
99
|
+
fs_1.default.writeFileSync(path_1.default.join(projectPath, 'cloudbaserc.json'), JSON.stringify({
|
|
100
|
+
envId,
|
|
101
|
+
region,
|
|
102
|
+
version: '2.0',
|
|
103
|
+
$schema: 'https://framework-1258016615.tcloudbaseapp.com/schema/latest.json'
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const configContent = fs_1.default.readFileSync(filepath).toString();
|
|
108
|
+
fs_1.default.writeFileSync(filepath, configContent.replace('{{envId}}', envId));
|
|
109
|
+
const configPath = filepath || path_1.default.join(projectPath, 'cloudbaserc.json');
|
|
110
|
+
const parser = new toolbox_1.ConfigParser({
|
|
111
|
+
configPath
|
|
112
|
+
});
|
|
113
|
+
parser.update('region', region);
|
|
114
|
+
}
|
|
130
115
|
}
|
|
131
116
|
exports.initProjectConfig = initProjectConfig;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -18,56 +9,54 @@ const path_1 = __importDefault(require("path"));
|
|
|
18
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
19
10
|
const unzipper_1 = __importDefault(require("unzipper"));
|
|
20
11
|
const i18n_1 = require("../../i18n");
|
|
21
|
-
function downloadAndExtractRemoteZip(downloadUrl, targetPath) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
12
|
+
async function downloadAndExtractRemoteZip(downloadUrl, targetPath) {
|
|
13
|
+
const downloadResponse = await (0, toolbox_1.fetchStream)(downloadUrl);
|
|
14
|
+
if (!downloadResponse.ok) {
|
|
15
|
+
throw new Error((0, i18n_1.t)('下载失败,状态码: {{status}}', { status: downloadResponse.status }));
|
|
16
|
+
}
|
|
17
|
+
if (!downloadResponse.body) {
|
|
18
|
+
throw new Error((0, i18n_1.t)('下载响应中没有数据流'));
|
|
19
|
+
}
|
|
20
|
+
const dirPath = path_1.default.resolve(targetPath);
|
|
21
|
+
await fs_extra_1.default.ensureDir(dirPath);
|
|
22
|
+
await new Promise((resolve, reject) => {
|
|
23
|
+
let totalEntries = 0;
|
|
24
|
+
let processedEntries = 0;
|
|
25
|
+
downloadResponse
|
|
26
|
+
.body.pipe(unzipper_1.default.Parse())
|
|
27
|
+
.on('error', reject)
|
|
28
|
+
.on('entry', async (entry) => {
|
|
29
|
+
const filePath = path_1.default.join(dirPath, entry.path);
|
|
30
|
+
totalEntries++;
|
|
31
|
+
try {
|
|
32
|
+
await fs_extra_1.default.ensureDir(path_1.default.dirname(filePath));
|
|
33
|
+
if (entry.type === 'Directory') {
|
|
34
|
+
await fs_extra_1.default.ensureDir(filePath);
|
|
35
|
+
processedEntries++;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
entry
|
|
39
|
+
.pipe(fs_extra_1.default.createWriteStream(filePath))
|
|
40
|
+
.on('error', reject)
|
|
41
|
+
.on('finish', () => {
|
|
45
42
|
processedEntries++;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
reject(err);
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
.on('close', () => {
|
|
51
|
+
const checkProcessed = () => {
|
|
52
|
+
if (processedEntries === totalEntries) {
|
|
53
|
+
resolve('');
|
|
55
54
|
}
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
else {
|
|
56
|
+
setTimeout(checkProcessed, 10);
|
|
58
57
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const checkProcessed = () => {
|
|
62
|
-
if (processedEntries === totalEntries) {
|
|
63
|
-
resolve('');
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
setTimeout(checkProcessed, 10);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
checkProcessed();
|
|
70
|
-
});
|
|
58
|
+
};
|
|
59
|
+
checkProcessed();
|
|
71
60
|
});
|
|
72
61
|
});
|
|
73
62
|
}
|
package/lib/utils/tools/time.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.sleep = exports.formatDate = void 0;
|
|
13
4
|
function formatDate(dateParam, fmtParam) {
|
|
@@ -37,13 +28,11 @@ function formatDate(dateParam, fmtParam) {
|
|
|
37
28
|
return fmt;
|
|
38
29
|
}
|
|
39
30
|
exports.formatDate = formatDate;
|
|
40
|
-
function sleep(time) {
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, time);
|
|
46
|
-
});
|
|
31
|
+
async function sleep(time) {
|
|
32
|
+
return new Promise(resolve => {
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
resolve();
|
|
35
|
+
}, time);
|
|
47
36
|
});
|
|
48
37
|
}
|
|
49
38
|
exports.sleep = sleep;
|
package/lib/utils/url.js
CHANGED
|
@@ -9,10 +9,16 @@ exports.EDomain = {
|
|
|
9
9
|
Tcb: (0, i18n_1.isIntl)() ? 'tcb.tencentcloud.com' : 'tcb.cloud.tencent.com',
|
|
10
10
|
Docs: 'docs.cloudbase.net'
|
|
11
11
|
};
|
|
12
|
-
exports.EUrl =
|
|
13
|
-
acc
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
exports.EUrl = {
|
|
13
|
+
...((domains) => Object.keys(domains).reduce((acc, key) => {
|
|
14
|
+
acc[key] = `https://${domains[key]}`;
|
|
15
|
+
return acc;
|
|
16
|
+
}, {}))(exports.EDomain),
|
|
17
|
+
Docs: `https://${exports.EDomain.Docs}` + ((0, i18n_1.isIntl)() ? '/en' : ''),
|
|
18
|
+
DevPlatform: `https://${exports.EDomain.Tcb}/dev`,
|
|
19
|
+
TcbConsole: `https://${exports.EDomain.Console}/tcb`,
|
|
20
|
+
CloudAdmin: `https://${exports.EDomain.Tcb}/cloud-admin`
|
|
21
|
+
};
|
|
16
22
|
function getGatewayUrl(envId) {
|
|
17
23
|
return `https://${envId}.${exports.EDomain.Gateway}`;
|
|
18
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0-beta.0",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@cloudbase/functions-framework": "1.16.0",
|
|
56
56
|
"@cloudbase/iac-core": "0.0.3-alpha.11",
|
|
57
57
|
"@cloudbase/lowcode-cli": "^0.23.0",
|
|
58
|
-
"@cloudbase/manager-node": "4.
|
|
58
|
+
"@cloudbase/manager-node": "4.7.0-beta.0",
|
|
59
59
|
"@cloudbase/toolbox": "^0.7.9",
|
|
60
60
|
"@dotenvx/dotenvx": "^1.48.3",
|
|
61
61
|
"@musistudio/claude-code-router": "1.0.36",
|