@cloudbase/cli 2.0.13 → 2.1.1-alpha.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/package_20220729165237.json +89 -0
- package/.history/package_20220729165240.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 +6 -1
- package/lib/commands/run/service/index.js +0 -1
- package/lib/commands/run/service/update.js +4 -0
- 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 +20 -7
- 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 +8 -1
- package/types/run/service/index.d.ts +0 -1
- package/types/types.d.ts +4 -0
- 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 -144
- 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
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cloudbase/cli",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "cli tool for cloudbase",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "rimraf lib types && tsc",
|
|
8
|
+
"watch": "rimraf lib types && tsc -w",
|
|
9
|
+
"dev": "rimraf lib types && tsc -w",
|
|
10
|
+
"eslint": "eslint \"./**/*.ts\"",
|
|
11
|
+
"test": "jest --runInBand --forceExit --detectOpenHandles --coverage --verbose --testTimeout=10000",
|
|
12
|
+
"tsc": "tsc",
|
|
13
|
+
"pkg": "pkg ./bin/cloudbase.js --out-path ./pkg",
|
|
14
|
+
"postinstall": "node ./post-install.js || exit 0",
|
|
15
|
+
"prepublishOnly": "npm run build"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/TencentCloudBase/cloud-base-cli.git"
|
|
20
|
+
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"tcb": "bin/tcb.js",
|
|
23
|
+
"cloudbase": "bin/cloudbase.js"
|
|
24
|
+
},
|
|
25
|
+
"husky": {
|
|
26
|
+
"hooks": {
|
|
27
|
+
"pre-commit": "npm run build"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"author": "cwuyiqing@gmail.com",
|
|
31
|
+
"license": "ISC",
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@cloudbase/cloud-api": "^0.5.5",
|
|
34
|
+
"@cloudbase/framework-core": "^1.6.1",
|
|
35
|
+
"@cloudbase/lowcode-cli": "0.15.2-alpha.0",
|
|
36
|
+
"@cloudbase/manager-node": "4.0.1",
|
|
37
|
+
"@cloudbase/toolbox": "^0.7.3",
|
|
38
|
+
"@sentry/node": "^5.10.2",
|
|
39
|
+
"address": "^1.1.2",
|
|
40
|
+
"chalk": "^2.4.2",
|
|
41
|
+
"cli-table3": "^0.5.1",
|
|
42
|
+
"commander": "7",
|
|
43
|
+
"del": "^5.1.0",
|
|
44
|
+
"didyoumean": "^1.2.2",
|
|
45
|
+
"enquirer": "^2.3.6",
|
|
46
|
+
"execa": "^4.0.3",
|
|
47
|
+
"fs-extra": "^8.1.0",
|
|
48
|
+
"https-proxy-agent": "^5.0.1",
|
|
49
|
+
"inquirer": "^6.5.0",
|
|
50
|
+
"lodash": "^4.17.21",
|
|
51
|
+
"log-symbols": "^3.0.0",
|
|
52
|
+
"lowdb": "^1.0.0",
|
|
53
|
+
"make-dir": "^3.0.0",
|
|
54
|
+
"node-fetch": "^2.6.0",
|
|
55
|
+
"open": "^7.0.0",
|
|
56
|
+
"ora": "^4.0.2",
|
|
57
|
+
"portfinder": "^1.0.28",
|
|
58
|
+
"progress": "^2.0.3",
|
|
59
|
+
"query-string": "^6.8.1",
|
|
60
|
+
"reflect-metadata": "^0.1.13",
|
|
61
|
+
"semver": "^7.3.7",
|
|
62
|
+
"tar-fs": "^2.0.1",
|
|
63
|
+
"terminal-link": "^2.1.1",
|
|
64
|
+
"unzipper": "^0.10.10",
|
|
65
|
+
"update-notifier": "^4.0.0",
|
|
66
|
+
"xdg-basedir": "^4.0.0",
|
|
67
|
+
"yargs": "^16.2.0",
|
|
68
|
+
"yargs-parser": "^21.0.1"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@types/jest": "^27",
|
|
72
|
+
"@types/koa__router": "^8.0.11",
|
|
73
|
+
"@types/lodash": "^4.14.182",
|
|
74
|
+
"@types/node": "^12.12.38",
|
|
75
|
+
"@types/node-fetch": "^2.5.4",
|
|
76
|
+
"@types/react": "^17.0.37",
|
|
77
|
+
"@types/semver": "^7.3.9",
|
|
78
|
+
"@types/webpack-dev-server": "^3.11.1",
|
|
79
|
+
"@typescript-eslint/eslint-plugin": "^4.8.1",
|
|
80
|
+
"@typescript-eslint/parser": "^4.8.1",
|
|
81
|
+
"eslint": "^7.14.0",
|
|
82
|
+
"eslint-config-alloy": "^3.8.2",
|
|
83
|
+
"husky": "^3.0.9",
|
|
84
|
+
"jest": "^27",
|
|
85
|
+
"rimraf": "^3.0.2",
|
|
86
|
+
"ts-jest": "^27",
|
|
87
|
+
"typescript": "^4.7.2"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
import { Command, ICommand } from '../common'
|
|
3
|
+
import { watchApp } from '@cloudbase/lowcode-cli'
|
|
4
|
+
import { InjectParams, Log, Logger, CmdContext, ArgsOptions } from '../../decorators'
|
|
5
|
+
|
|
6
|
+
@ICommand()
|
|
7
|
+
export class LowCodeWatch extends Command {
|
|
8
|
+
get options() {
|
|
9
|
+
return {
|
|
10
|
+
cmd: 'lowcode',
|
|
11
|
+
childCmd: 'watch',
|
|
12
|
+
options: [
|
|
13
|
+
{
|
|
14
|
+
flags: '--verbose',
|
|
15
|
+
desc: '是否打印详细日志'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
flags: '--wx-devtool-path <wxDevtoolPath>',
|
|
19
|
+
desc: '微信开发者工具的安装路径'
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
desc: '开启云开发低码的本地构建模式',
|
|
23
|
+
requiredEnvId: false
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@InjectParams()
|
|
28
|
+
async execute(@CmdContext() ctx, @ArgsOptions() options) {
|
|
29
|
+
await watchApp({
|
|
30
|
+
watchPort: 8288,
|
|
31
|
+
wxDevtoolPath: options?.wxDevtoolPath
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@ICommand()
|
|
37
|
+
export class DanielWatch extends Command {
|
|
38
|
+
get options() {
|
|
39
|
+
return {
|
|
40
|
+
cmd: 'lowcode',
|
|
41
|
+
childCmd: 'watch-ws',
|
|
42
|
+
options: [],
|
|
43
|
+
desc: '开启云开发低码的本地开发模式',
|
|
44
|
+
requiredEnvId: false
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@InjectParams()
|
|
49
|
+
async execute(@CmdContext() ctx, @ArgsOptions() options) {
|
|
50
|
+
console.log('>>> 启动啦')
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
import { Command, ICommand } from '../common'
|
|
3
|
+
import { watchApp } from '@cloudbase/lowcode-cli'
|
|
4
|
+
import { InjectParams, Log, Logger, CmdContext, ArgsOptions } from '../../decorators'
|
|
5
|
+
|
|
6
|
+
@ICommand()
|
|
7
|
+
export class LowCodeWatch extends Command {
|
|
8
|
+
get options() {
|
|
9
|
+
return {
|
|
10
|
+
cmd: 'lowcode',
|
|
11
|
+
childCmd: 'watch',
|
|
12
|
+
options: [
|
|
13
|
+
{
|
|
14
|
+
flags: '--verbose',
|
|
15
|
+
desc: '是否打印详细日志'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
flags: '--wx-devtool-path <wxDevtoolPath>',
|
|
19
|
+
desc: '微信开发者工具的安装路径'
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
desc: '开启云开发低码的本地构建模式',
|
|
23
|
+
requiredEnvId: false
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@InjectParams()
|
|
28
|
+
async execute(@CmdContext() ctx, @ArgsOptions() options) {
|
|
29
|
+
await watchApp({
|
|
30
|
+
watchPort: 8288,
|
|
31
|
+
wxDevtoolPath: options?.wxDevtoolPath
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'reflect-metadata'
|
|
2
|
+
import { registerCommands } from './commands/common'
|
|
3
|
+
import './commands'
|
|
4
|
+
|
|
5
|
+
export { smartDeploy } from './commands'
|
|
6
|
+
|
|
7
|
+
registerCommands()
|
|
8
|
+
|
|
9
|
+
// HACK: 部分依赖使用了 globalThis,会在 Node12 以下的版本报错
|
|
10
|
+
if (typeof globalThis === undefined) {
|
|
11
|
+
// eslint-disable-next-line no-undef
|
|
12
|
+
;(globalThis as any) = global
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import 'reflect-metadata'
|
|
2
|
+
import { registerCommands } from './commands/common'
|
|
3
|
+
import './commands'
|
|
4
|
+
|
|
5
|
+
export { smartDeploy } from './commands'
|
|
6
|
+
|
|
7
|
+
registerCommands()
|
|
8
|
+
|
|
9
|
+
// HACK: 部分依赖使用了 globalThis,会在 Node12 以下的版本报错
|
|
10
|
+
if (typeof globalThis === undefined) {
|
|
11
|
+
// eslint-disable-next-line no-undef
|
|
12
|
+
;(globalThis as any) = global
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
console.log("daniel tcb")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'reflect-metadata'
|
|
2
|
+
import { registerCommands } from './commands/common'
|
|
3
|
+
import './commands'
|
|
4
|
+
|
|
5
|
+
export { smartDeploy } from './commands'
|
|
6
|
+
|
|
7
|
+
registerCommands()
|
|
8
|
+
|
|
9
|
+
// HACK: 部分依赖使用了 globalThis,会在 Node12 以下的版本报错
|
|
10
|
+
if (typeof globalThis === undefined) {
|
|
11
|
+
// eslint-disable-next-line no-undef
|
|
12
|
+
;(globalThis as any) = global
|
|
13
|
+
}
|
package/.vscode/launch.json
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
5
|
"version": "0.2.0",
|
|
6
6
|
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Debug: lowcode watch",
|
|
9
|
+
"program": "${workspaceFolder}/bin/tcb.js",
|
|
10
|
+
"request": "launch",
|
|
11
|
+
"skipFiles": [
|
|
12
|
+
"<node_internals>/**"
|
|
13
|
+
],
|
|
14
|
+
"args": ["lowcode", "watch"],
|
|
15
|
+
"type": "node"
|
|
16
|
+
},
|
|
7
17
|
{
|
|
8
18
|
"type": "node",
|
|
9
19
|
"request": "launch",
|
package/bin/cloudbase.js
CHANGED
|
File without changes
|
package/bin/tcb.js
CHANGED
|
@@ -84,20 +84,20 @@ if (isCommandEmpty) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// 处理无效命令
|
|
87
|
-
program.action((
|
|
88
|
-
const args =
|
|
87
|
+
program.action(() => {
|
|
88
|
+
const args = program.args
|
|
89
89
|
if (!Array.isArray(args) || !args.length) {
|
|
90
90
|
return
|
|
91
91
|
}
|
|
92
92
|
const cmd = args.join(' ')
|
|
93
|
-
console.log(chalk.bold.red('Error: ') + `${cmd}
|
|
93
|
+
console.log(chalk.bold.red('Error: ') + `${cmd} 不是有效的命令`)
|
|
94
94
|
didYouMean.threshold = 0.5
|
|
95
95
|
didYouMean.caseSensitive = false
|
|
96
96
|
const suggest = didYouMean(cmd, ALL_COMMANDS)
|
|
97
97
|
if (suggest) {
|
|
98
|
-
console.log(chalk.bold(`\n您是不是想使用命令:
|
|
98
|
+
console.log(chalk.bold(`\n您是不是想使用命令:tcb ${suggest}\n`))
|
|
99
99
|
}
|
|
100
|
-
console.log(
|
|
100
|
+
console.log(`💡使用 ${chalk.bold('tcb -h')} 查看所有命令`)
|
|
101
101
|
})
|
|
102
102
|
|
|
103
103
|
// 没有使用命令
|
|
@@ -37,10 +37,6 @@ const utils_1 = require("../../utils");
|
|
|
37
37
|
function printSuggestion() {
|
|
38
38
|
const tips = `可使用下面命令继续操作:
|
|
39
39
|
|
|
40
|
-
${chalk_1.default.gray('–')} 创建免费环境
|
|
41
|
-
|
|
42
|
-
${chalk_1.default.cyan('$ tcb env create envName')}
|
|
43
|
-
|
|
44
40
|
${chalk_1.default.gray('–')} 初始化云开发项目
|
|
45
41
|
|
|
46
42
|
${chalk_1.default.cyan('$ tcb new')}
|
|
@@ -177,15 +173,16 @@ let LoginCommand = class LoginCommand extends common_1.Command {
|
|
|
177
173
|
return process.exit(1);
|
|
178
174
|
}
|
|
179
175
|
}
|
|
176
|
+
const consoleUrl = 'https://console.cloud.tencent.com/tcb/env/index?action=CreateEnv&from=cli';
|
|
180
177
|
try {
|
|
181
178
|
const envs = yield (0, env_1.listEnvs)();
|
|
182
179
|
if (!envs.length) {
|
|
183
|
-
log.warn(
|
|
180
|
+
log.warn(`您还没有可用的环境,请前往控制台 ${(0, utils_1.genClickableLink)(consoleUrl)} 创建环境`);
|
|
184
181
|
}
|
|
185
182
|
}
|
|
186
183
|
catch (e) {
|
|
187
184
|
if (e.code === 'ResourceNotFound.UserNotExists') {
|
|
188
|
-
log.error(
|
|
185
|
+
log.error(`您还没有可用的环境,请前往控制台 ${(0, utils_1.genClickableLink)(consoleUrl)} 创建环境`);
|
|
189
186
|
}
|
|
190
187
|
else {
|
|
191
188
|
console.error(e);
|
|
@@ -15,6 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./base"), exports);
|
|
18
|
-
__exportStar(require("./create"), exports);
|
|
19
18
|
__exportStar(require("./domain"), exports);
|
|
20
19
|
__exportStar(require("./login"), exports);
|
|
@@ -48,7 +48,7 @@ let LowCodeWatch = class LowCodeWatch extends common_1.Command {
|
|
|
48
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
49
|
yield (0, lowcode_cli_1.watchApp)({
|
|
50
50
|
watchPort: 8288,
|
|
51
|
-
wxDevtoolPath: options === null || options === void 0 ? void 0 : options.wxDevtoolPath
|
|
51
|
+
wxDevtoolPath: options === null || options === void 0 ? void 0 : options.wxDevtoolPath
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./list"), exports);
|
|
18
|
-
__exportStar(require("./create"), exports);
|
|
19
18
|
__exportStar(require("./version"), exports);
|
|
20
19
|
__exportStar(require("./delete"), exports);
|
|
21
20
|
__exportStar(require("./image"), exports);
|
|
@@ -26,6 +26,7 @@ const common_1 = require("../../common");
|
|
|
26
26
|
const decorators_1 = require("../../../decorators");
|
|
27
27
|
const run_1 = require("../../../run");
|
|
28
28
|
const utils_1 = require("../../../utils");
|
|
29
|
+
const toolbox_1 = require("@cloudbase/toolbox");
|
|
29
30
|
let DeployServiceTcbr = class DeployServiceTcbr extends common_1.Command {
|
|
30
31
|
get options() {
|
|
31
32
|
return {
|
|
@@ -80,6 +81,10 @@ let DeployServiceTcbr = class DeployServiceTcbr extends common_1.Command {
|
|
|
80
81
|
flags: '--envParams <envParams>',
|
|
81
82
|
desc: '环境变量,格式为xx=a&yy=b,默认为空'
|
|
82
83
|
},
|
|
84
|
+
{
|
|
85
|
+
flags: '--log_type <log_type>',
|
|
86
|
+
desc: '日志类型,只能为 none,如需自定义日志,请前往控制台配置'
|
|
87
|
+
},
|
|
83
88
|
{
|
|
84
89
|
flags: '--containerPort <containerPort>',
|
|
85
90
|
desc: '监听端口,必填'
|
|
@@ -128,7 +133,7 @@ let DeployServiceTcbr = class DeployServiceTcbr extends common_1.Command {
|
|
|
128
133
|
serviceName: options.serviceName
|
|
129
134
|
});
|
|
130
135
|
if (serviceDetail === undefined) {
|
|
131
|
-
|
|
136
|
+
throw new toolbox_1.CloudBaseError(`当前服务不存在,请前往控制台 ${(0, utils_1.genClickableLink)('https://console.cloud.tencent.com/tcbr')} 创建服务`);
|
|
132
137
|
}
|
|
133
138
|
else {
|
|
134
139
|
yield (0, run_1.updateTcbrService)(options);
|
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./list"), exports);
|
|
18
|
-
__exportStar(require("./create"), exports);
|
|
19
18
|
__exportStar(require("./update"), exports);
|
|
20
19
|
__exportStar(require("./deploy"), exports);
|
|
21
20
|
__exportStar(require("./config"), exports);
|
|
@@ -80,6 +80,10 @@ let UpdateServiceTcbr = class UpdateServiceTcbr extends common_1.Command {
|
|
|
80
80
|
flags: '--envParams <envParams>',
|
|
81
81
|
desc: '环境变量,格式为xx=a&yy=b,默认为空'
|
|
82
82
|
},
|
|
83
|
+
{
|
|
84
|
+
flags: '--log_type <log_type>',
|
|
85
|
+
desc: '日志类型,只能为 none,如需自定义日志,请前往控制台配置'
|
|
86
|
+
},
|
|
83
87
|
{
|
|
84
88
|
flags: '--containerPort <containerPort>',
|
|
85
89
|
desc: '监听端口,必填'
|
package/lib/constant.js
CHANGED
|
@@ -32,7 +32,6 @@ exports.ALL_COMMANDS = [
|
|
|
32
32
|
'open',
|
|
33
33
|
'env list',
|
|
34
34
|
'env rename',
|
|
35
|
-
'env create',
|
|
36
35
|
'env domain list',
|
|
37
36
|
'env domain create',
|
|
38
37
|
'env domain delete',
|
|
@@ -82,6 +81,21 @@ exports.ALL_COMMANDS = [
|
|
|
82
81
|
'run standalonegateway package list',
|
|
83
82
|
'run standalonegateway turn on',
|
|
84
83
|
'run standalonegateway turn off',
|
|
84
|
+
'run:deprecated list',
|
|
85
|
+
'run:deprecated delete',
|
|
86
|
+
'run:deprecated version list',
|
|
87
|
+
'run:deprecated version create',
|
|
88
|
+
'run:deprecated version modify',
|
|
89
|
+
'run:deprecated version delete',
|
|
90
|
+
'run:deprecated version update',
|
|
91
|
+
'run:deprecated image list',
|
|
92
|
+
'run:deprecated image upload',
|
|
93
|
+
'run:deprecated image download',
|
|
94
|
+
'run:deprecated image delete',
|
|
95
|
+
'run service:list',
|
|
96
|
+
'run service:deploy',
|
|
97
|
+
'run deploy',
|
|
98
|
+
'run service:config'
|
|
85
99
|
];
|
|
86
100
|
exports.StatusMap = {
|
|
87
101
|
Active: '部署完成',
|
package/lib/env/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getEnvLimit = exports.updateEnvInfo = exports.listEnvs = exports.getEnvInfo = exports.
|
|
26
|
+
exports.getEnvLimit = exports.updateEnvInfo = exports.listEnvs = exports.getEnvInfo = exports.initTcb = void 0;
|
|
27
27
|
const net_1 = require("../utils/net");
|
|
28
28
|
__exportStar(require("./domain"), exports);
|
|
29
29
|
__exportStar(require("./login"), exports);
|
|
@@ -37,16 +37,6 @@ function initTcb(skey) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
exports.initTcb = initTcb;
|
|
40
|
-
function createEnv({ alias, paymentMode }) {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
const { env } = yield (0, net_1.getMangerService)();
|
|
43
|
-
return env.createEnv({
|
|
44
|
-
paymentMode,
|
|
45
|
-
name: alias
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
exports.createEnv = createEnv;
|
|
50
40
|
function getEnvInfo(envId) {
|
|
51
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
42
|
const { EnvList } = yield tcbService.request('DescribeEnvs', {
|
package/lib/run/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./list"), exports);
|
|
18
|
-
__exportStar(require("./create"), exports);
|
|
19
18
|
__exportStar(require("./version"), exports);
|
|
20
19
|
__exportStar(require("./image"), exports);
|
|
21
20
|
__exportStar(require("./delete"), exports);
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.validateTcrImageURL = exports.getAuthorizedTcrInstance = exports.tcbrServiceOptions = exports.mergeEnvParams = exports.parseEnvParams = exports.extractPolicyDetails = exports.convertNumber = exports.describeWxCloudBaseRunReleaseOrder = void 0;
|
|
12
|
+
exports.validateTcrImageURL = exports.getAuthorizedTcrInstance = exports.tcbrServiceOptions = exports.mergeEnvParams = exports.parseEnvParams = exports.extractPolicyDetails = exports.convertNumber = exports.describeWxCloudBaseRunReleaseOrder = exports.describeCloudRunServerDetail = void 0;
|
|
13
13
|
const utils_1 = require("../../utils");
|
|
14
14
|
const types_1 = require("../../types");
|
|
15
15
|
const toolbox_1 = require("@cloudbase/toolbox");
|
|
@@ -18,6 +18,13 @@ const __1 = require("..");
|
|
|
18
18
|
const constant_1 = require("../../constant");
|
|
19
19
|
const tcbService = utils_1.CloudApiService.getInstance('tcb');
|
|
20
20
|
const tcrCloudApiService = new utils_1.CloudApiService('tcr', {}, '2019-09-24');
|
|
21
|
+
const describeCloudRunServerDetail = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
return yield (0, utils_1.callTcbrApi)('DescribeCloudRunServerDetail', {
|
|
23
|
+
EnvId: options.envId,
|
|
24
|
+
ServerName: options.serviceName,
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
exports.describeCloudRunServerDetail = describeCloudRunServerDetail;
|
|
21
28
|
function describeWxCloudBaseRunReleaseOrder(options) {
|
|
22
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
30
|
const res = yield tcbService.request('DescribeWxCloudBaseRunReleaseOrder', {
|
|
@@ -70,13 +77,13 @@ const mergeEnvParams = (curEnvParams, preEnvParams) => {
|
|
|
70
77
|
exports.mergeEnvParams = mergeEnvParams;
|
|
71
78
|
function checkRequiredParams(options) {
|
|
72
79
|
if (!options.envId) {
|
|
73
|
-
throw new toolbox_1.CloudBaseError('
|
|
80
|
+
throw new toolbox_1.CloudBaseError('请使用 -e 或 --envId 指定环境ID');
|
|
74
81
|
}
|
|
75
82
|
if (!options.serviceName) {
|
|
76
|
-
throw new toolbox_1.CloudBaseError('
|
|
83
|
+
throw new toolbox_1.CloudBaseError('请使用 -s 或 --serviceName 指定服务名');
|
|
77
84
|
}
|
|
78
85
|
if (!options.containerPort) {
|
|
79
|
-
throw new toolbox_1.CloudBaseError('
|
|
86
|
+
throw new toolbox_1.CloudBaseError('请使用 --containerPort 指定监听端口号');
|
|
80
87
|
}
|
|
81
88
|
if (!options.isCreated && !options.path && !options.custom_image) {
|
|
82
89
|
throw new toolbox_1.CloudBaseError('请使用 --path 指定代码根目录或 --custom_image 指定 TCR 镜像 URL');
|
|
@@ -87,7 +94,7 @@ function checkRequiredParams(options) {
|
|
|
87
94
|
}
|
|
88
95
|
function tcbrServiceOptions(options, isCreated, defaultOverride, previousServerConfig) {
|
|
89
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
let { noConfirm: _noConfirm = false, override: _override = (defaultOverride || false), envId, serviceName, path, cpu, mem, minNum, maxNum, policyDetails, customLogs, envParams, containerPort, remark, targetDir, dockerfile, image, custom_image, library_image, json: _json = false } = options;
|
|
97
|
+
let { noConfirm: _noConfirm = false, override: _override = (defaultOverride || false), envId, serviceName, path, cpu, mem, minNum, maxNum, policyDetails, customLogs, envParams, containerPort, remark, targetDir, dockerfile, image, custom_image, library_image, log_type, json: _json = false } = options;
|
|
91
98
|
checkRequiredParams({
|
|
92
99
|
envId,
|
|
93
100
|
serviceName,
|
|
@@ -111,7 +118,10 @@ function tcbrServiceOptions(options, isCreated, defaultOverride, previousServerC
|
|
|
111
118
|
maxNum,
|
|
112
119
|
minNum
|
|
113
120
|
});
|
|
114
|
-
|
|
121
|
+
if (log_type && log_type !== "none") {
|
|
122
|
+
throw new toolbox_1.CloudBaseError('日志类型 log_type 只能为 none,如需自定义日志,请前往控制台配置');
|
|
123
|
+
}
|
|
124
|
+
const defaultLogType = "none";
|
|
115
125
|
const newServiceOptions = {
|
|
116
126
|
ServerName: serviceName,
|
|
117
127
|
EnvId: envId,
|
|
@@ -132,7 +142,10 @@ function tcbrServiceOptions(options, isCreated, defaultOverride, previousServerC
|
|
|
132
142
|
Port: containerPort,
|
|
133
143
|
HasDockerfile: true,
|
|
134
144
|
Dockerfile: dockerfile || 'Dockerfile',
|
|
135
|
-
LogType: defaultLogType
|
|
145
|
+
LogType: (0, utils_1.parseInputParam)(log_type, _override, null, previousServerConfig === null || previousServerConfig === void 0 ? void 0 : previousServerConfig.LogType, defaultLogType),
|
|
146
|
+
LogSetId: previousServerConfig === null || previousServerConfig === void 0 ? void 0 : previousServerConfig.LogSetId,
|
|
147
|
+
LogTopicId: previousServerConfig === null || previousServerConfig === void 0 ? void 0 : previousServerConfig.LogTopicId,
|
|
148
|
+
LogParseType: previousServerConfig === null || previousServerConfig === void 0 ? void 0 : previousServerConfig.LogParseType,
|
|
136
149
|
},
|
|
137
150
|
DeployInfo: Object.assign({}, DeployInfo)
|
|
138
151
|
};
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.updateCloudRunServerConfig = exports.tcbrServiceConfigOptions = void 0;
|
|
13
|
-
const create_1 = require("./create");
|
|
14
13
|
const toolbox_1 = require("@cloudbase/toolbox");
|
|
15
14
|
const common_1 = require("./common");
|
|
16
15
|
const utils_1 = require("../../utils");
|
|
@@ -29,12 +28,12 @@ function tcbrServiceConfigOptions(options) {
|
|
|
29
28
|
maxNum,
|
|
30
29
|
minNum
|
|
31
30
|
});
|
|
32
|
-
const serviceInfo = yield (0,
|
|
31
|
+
const serviceInfo = yield (0, common_1.describeCloudRunServerDetail)({
|
|
33
32
|
envId,
|
|
34
33
|
serviceName
|
|
35
34
|
});
|
|
36
35
|
if (serviceInfo instanceof Error && serviceInfo['code'] === 'InvalidParameter') {
|
|
37
|
-
throw new toolbox_1.CloudBaseError(
|
|
36
|
+
throw new toolbox_1.CloudBaseError(`服务不存在,请检查服务名是否正确或到控制台 ${(0, utils_1.genClickableLink)('https://console.cloud.tencent.com/tcbr')} 创建服务`);
|
|
38
37
|
}
|
|
39
38
|
const { ServerConfig: previousServerConfig } = serviceInfo.data;
|
|
40
39
|
const newServiceOptions = {
|
package/lib/run/service/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./list"), exports);
|
|
18
|
-
__exportStar(require("./create"), exports);
|
|
19
18
|
__exportStar(require("./showLogs"), exports);
|
|
20
19
|
__exportStar(require("./deployPackage"), exports);
|
|
21
20
|
__exportStar(require("./common"), exports);
|
|
@@ -39,7 +39,7 @@ function updateTcbrService(options) {
|
|
|
39
39
|
serviceName: options.serviceName
|
|
40
40
|
});
|
|
41
41
|
if (serviceDetail === undefined) {
|
|
42
|
-
throw new toolbox_1.CloudBaseError(
|
|
42
|
+
throw new toolbox_1.CloudBaseError(`当前服务不存在,请前往控制台 ${(0, utils_1.genClickableLink)('https://console.cloud.tencent.com/tcbr')} 创建服务`);
|
|
43
43
|
}
|
|
44
44
|
const status = yield (0, showLogs_1.getBuildStatus)(options.envId, options.serviceName);
|
|
45
45
|
if (status === 'pending') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.1-alpha.0",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@cloudbase/cloud-api": "^0.5.5",
|
|
34
34
|
"@cloudbase/framework-core": "^1.6.1",
|
|
35
|
-
"@cloudbase/lowcode-cli": "
|
|
35
|
+
"@cloudbase/lowcode-cli": "0.15.2-alpha.0",
|
|
36
36
|
"@cloudbase/manager-node": "4.0.1",
|
|
37
37
|
"@cloudbase/toolbox": "^0.7.3",
|
|
38
38
|
"@sentry/node": "^5.10.2",
|
package/types/env/index.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
export * from './domain';
|
|
2
2
|
export * from './login';
|
|
3
3
|
export declare function initTcb(skey: string): Promise<any>;
|
|
4
|
-
export declare function createEnv({ alias, paymentMode }: {
|
|
5
|
-
alias: any;
|
|
6
|
-
paymentMode: any;
|
|
7
|
-
}): Promise<{
|
|
8
|
-
envId: string;
|
|
9
|
-
}>;
|
|
10
4
|
export declare function getEnvInfo(envId: string): Promise<any>;
|
|
11
5
|
export declare function listEnvs(options?: {
|
|
12
6
|
source?: string[];
|
package/types/run/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ITcbrServiceOptions, IDescribeWxCloudBaseRunReleaseOrder, IAuthorizedTcrInstance } from '../../types';
|
|
2
|
+
export declare const describeCloudRunServerDetail: (options: {
|
|
3
|
+
envId: string;
|
|
4
|
+
serviceName: string;
|
|
5
|
+
}) => Promise<any>;
|
|
2
6
|
export declare function describeWxCloudBaseRunReleaseOrder(options: IDescribeWxCloudBaseRunReleaseOrder): Promise<any>;
|
|
3
7
|
export declare const convertNumber: (item: any) => number;
|
|
4
8
|
export declare const extractPolicyDetails: (policyDetails: string) => {
|
|
@@ -27,7 +31,10 @@ export declare function tcbrServiceOptions(options: ITcbrServiceOptions, isCreat
|
|
|
27
31
|
Port: number;
|
|
28
32
|
HasDockerfile: boolean;
|
|
29
33
|
Dockerfile: string;
|
|
30
|
-
LogType:
|
|
34
|
+
LogType: any;
|
|
35
|
+
LogSetId: any;
|
|
36
|
+
LogTopicId: any;
|
|
37
|
+
LogParseType: any;
|
|
31
38
|
};
|
|
32
39
|
DeployInfo: any;
|
|
33
40
|
}>;
|