@cloudbase/cli 2.0.14 → 2.1.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/.history/.gitignore_20220624162613 +84 -0
- package/.history/.gitignore_20220627114054 +86 -0
- package/.history/package_20220711204706.json +88 -0
- package/.history/package_20220711204818.json +88 -0
- package/.history/package_20220712151717.json +88 -0
- package/.history/package_20220712212537.json +88 -0
- package/.history/package_20220722205058.json +88 -0
- package/.history/package_20220726110155.json +88 -0
- package/.history/package_20220726110201.json +88 -0
- package/.history/package_20220728110905.json +88 -0
- package/.history/package_20220728110936.json +88 -0
- package/.history/package_20220728111531.json +89 -0
- package/.history/package_20220728111810.json +89 -0
- package/.history/src/commands/lowcode/app_20220728111717.ts +52 -0
- package/.history/src/commands/lowcode/app_20220728112031.ts +34 -0
- package/.history/src/index_20220624162613.ts +13 -0
- package/.history/src/index_20220627113609.ts +15 -0
- package/.history/src/index_20220627114102.ts +13 -0
- package/.vscode/launch.json +10 -0
- package/bin/cloudbase.js +0 -0
- package/bin/tcb.js +5 -5
- package/lib/commands/account/login.js +3 -6
- package/lib/commands/env/index.js +0 -1
- package/lib/commands/lowcode/app.js +1 -1
- package/lib/commands/run/index.js +0 -1
- package/lib/commands/run/service/deploy.js +2 -1
- package/lib/commands/run/service/index.js +0 -1
- package/lib/constant.js +15 -1
- package/lib/env/index.js +1 -11
- package/lib/run/index.js +0 -1
- package/lib/run/service/common.js +11 -4
- package/lib/run/service/config.js +2 -3
- package/lib/run/service/index.js +0 -1
- package/lib/run/service/update.js +1 -1
- package/package.json +2 -2
- package/types/commands/env/index.d.ts +0 -1
- package/types/commands/run/index.d.ts +0 -1
- package/types/commands/run/service/index.d.ts +0 -1
- package/types/env/index.d.ts +0 -6
- package/types/run/index.d.ts +0 -1
- package/types/run/service/common.d.ts +4 -0
- package/types/run/service/index.d.ts +0 -1
- package/.vscode/settings.json +0 -3
- package/lib/commands/env/create.js +0 -115
- package/lib/commands/run/create.js +0 -162
- package/lib/commands/run/service/create.js +0 -148
- package/lib/run/create.js +0 -19
- package/lib/run/service/create.js +0 -67
- package/types/commands/env/create.d.ts +0 -12
- package/types/commands/run/create.d.ts +0 -13
- package/types/commands/run/service/create.d.ts +0 -13
- package/types/run/create.d.ts +0 -2
- package/types/run/service/create.d.ts +0 -7
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.CreateServiceTcbr = void 0;
|
|
25
|
-
const common_1 = require("../../common");
|
|
26
|
-
const decorators_1 = require("../../../decorators");
|
|
27
|
-
const error_1 = require("../../../error");
|
|
28
|
-
const run_1 = require("../../../run");
|
|
29
|
-
const utils_1 = require("../../../utils");
|
|
30
|
-
let CreateServiceTcbr = class CreateServiceTcbr extends common_1.Command {
|
|
31
|
-
get options() {
|
|
32
|
-
return {
|
|
33
|
-
cmd: 'run',
|
|
34
|
-
childCmd: 'service:create',
|
|
35
|
-
options: [
|
|
36
|
-
{
|
|
37
|
-
flags: '--noConfirm',
|
|
38
|
-
desc: '发布前是否跳过二次确认'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
flags: '--override',
|
|
42
|
-
desc: '缺省的参数是否沿用旧版本配置'
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
flags: '-e, --envId <envId>',
|
|
46
|
-
desc: '环境 Id,必填'
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
flags: '-s, --serviceName <serviceName>',
|
|
50
|
-
desc: '服务名,必填'
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
flags: '--path <path>',
|
|
54
|
-
desc: '本地代码根目录'
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
flags: '--cpu <cpu>',
|
|
58
|
-
desc: '单一实例cpu规格,默认0.5'
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
flags: '--mem <mem>',
|
|
62
|
-
desc: '单一实例内存规格,默认1'
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
flags: '--minNum <minNum>',
|
|
66
|
-
desc: '最小副本数,默认0'
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
flags: '--maxNum <maxNum>',
|
|
70
|
-
desc: '最大副本数,默认50,不能大于50'
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
flags: '--policyDetails <policyDetails>',
|
|
74
|
-
desc: '扩缩容配置,格式为条件类型=条件比例(%),多个条件之间用&隔开,内存条件为mem,cpu条件为cpu,默认内存>60% 或 CPU>60%,即cpu=60&mem=60'
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
flags: '--customLogs <customLogs>',
|
|
78
|
-
desc: '日志采集路径,默认stdout'
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
flags: '--envParams <envParams>',
|
|
82
|
-
desc: '环境变量,格式为xx=a&yy=b,默认为空'
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
flags: '--log_type <log_type>',
|
|
86
|
-
desc: '日志类型,只能为 none,如需自定义日志,请前往控制台配置'
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
flags: '--containerPort <containerPort>',
|
|
90
|
-
desc: '监听端口,必填'
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
flags: '--remark <remark>',
|
|
94
|
-
desc: '版本备注,默认为空'
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
flags: '--targetDir <targetDir>',
|
|
98
|
-
desc: '目标目录'
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
flags: '--dockerfile <dockerfile>',
|
|
102
|
-
desc: 'Dockerfile文件名,默认为 Dockerfile'
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
flags: '--custom_image <custom_image>',
|
|
106
|
-
desc: 'TCR 仓库镜像 URL'
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
flags: '--image <image>',
|
|
110
|
-
desc: '镜像标签或ID'
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
flags: '--json',
|
|
114
|
-
desc: '以 JSON 形式展示结果'
|
|
115
|
-
}
|
|
116
|
-
],
|
|
117
|
-
desc: '在指定环境下创建服务'
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
execute(options) {
|
|
121
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
let envCheckType = yield (0, utils_1.checkTcbrEnv)(options.envId, true);
|
|
123
|
-
if (envCheckType !== 0) {
|
|
124
|
-
(0, utils_1.logEnvCheck)(options.envId, envCheckType);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const { data: serviceDetail } = yield (0, run_1.describeCloudRunServerDetail)({
|
|
128
|
-
envId: options.envId,
|
|
129
|
-
serviceName: options.serviceName
|
|
130
|
-
});
|
|
131
|
-
if (serviceDetail !== undefined) {
|
|
132
|
-
throw new error_1.CloudBaseError('当前服务已存在,请使用 tcb run service:deploy 更新服务');
|
|
133
|
-
}
|
|
134
|
-
yield (0, run_1.createTcbrService)(options);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
__decorate([
|
|
139
|
-
(0, decorators_1.InjectParams)(),
|
|
140
|
-
__param(0, (0, decorators_1.ArgsOptions)()),
|
|
141
|
-
__metadata("design:type", Function),
|
|
142
|
-
__metadata("design:paramtypes", [Object]),
|
|
143
|
-
__metadata("design:returntype", Promise)
|
|
144
|
-
], CreateServiceTcbr.prototype, "execute", null);
|
|
145
|
-
CreateServiceTcbr = __decorate([
|
|
146
|
-
(0, common_1.ICommand)()
|
|
147
|
-
], CreateServiceTcbr);
|
|
148
|
-
exports.CreateServiceTcbr = CreateServiceTcbr;
|
package/lib/run/create.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createRun = void 0;
|
|
13
|
-
const utils_1 = require("../utils");
|
|
14
|
-
const tcbService = utils_1.CloudApiService.getInstance('tcb');
|
|
15
|
-
const createRun = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
const { Result } = yield tcbService.request('EstablishCloudBaseRunServer', Object.assign(Object.assign({ EnvId: options.envId, ServiceName: options.name, Remark: options.remark, VpcInfo: options.vpcInfo, LogType: options.logType, IsPublic: options.isPublic }, (options.imageRepo ? { ImageRepo: options.imageRepo } : {})), (options.logType === 'es' ? { EsInfo: options.esInfo } : {})));
|
|
17
|
-
return Result;
|
|
18
|
-
});
|
|
19
|
-
exports.createRun = createRun;
|
|
@@ -1,67 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.createTcbrService = exports.createCloudRunServer = exports.describeCloudRunServerDetail = void 0;
|
|
16
|
-
const utils_1 = require("../../utils");
|
|
17
|
-
const _1 = require(".");
|
|
18
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
19
|
-
const toolbox_1 = require("@cloudbase/toolbox");
|
|
20
|
-
const describeCloudRunServerDetail = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
-
return yield (0, utils_1.callTcbrApi)('DescribeCloudRunServerDetail', {
|
|
22
|
-
EnvId: options.envId,
|
|
23
|
-
ServerName: options.serviceName,
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
exports.describeCloudRunServerDetail = describeCloudRunServerDetail;
|
|
27
|
-
function createCloudRunServer(serviceConfigOptions) {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
return (0, utils_1.callTcbrApi)('CreateCloudRunServer', serviceConfigOptions);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
exports.createCloudRunServer = createCloudRunServer;
|
|
33
|
-
function createTcbrService(options) {
|
|
34
|
-
var _a;
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
const newServiceOptions = yield (0, _1.tcbrServiceOptions)(options, false, false);
|
|
37
|
-
if (!options.noConfirm) {
|
|
38
|
-
const { confirm } = yield inquirer_1.default.prompt([
|
|
39
|
-
{
|
|
40
|
-
type: 'confirm',
|
|
41
|
-
name: 'confirm',
|
|
42
|
-
message: '确定要创建服务吗?',
|
|
43
|
-
}
|
|
44
|
-
]);
|
|
45
|
-
if (!confirm) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const createRes = yield createCloudRunServer(newServiceOptions);
|
|
50
|
-
const taskId = (_a = createRes.data) === null || _a === void 0 ? void 0 : _a.TaskId;
|
|
51
|
-
if (options.json) {
|
|
52
|
-
console.log(JSON.stringify(createRes, null, 2));
|
|
53
|
-
}
|
|
54
|
-
if (process.argv.includes('--verbose')) {
|
|
55
|
-
yield (0, _1.getLogs)({
|
|
56
|
-
envId: options.envId,
|
|
57
|
-
taskId,
|
|
58
|
-
serviceName: options.serviceName
|
|
59
|
-
});
|
|
60
|
-
console.log(`本次任务的 TaskID: ${taskId}`);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
toolbox_1.logger.success('创建服务成功, 本次任务的 TaskID: ' + taskId);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
exports.createTcbrService = createTcbrService;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Command } from '../common';
|
|
2
|
-
export declare class CreateCommand extends Command {
|
|
3
|
-
get options(): {
|
|
4
|
-
cmd: string;
|
|
5
|
-
childCmd: string;
|
|
6
|
-
deprecateCmd: string;
|
|
7
|
-
options: any[];
|
|
8
|
-
desc: string;
|
|
9
|
-
requiredEnvId: boolean;
|
|
10
|
-
};
|
|
11
|
-
execute(params: any): Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from '../common';
|
|
2
|
-
export declare class CreateRun extends Command {
|
|
3
|
-
get options(): {
|
|
4
|
-
cmd: string;
|
|
5
|
-
childCmd: string;
|
|
6
|
-
options: {
|
|
7
|
-
flags: string;
|
|
8
|
-
desc: string;
|
|
9
|
-
}[];
|
|
10
|
-
desc: string;
|
|
11
|
-
};
|
|
12
|
-
execute(envId: any, options: any): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from '../../common';
|
|
2
|
-
export declare class CreateServiceTcbr extends Command {
|
|
3
|
-
get options(): {
|
|
4
|
-
cmd: string;
|
|
5
|
-
childCmd: string;
|
|
6
|
-
options: {
|
|
7
|
-
flags: string;
|
|
8
|
-
desc: string;
|
|
9
|
-
}[];
|
|
10
|
-
desc: string;
|
|
11
|
-
};
|
|
12
|
-
execute(options: any): Promise<void>;
|
|
13
|
-
}
|
package/types/run/create.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ITcbrServiceOptions } from '../../types';
|
|
2
|
-
export declare const describeCloudRunServerDetail: (options: {
|
|
3
|
-
envId: string;
|
|
4
|
-
serviceName: string;
|
|
5
|
-
}) => Promise<any>;
|
|
6
|
-
export declare function createCloudRunServer(serviceConfigOptions: Record<string, any>): Promise<any>;
|
|
7
|
-
export declare function createTcbrService(options: ITcbrServiceOptions): Promise<void>;
|