@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
|
@@ -22,15 +22,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
25
|
+
var _a;
|
|
34
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
27
|
exports.getMergedOptions = exports.getCmdConfig = exports.getLowcodeCli = exports.promisifyProcess = void 0;
|
|
36
28
|
const lodash_1 = require("lodash");
|
|
@@ -58,19 +50,16 @@ function promisifyProcess(p, pipe = false) {
|
|
|
58
50
|
});
|
|
59
51
|
}
|
|
60
52
|
exports.promisifyProcess = promisifyProcess;
|
|
61
|
-
function getLowcodeCli() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
result = cache.get(key);
|
|
72
|
-
return result;
|
|
73
|
-
});
|
|
53
|
+
async function getLowcodeCli() {
|
|
54
|
+
const key = '@cloudbase/lowcode-cli';
|
|
55
|
+
const cache = new Map();
|
|
56
|
+
let result;
|
|
57
|
+
if (!cache.get(key)) {
|
|
58
|
+
const module = await (_a = key, Promise.resolve().then(() => __importStar(require(_a))));
|
|
59
|
+
cache.set(key, module);
|
|
60
|
+
}
|
|
61
|
+
result = cache.get(key);
|
|
62
|
+
return result;
|
|
74
63
|
}
|
|
75
64
|
exports.getLowcodeCli = getLowcodeCli;
|
|
76
65
|
function getCmdConfig(config, options) {
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
15
|
exports.PullCommand = void 0;
|
|
25
16
|
const common_1 = require("../common");
|
|
@@ -51,45 +42,41 @@ let PullCommand = class PullCommand extends common_1.Command {
|
|
|
51
42
|
withoutAuth: true
|
|
52
43
|
};
|
|
53
44
|
}
|
|
54
|
-
execute(options, params, log) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
log.info((0, i18n_1.t)('📁 项目已创建在: {{output}}', { output }));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('拉取模板失败: {{message}}', { message: error.message }), { original: error });
|
|
45
|
+
async execute(options, params, log) {
|
|
46
|
+
const { output, force, source } = options;
|
|
47
|
+
if (process.argv[3] === 'list') {
|
|
48
|
+
const templateManager = new template_manager_1.TemplateManager();
|
|
49
|
+
await this.showTemplateList(templateManager, log);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!source || typeof source !== 'string') {
|
|
53
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请指定要拉取的模板来源'));
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const templateManager = new template_manager_1.TemplateManager();
|
|
57
|
+
await templateManager.pullTemplate(source, { output, force }, log);
|
|
58
|
+
log.info((0, i18n_1.t)('🎉 模板拉取完成!'));
|
|
59
|
+
if (output) {
|
|
60
|
+
log.info((0, i18n_1.t)('📁 项目已创建在: {{output}}', { output }));
|
|
75
61
|
}
|
|
76
|
-
}
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('拉取模板失败: {{message}}', { message: error.message }), { original: error });
|
|
65
|
+
}
|
|
77
66
|
}
|
|
78
|
-
showTemplateList(templateManager, log) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
log.info(' https://github.com/user/repo/tree/main/src/templates');
|
|
92
|
-
});
|
|
67
|
+
async showTemplateList(templateManager, log) {
|
|
68
|
+
const templates = templateManager.getBuiltinTemplates();
|
|
69
|
+
log.info((0, i18n_1.t)('📋 可用的内置模板:'));
|
|
70
|
+
for (const [key, name] of Object.entries(templates)) {
|
|
71
|
+
log.info(` ${key.padEnd(12)} - ${name}`);
|
|
72
|
+
}
|
|
73
|
+
log.info((0, i18n_1.t)('\n🌐 支持的 Git 仓库格式:'));
|
|
74
|
+
log.info(' GitHub: https://github.com/user/repo');
|
|
75
|
+
log.info(' Gitee: https://gitee.com/user/repo');
|
|
76
|
+
log.info(' CNB: https://cnb.cool/user/repo');
|
|
77
|
+
log.info(' SSH: git@github.com:user/repo.git');
|
|
78
|
+
log.info((0, i18n_1.t)('\n📁 支持 Git 子目录:'));
|
|
79
|
+
log.info(' https://github.com/user/repo/tree/main/src/templates');
|
|
93
80
|
}
|
|
94
81
|
};
|
|
95
82
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
15
|
exports.DeleteRun = void 0;
|
|
25
16
|
const enquirer_1 = require("enquirer");
|
|
@@ -47,45 +38,43 @@ let DeleteRun = class DeleteRun extends common_1.Command {
|
|
|
47
38
|
desc: (0, i18n_1.t)('删除云托管服务')
|
|
48
39
|
};
|
|
49
40
|
}
|
|
50
|
-
execute(envId, options) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
async execute(envId, options) {
|
|
42
|
+
let envCheckType = await (0, utils_1.checkTcbrEnv)(options.envId, false);
|
|
43
|
+
if (envCheckType !== 0) {
|
|
44
|
+
(0, utils_1.logEnvCheck)(envId, envCheckType);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
let { serviceName = '' } = options;
|
|
48
|
+
if (serviceName.length === 0) {
|
|
49
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('必须输入服务名'));
|
|
50
|
+
}
|
|
51
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
52
|
+
loading.start((0, i18n_1.t)('数据加载中...'));
|
|
53
|
+
const versions = await (0, run_1.listVersion)({ envId, serverName: serviceName, limit: 1, offset: 0 });
|
|
54
|
+
if (versions.length > 0)
|
|
55
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('服务下还有版本存在,请先清空版本列表'));
|
|
56
|
+
const imageRepo = await (0, run_1.describeImageRepo)({ envId, serverName: serviceName });
|
|
57
|
+
loading.start((0, i18n_1.t)('正在删除服务'));
|
|
58
|
+
const res = await (0, run_1.deleteRun)({ envId, serverName: serviceName });
|
|
59
|
+
if (res === 'succ')
|
|
60
|
+
loading.succeed((0, i18n_1.t)('服务删除完成'));
|
|
61
|
+
else
|
|
62
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('服务删除失败'));
|
|
63
|
+
if ((await (0, enquirer_1.prompt)({
|
|
64
|
+
type: 'select',
|
|
65
|
+
name: 'flag',
|
|
66
|
+
message: (0, i18n_1.t)('是否删除绑定的镜像仓库{{imageRepo}}', { imageRepo }),
|
|
67
|
+
choices: [(0, i18n_1.t)('是'), (0, i18n_1.t)('否')]
|
|
68
|
+
})).flag === (0, i18n_1.t)('是')) {
|
|
69
|
+
loading.start((0, i18n_1.t)('正在删除镜像仓库'));
|
|
70
|
+
const res = await (0, run_1.deleteImageRepo)({ imageRepo });
|
|
71
|
+
if (res === '') {
|
|
72
|
+
loading.succeed((0, i18n_1.t)('仓库删除完成'));
|
|
60
73
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const versions = yield (0, run_1.listVersion)({ envId, serverName: serviceName, limit: 1, offset: 0 });
|
|
64
|
-
if (versions.length > 0)
|
|
65
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('服务下还有版本存在,请先清空版本列表'));
|
|
66
|
-
const imageRepo = yield (0, run_1.describeImageRepo)({ envId, serverName: serviceName });
|
|
67
|
-
loading.start((0, i18n_1.t)('正在删除服务'));
|
|
68
|
-
const res = yield (0, run_1.deleteRun)({ envId, serverName: serviceName });
|
|
69
|
-
if (res === 'succ')
|
|
70
|
-
loading.succeed((0, i18n_1.t)('服务删除完成'));
|
|
71
|
-
else
|
|
72
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('服务删除失败'));
|
|
73
|
-
if ((yield (0, enquirer_1.prompt)({
|
|
74
|
-
type: 'select',
|
|
75
|
-
name: 'flag',
|
|
76
|
-
message: (0, i18n_1.t)('是否删除绑定的镜像仓库{{imageRepo}}', { imageRepo }),
|
|
77
|
-
choices: [(0, i18n_1.t)('是'), (0, i18n_1.t)('否')]
|
|
78
|
-
})).flag === (0, i18n_1.t)('是')) {
|
|
79
|
-
loading.start((0, i18n_1.t)('正在删除镜像仓库'));
|
|
80
|
-
const res = yield (0, run_1.deleteImageRepo)({ imageRepo });
|
|
81
|
-
if (res === '') {
|
|
82
|
-
loading.succeed((0, i18n_1.t)('仓库删除完成'));
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('仓库删除失败'));
|
|
86
|
-
}
|
|
74
|
+
else {
|
|
75
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('仓库删除失败'));
|
|
87
76
|
}
|
|
88
|
-
}
|
|
77
|
+
}
|
|
89
78
|
}
|
|
90
79
|
};
|
|
91
80
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
15
|
exports.DeleteImage = void 0;
|
|
25
16
|
const common_1 = require("../../common");
|
|
@@ -31,7 +22,9 @@ const common_2 = require("./common");
|
|
|
31
22
|
const i18n_1 = require("../../../i18n");
|
|
32
23
|
let DeleteImage = class DeleteImage extends common_1.Command {
|
|
33
24
|
get options() {
|
|
34
|
-
return
|
|
25
|
+
return {
|
|
26
|
+
...(0, common_2.imageCommonOptions)('delete'),
|
|
27
|
+
options: [
|
|
35
28
|
{
|
|
36
29
|
flags: '-e, --envId <envId>',
|
|
37
30
|
desc: (0, i18n_1.t)('环境 Id')
|
|
@@ -44,37 +37,37 @@ let DeleteImage = class DeleteImage extends common_1.Command {
|
|
|
44
37
|
flags: '-t, --imageTag <imageTag>',
|
|
45
38
|
desc: (0, i18n_1.t)('镜像 tag')
|
|
46
39
|
}
|
|
47
|
-
],
|
|
40
|
+
],
|
|
41
|
+
desc: (0, i18n_1.t)('删除云开发环境下云托管服务的版本')
|
|
42
|
+
};
|
|
48
43
|
}
|
|
49
|
-
execute(envId, options) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
else
|
|
72
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('删除失败'));
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
44
|
+
async execute(envId, options) {
|
|
45
|
+
let envCheckType = await (0, utils_1.checkTcbrEnv)(options.envId, false);
|
|
46
|
+
if (envCheckType !== 0) {
|
|
47
|
+
(0, utils_1.logEnvCheck)(envId, envCheckType);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let { serviceName = '', imageTag = '' } = options;
|
|
51
|
+
if (serviceName.length === 0 || imageTag.length === 0) {
|
|
52
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('必须输入 serviceName 和 imageTag'));
|
|
53
|
+
}
|
|
54
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
55
|
+
loading.start((0, i18n_1.t)('数据加载中...'));
|
|
56
|
+
const imageRepo = await (0, run_1.describeImageRepo)({ envId, serverName: serviceName });
|
|
57
|
+
const imageUrl = `ccr.ccs.tencentyun.com/${imageRepo}:${imageTag}`;
|
|
58
|
+
try {
|
|
59
|
+
const res = await (0, run_1.deleteImage)({
|
|
60
|
+
envId,
|
|
61
|
+
imageUrl: imageUrl
|
|
62
|
+
});
|
|
63
|
+
if (res === 'success')
|
|
64
|
+
loading.succeed((0, i18n_1.t)('成功删除 {{serviceName}} 服务下的 {{imageUrl}} 镜像', { serviceName, imageUrl }));
|
|
65
|
+
else
|
|
75
66
|
throw new error_1.CloudBaseError((0, i18n_1.t)('删除失败'));
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('删除失败'));
|
|
70
|
+
}
|
|
78
71
|
}
|
|
79
72
|
};
|
|
80
73
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
15
|
exports.DownLoadImage = void 0;
|
|
25
16
|
const child_process_1 = require("child_process");
|
|
@@ -32,7 +23,9 @@ const common_2 = require("./common");
|
|
|
32
23
|
const i18n_1 = require("../../../i18n");
|
|
33
24
|
let DownLoadImage = class DownLoadImage extends common_1.Command {
|
|
34
25
|
get options() {
|
|
35
|
-
return
|
|
26
|
+
return {
|
|
27
|
+
...(0, common_2.imageCommonOptions)('download'),
|
|
28
|
+
options: [
|
|
36
29
|
{
|
|
37
30
|
flags: '-e, --envId <envId>',
|
|
38
31
|
desc: (0, i18n_1.t)('环境 Id')
|
|
@@ -45,31 +38,31 @@ let DownLoadImage = class DownLoadImage extends common_1.Command {
|
|
|
45
38
|
flags: '-t, --imageTag <imageTag>',
|
|
46
39
|
desc: (0, i18n_1.t)('镜像 tag')
|
|
47
40
|
}
|
|
48
|
-
],
|
|
41
|
+
],
|
|
42
|
+
desc: (0, i18n_1.t)('下载云开发环境下云托管服务的镜像')
|
|
43
|
+
};
|
|
49
44
|
}
|
|
50
|
-
execute(envId, options) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
(0, child_process_1.exec)(`docker pull ${imageUrl}`, (err, stdout) => err ? reject(err) : resolve({ code: 0, info: stdout })).stdout.pipe(process.stdout);
|
|
69
|
-
});
|
|
70
|
-
yield sh;
|
|
71
|
-
loading.succeed((0, i18n_1.t)('拉取成功'));
|
|
45
|
+
async execute(envId, options) {
|
|
46
|
+
let envCheckType = await (0, utils_1.checkTcbrEnv)(options.envId, false);
|
|
47
|
+
if (envCheckType !== 0) {
|
|
48
|
+
(0, utils_1.logEnvCheck)(envId, envCheckType);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
let { serviceName = '', imageTag = '' } = options;
|
|
52
|
+
if (serviceName.length === 0 || imageTag.length === 0) {
|
|
53
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('必须输入 serviceName 和 imageTag'));
|
|
54
|
+
}
|
|
55
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
56
|
+
const imageRepo = await (0, run_1.describeImageRepo)({ envId, serverName: serviceName });
|
|
57
|
+
const imageUrl = `ccr.ccs.tencentyun.com/${imageRepo}:${imageTag}`;
|
|
58
|
+
if (!(await (0, run_1.getAuthFlag)())) {
|
|
59
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('无法找到~/.docker/config.json或未登录,需要执行docker login'));
|
|
60
|
+
}
|
|
61
|
+
let sh = new Promise((resolve, reject) => {
|
|
62
|
+
(0, child_process_1.exec)(`docker pull ${imageUrl}`, (err, stdout) => err ? reject(err) : resolve({ code: 0, info: stdout })).stdout.pipe(process.stdout);
|
|
72
63
|
});
|
|
64
|
+
await sh;
|
|
65
|
+
loading.succeed((0, i18n_1.t)('拉取成功'));
|
|
73
66
|
}
|
|
74
67
|
};
|
|
75
68
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
15
|
exports.ListImage = void 0;
|
|
25
16
|
const common_1 = require("../../common");
|
|
@@ -31,7 +22,9 @@ const common_2 = require("./common");
|
|
|
31
22
|
const i18n_1 = require("../../../i18n");
|
|
32
23
|
let ListImage = class ListImage extends common_1.Command {
|
|
33
24
|
get options() {
|
|
34
|
-
return
|
|
25
|
+
return {
|
|
26
|
+
...(0, common_2.imageCommonOptions)('list'),
|
|
27
|
+
options: [
|
|
35
28
|
{
|
|
36
29
|
flags: '-e, --envId <envId>',
|
|
37
30
|
desc: (0, i18n_1.t)('环境 Id')
|
|
@@ -48,46 +41,46 @@ let ListImage = class ListImage extends common_1.Command {
|
|
|
48
41
|
flags: '-o, --offset <offset>',
|
|
49
42
|
desc: (0, i18n_1.t)('数据偏移量,默认值为 0')
|
|
50
43
|
}
|
|
51
|
-
],
|
|
44
|
+
],
|
|
45
|
+
desc: (0, i18n_1.t)('展示选择的云托管服务的版本列表')
|
|
46
|
+
};
|
|
52
47
|
}
|
|
53
|
-
execute(envId, options) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
serviceName: serviceName
|
|
79
|
-
});
|
|
80
|
-
loading.stop();
|
|
81
|
-
const head = [(0, i18n_1.t)('镜像'), (0, i18n_1.t)('大小'), (0, i18n_1.t)('关联服务版本'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('更新时间')];
|
|
82
|
-
const tableData = data.map((item) => [
|
|
83
|
-
item.ImageUrl.split(':')[1],
|
|
84
|
-
item.Size,
|
|
85
|
-
item.ReferVersions.length > 0 ? item.ReferVersions.reduce((sum, item) => `${sum}|${item.VersionName}`, '') : '-',
|
|
86
|
-
item.CreateTime,
|
|
87
|
-
item.UpdateTime,
|
|
88
|
-
]);
|
|
89
|
-
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
48
|
+
async execute(envId, options) {
|
|
49
|
+
let envCheckType = await (0, utils_1.checkTcbrEnv)(options.envId, false);
|
|
50
|
+
if (envCheckType !== 0) {
|
|
51
|
+
(0, utils_1.logEnvCheck)(envId, envCheckType);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
let { limit = 20, offset = 0, serviceName = '' } = options;
|
|
55
|
+
limit = Number(limit);
|
|
56
|
+
offset = Number(offset);
|
|
57
|
+
if (!Number.isInteger(limit) || !Number.isInteger(offset)) {
|
|
58
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('limit 和 offset 必须为整数'));
|
|
59
|
+
}
|
|
60
|
+
if (limit < 0 || offset < 0) {
|
|
61
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('limit 和 offset 必须为大于 0 的整数'));
|
|
62
|
+
}
|
|
63
|
+
if (serviceName.length === 0) {
|
|
64
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请输入查询的服务名'));
|
|
65
|
+
}
|
|
66
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
67
|
+
loading.start((0, i18n_1.t)('数据加载中...'));
|
|
68
|
+
const data = await (0, run_1.listImage)({
|
|
69
|
+
envId,
|
|
70
|
+
limit: Number(limit),
|
|
71
|
+
offset: Number(offset),
|
|
72
|
+
serviceName: serviceName
|
|
90
73
|
});
|
|
74
|
+
loading.stop();
|
|
75
|
+
const head = [(0, i18n_1.t)('镜像'), (0, i18n_1.t)('大小'), (0, i18n_1.t)('关联服务版本'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('更新时间')];
|
|
76
|
+
const tableData = data.map((item) => [
|
|
77
|
+
item.ImageUrl.split(':')[1],
|
|
78
|
+
item.Size,
|
|
79
|
+
item.ReferVersions.length > 0 ? item.ReferVersions.reduce((sum, item) => `${sum}|${item.VersionName}`, '') : '-',
|
|
80
|
+
item.CreateTime,
|
|
81
|
+
item.UpdateTime,
|
|
82
|
+
]);
|
|
83
|
+
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
91
84
|
}
|
|
92
85
|
};
|
|
93
86
|
__decorate([
|
|
@@ -34,15 +34,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
34
34
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
35
35
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
36
36
|
};
|
|
37
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
38
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
39
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
40
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
41
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
42
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
43
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
38
|
exports.UploadImage = void 0;
|
|
48
39
|
const child_process_1 = require("child_process");
|
|
@@ -56,7 +47,9 @@ const common_2 = require("./common");
|
|
|
56
47
|
const i18n_1 = require("../../../i18n");
|
|
57
48
|
let UploadImage = class UploadImage extends common_1.Command {
|
|
58
49
|
get options() {
|
|
59
|
-
return
|
|
50
|
+
return {
|
|
51
|
+
...(0, common_2.imageCommonOptions)('upload'),
|
|
52
|
+
options: [
|
|
60
53
|
{
|
|
61
54
|
flags: '-e, --envId <envId>',
|
|
62
55
|
desc: (0, i18n_1.t)('环境 Id')
|
|
@@ -73,31 +66,31 @@ let UploadImage = class UploadImage extends common_1.Command {
|
|
|
73
66
|
flags: '-t, --imageTag <imageTag>',
|
|
74
67
|
desc: (0, i18n_1.t)('镜像 tag')
|
|
75
68
|
}
|
|
76
|
-
],
|
|
69
|
+
],
|
|
70
|
+
desc: (0, i18n_1.t)('上传云开发环境下云托管服务的镜像')
|
|
71
|
+
};
|
|
77
72
|
}
|
|
78
|
-
execute(envId, options) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
(0, child_process_1.exec)(`docker push ccr.ccs.tencentyun.com/${imageRepo}:${imageTag}`, (stderr, stdout) => stderr ? reject(stderr) : resolve({ code: 0, info: stdout })).stdout.pipe(process.stdout);
|
|
97
|
-
});
|
|
98
|
-
yield sh;
|
|
99
|
-
loading.succeed((0, i18n_1.t)('上传成功'));
|
|
73
|
+
async execute(envId, options) {
|
|
74
|
+
let envCheckType = await (0, utils_1.checkTcbrEnv)(options.envId, false);
|
|
75
|
+
if (envCheckType !== 0) {
|
|
76
|
+
(0, utils_1.logEnvCheck)(envId, envCheckType);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const { serviceName = '', imageId = '', imageTag = '' } = options;
|
|
80
|
+
if (serviceName.length === 0 || imageId.length === 0 || imageTag.length === 0) {
|
|
81
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('必须输入 serviceName 和 imageId 和 imageTag'));
|
|
82
|
+
}
|
|
83
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
84
|
+
if (!(await (0, run_1.getAuthFlag)())) {
|
|
85
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('无法找到~/.docker/config.json或未登录,需要执行docker login'));
|
|
86
|
+
}
|
|
87
|
+
const imageRepo = await (0, run_1.describeImageRepo)({ envId, serverName: serviceName });
|
|
88
|
+
await util.promisify(child_process_1.exec)(`docker tag ${imageId} ccr.ccs.tencentyun.com/${imageRepo}:${imageTag}`);
|
|
89
|
+
let sh = new Promise((resolve, reject) => {
|
|
90
|
+
(0, child_process_1.exec)(`docker push ccr.ccs.tencentyun.com/${imageRepo}:${imageTag}`, (stderr, stdout) => stderr ? reject(stderr) : resolve({ code: 0, info: stdout })).stdout.pipe(process.stdout);
|
|
100
91
|
});
|
|
92
|
+
await sh;
|
|
93
|
+
loading.succeed((0, i18n_1.t)('上传成功'));
|
|
101
94
|
}
|
|
102
95
|
};
|
|
103
96
|
__decorate([
|