@cloudbase/cli 2.2.14 → 2.3.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/.editorconfig +9 -9
- package/.eslintignore +7 -7
- package/.eslintrc +35 -35
- package/.prettierrc.js +29 -29
- package/.vscode/launch.json +26 -26
- package/LICENSE +5 -5
- package/README.md +35 -35
- package/bin/cloudbase.js +6 -6
- package/bin/tcb.js +333 -219
- package/changelog.md +6 -6
- package/jest.config.js +17 -17
- package/lib/commands/account/login.js +14 -14
- package/lib/commands/lowcode/app.js +6 -1
- package/lib/commands/lowcode/comps.js +3 -1
- package/lib/commands/storage/storage.js +1 -1
- package/lib/env/login.js +7 -7
- package/lib/utils/checkTcbrEnv.js +21 -21
- package/package.json +5 -5
- package/post-install.js +61 -61
- package/runtime/nodejs/bootstrap.js +255 -255
- package/runtime/nodejs/runtime.js +183 -183
- package/templates/html/loginFail.html +90 -90
- package/templates/html/loginSuccess.html +86 -86
- package/templates/server/node/_gitignore +54 -54
- package/templates/server/node/cloudbaserc.json +10 -10
- package/templates/server/node/index.js +5 -5
- package/templates/server/node/package.json +9 -9
- package/tsconfig.json +19 -19
- package/tsconfig.test.json +13 -13
|
@@ -81,6 +81,10 @@ let LowCodeWatch = class LowCodeWatch extends common_1.Command {
|
|
|
81
81
|
{
|
|
82
82
|
flags: '--force-install',
|
|
83
83
|
desc: '是否忽略安装依赖包'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
flags: '-p, --path <localProjectPath>',
|
|
87
|
+
desc: '本地开发的本地项目路径'
|
|
84
88
|
}
|
|
85
89
|
],
|
|
86
90
|
desc: '开启微搭低代码的本地构建模式',
|
|
@@ -95,7 +99,8 @@ let LowCodeWatch = class LowCodeWatch extends common_1.Command {
|
|
|
95
99
|
yield res.watchApp({
|
|
96
100
|
watchPort: 8288,
|
|
97
101
|
wxDevtoolPath: options === null || options === void 0 ? void 0 : options.wxDevtoolPath,
|
|
98
|
-
forceInstall: options === null || options === void 0 ? void 0 : options.forceInstall
|
|
102
|
+
forceInstall: options === null || options === void 0 ? void 0 : options.forceInstall,
|
|
103
|
+
projectPath: options === null || options === void 0 ? void 0 : options.path
|
|
99
104
|
});
|
|
100
105
|
}));
|
|
101
106
|
});
|
|
@@ -235,7 +235,9 @@ __decorate([
|
|
|
235
235
|
__metadata("design:returntype", Promise)
|
|
236
236
|
], LowCodeDebugComps.prototype, "execute", null);
|
|
237
237
|
LowCodeDebugComps = __decorate([
|
|
238
|
-
(0, common_1.ICommand)(
|
|
238
|
+
(0, common_1.ICommand)({
|
|
239
|
+
supportPrivate: true
|
|
240
|
+
})
|
|
239
241
|
], LowCodeDebugComps);
|
|
240
242
|
exports.LowCodeDebugComps = LowCodeDebugComps;
|
|
241
243
|
let LowCodePublishComps = class LowCodePublishComps extends common_1.Command {
|
|
@@ -398,7 +398,7 @@ let StorageDetailCommand = class StorageDetailCommand extends common_1.Command {
|
|
|
398
398
|
const storageService = yield getStorageService(envId);
|
|
399
399
|
const fileInfo = yield storageService.getFileInfo(cloudPath);
|
|
400
400
|
const date = (0, utils_1.formatDate)(fileInfo.Date, 'yyyy-MM-dd hh:mm:ss');
|
|
401
|
-
const logInfo = `文件大小:${fileInfo.Size}\n文件类型:${fileInfo.Type}\n修改日期:${date}\nETag:${fileInfo.ETag}
|
|
401
|
+
const logInfo = `文件大小:${fileInfo.Size}\n文件类型:${fileInfo.Type}\n修改日期:${date}\nETag:${fileInfo.ETag}
|
|
402
402
|
`;
|
|
403
403
|
console.log(logInfo);
|
|
404
404
|
});
|
package/lib/env/login.js
CHANGED
|
@@ -16,13 +16,13 @@ exports.updateLoginConfig = exports.createLoginConfig = exports.getLoginConfigLi
|
|
|
16
16
|
const crypto_1 = __importDefault(require("crypto"));
|
|
17
17
|
const net_1 = require("../utils/net");
|
|
18
18
|
const error_1 = require("../error");
|
|
19
|
-
const publicRsaKey = `
|
|
20
|
-
-----BEGIN PUBLIC KEY-----
|
|
21
|
-
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0ZLB0ZpWWFsHPnDDw++Nc2wI3
|
|
22
|
-
nl2uyOrIJ5FUfxt4GAmt1Faf5pgMxAnL9exEUrrUDUX8Ri1R0KyfnHQQwCvKt8T8
|
|
23
|
-
bgILIJe9UB8e9dvFqgqH2oA8Vqwi0YqDcvFLFJk2BJbm/0QYtZ563FumW8LEXAgu
|
|
24
|
-
UeHi/0OZN9vQ33jWMQIDAQAB
|
|
25
|
-
-----END PUBLIC KEY-----
|
|
19
|
+
const publicRsaKey = `
|
|
20
|
+
-----BEGIN PUBLIC KEY-----
|
|
21
|
+
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0ZLB0ZpWWFsHPnDDw++Nc2wI3
|
|
22
|
+
nl2uyOrIJ5FUfxt4GAmt1Faf5pgMxAnL9exEUrrUDUX8Ri1R0KyfnHQQwCvKt8T8
|
|
23
|
+
bgILIJe9UB8e9dvFqgqH2oA8Vqwi0YqDcvFLFJk2BJbm/0QYtZ563FumW8LEXAgu
|
|
24
|
+
UeHi/0OZN9vQ33jWMQIDAQAB
|
|
25
|
+
-----END PUBLIC KEY-----
|
|
26
26
|
`;
|
|
27
27
|
function rsaEncrypt(data) {
|
|
28
28
|
const buffer = Buffer.from(data);
|
|
@@ -16,28 +16,28 @@ exports.logEnvCheck = exports.checkTcbrEnv = void 0;
|
|
|
16
16
|
const chalk_1 = __importDefault(require("chalk"));
|
|
17
17
|
const error_1 = require("../error");
|
|
18
18
|
const tcbrApi_1 = require("./tcbrApi");
|
|
19
|
-
const oldCmdSet = `
|
|
20
|
-
服务列表:tcb run:deprecated list --envId <envId>
|
|
21
|
-
创建服务:tcb run:deprecated create --envId <envId> --name <name>
|
|
22
|
-
删除服务:tcb run:deprecated delete --envId <envId> --serviceName <serviceName>
|
|
23
|
-
|
|
24
|
-
版本列表:tcb run:deprecated version list --envId <envId> --serviceName <serviceName>
|
|
25
|
-
创建版本:tcb run:deprecated version create --envId <envId> --serviceName <serviceName>
|
|
26
|
-
分配流量:tcb run:deprecated version modify --envId <envId> --serviceName <serviceName>
|
|
27
|
-
滚动更新:tcb run:deprecated version update --envId <envId> --serviceName <serviceName> --versionName <versionName>
|
|
28
|
-
删除版本:tcb run:deprecated version delete --envId <envId> --serviceName <serviceName> --versionName <versionName>
|
|
29
|
-
|
|
30
|
-
查看镜像:tcb run:deprecated image list --envId <envId> --serviceName <serviceName>
|
|
31
|
-
上传镜像:tcb run:deprecated image upload --envId <envId> --serviceName <serviceName> --imageId <imageId> --imageTag <imageTag>
|
|
32
|
-
下载镜像:tcb run:deprecated image download --envId <envId> --serviceName <serviceName> --imageTag <imageTag>
|
|
33
|
-
删除镜像:tcb run:deprecated image delete --envId <envId> --serviceName <serviceName> --imageTag <imageTag>
|
|
19
|
+
const oldCmdSet = `
|
|
20
|
+
服务列表:tcb run:deprecated list --envId <envId>
|
|
21
|
+
创建服务:tcb run:deprecated create --envId <envId> --name <name>
|
|
22
|
+
删除服务:tcb run:deprecated delete --envId <envId> --serviceName <serviceName>
|
|
23
|
+
|
|
24
|
+
版本列表:tcb run:deprecated version list --envId <envId> --serviceName <serviceName>
|
|
25
|
+
创建版本:tcb run:deprecated version create --envId <envId> --serviceName <serviceName>
|
|
26
|
+
分配流量:tcb run:deprecated version modify --envId <envId> --serviceName <serviceName>
|
|
27
|
+
滚动更新:tcb run:deprecated version update --envId <envId> --serviceName <serviceName> --versionName <versionName>
|
|
28
|
+
删除版本:tcb run:deprecated version delete --envId <envId> --serviceName <serviceName> --versionName <versionName>
|
|
29
|
+
|
|
30
|
+
查看镜像:tcb run:deprecated image list --envId <envId> --serviceName <serviceName>
|
|
31
|
+
上传镜像:tcb run:deprecated image upload --envId <envId> --serviceName <serviceName> --imageId <imageId> --imageTag <imageTag>
|
|
32
|
+
下载镜像:tcb run:deprecated image download --envId <envId> --serviceName <serviceName> --imageTag <imageTag>
|
|
33
|
+
删除镜像:tcb run:deprecated image delete --envId <envId> --serviceName <serviceName> --imageTag <imageTag>
|
|
34
34
|
`;
|
|
35
|
-
const newCmdSet = `
|
|
36
|
-
查看环境下服务:tcb run service:list --envId <envId>
|
|
37
|
-
创建云托管服务:tcb run service:create --envId <envId> --serviceName <serviceName> --containerPort <containerPort>
|
|
38
|
-
更新云托管服务:tcb run service:update --envId <envId> --serviceName <serviceName> --containerPort <containerPort>
|
|
39
|
-
部署云托管服务:tcb run deploy --envId <envId> --serviceName <serviceName> --containerPort <containerPort>
|
|
40
|
-
更新服务基础配置:tcb run service:config --envId <envId> --serviceName <serviceName>
|
|
35
|
+
const newCmdSet = `
|
|
36
|
+
查看环境下服务:tcb run service:list --envId <envId>
|
|
37
|
+
创建云托管服务:tcb run service:create --envId <envId> --serviceName <serviceName> --containerPort <containerPort>
|
|
38
|
+
更新云托管服务:tcb run service:update --envId <envId> --serviceName <serviceName> --containerPort <containerPort>
|
|
39
|
+
部署云托管服务:tcb run deploy --envId <envId> --serviceName <serviceName> --containerPort <containerPort>
|
|
40
|
+
更新服务基础配置:tcb run service:config --envId <envId> --serviceName <serviceName>
|
|
41
41
|
`;
|
|
42
42
|
function checkTcbrEnv(envId, isTcbr) {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "rimraf lib types && tsc",
|
|
7
|
+
"build": "rimraf lib types && tsc --resolveJsonModule",
|
|
8
8
|
"watch": "rimraf lib types && tsc -w",
|
|
9
9
|
"dev": "rimraf lib types && tsc -w",
|
|
10
10
|
"eslint": "eslint \"./**/*.ts\"",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@cloudbase/cloud-api": "^0.5.5",
|
|
34
34
|
"@cloudbase/framework-core": "^1.9.6",
|
|
35
|
-
"@cloudbase/lowcode-cli": "^0.
|
|
35
|
+
"@cloudbase/lowcode-cli": "^0.20.0",
|
|
36
36
|
"@cloudbase/manager-node": "4.2.3",
|
|
37
|
-
"@cloudbase/toolbox": "^0.7.
|
|
37
|
+
"@cloudbase/toolbox": "^0.7.5",
|
|
38
38
|
"@sentry/node": "^5.10.2",
|
|
39
39
|
"address": "^1.1.2",
|
|
40
40
|
"chalk": "^2.4.2",
|
|
@@ -86,4 +86,4 @@
|
|
|
86
86
|
"ts-jest": "^27",
|
|
87
87
|
"typescript": "^4.7.2"
|
|
88
88
|
}
|
|
89
|
-
}
|
|
89
|
+
}
|
package/post-install.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
const chalk = require('chalk')
|
|
3
|
-
const { execSync } = require('child_process')
|
|
4
|
-
|
|
5
|
-
const isWin32 = process.platform === 'win32'
|
|
6
|
-
|
|
7
|
-
const print = (color = null) => (str = '') => {
|
|
8
|
-
const terminalCols = retrieveCols()
|
|
9
|
-
const strLength = str.replace(/\u001B\[[0-9]{2}m/g, '').length
|
|
10
|
-
const leftPaddingLength = Math.floor((terminalCols - strLength) / 2)
|
|
11
|
-
const leftPadding = ' '.repeat(Math.max(leftPaddingLength, 0))
|
|
12
|
-
if (color) {
|
|
13
|
-
str = chalk[color](str)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
console.log(leftPadding, str)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const retrieveCols = (() => {
|
|
20
|
-
let result = false
|
|
21
|
-
|
|
22
|
-
return () => {
|
|
23
|
-
if (result) {
|
|
24
|
-
return result
|
|
25
|
-
}
|
|
26
|
-
const defaultCols = 80
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
const terminalCols = execSync('tput cols', { stdio: ['pipe', 'pipe', 'ignore'] })
|
|
30
|
-
result = parseInt(terminalCols.toString()) || defaultCols
|
|
31
|
-
} catch (e) {
|
|
32
|
-
result = defaultCols
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return result
|
|
36
|
-
}
|
|
37
|
-
})()
|
|
38
|
-
|
|
39
|
-
// 只在 osx 系统上展示 emoji
|
|
40
|
-
const emoji = (emoji) => (process.stdout.isTTY && !isWin32 ? emoji : '')
|
|
41
|
-
|
|
42
|
-
function printFooter() {
|
|
43
|
-
const yellow = print('yellow')
|
|
44
|
-
// const yellow = str => console.log(chalk.yellow(str))
|
|
45
|
-
const emptyLine = print()
|
|
46
|
-
|
|
47
|
-
emptyLine()
|
|
48
|
-
|
|
49
|
-
yellow('了解如何使用 CloudBase CLI')
|
|
50
|
-
yellow('请查看使用文档')
|
|
51
|
-
|
|
52
|
-
print()(
|
|
53
|
-
' '.repeat(15) +
|
|
54
|
-
`${chalk.bold(emoji('👉'))} ${chalk.underline(
|
|
55
|
-
'https://docs.cloudbase.net/cli-v1/quick-start.html'
|
|
56
|
-
)}`
|
|
57
|
-
)
|
|
58
|
-
emptyLine()
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
printFooter()
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
const chalk = require('chalk')
|
|
3
|
+
const { execSync } = require('child_process')
|
|
4
|
+
|
|
5
|
+
const isWin32 = process.platform === 'win32'
|
|
6
|
+
|
|
7
|
+
const print = (color = null) => (str = '') => {
|
|
8
|
+
const terminalCols = retrieveCols()
|
|
9
|
+
const strLength = str.replace(/\u001B\[[0-9]{2}m/g, '').length
|
|
10
|
+
const leftPaddingLength = Math.floor((terminalCols - strLength) / 2)
|
|
11
|
+
const leftPadding = ' '.repeat(Math.max(leftPaddingLength, 0))
|
|
12
|
+
if (color) {
|
|
13
|
+
str = chalk[color](str)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
console.log(leftPadding, str)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const retrieveCols = (() => {
|
|
20
|
+
let result = false
|
|
21
|
+
|
|
22
|
+
return () => {
|
|
23
|
+
if (result) {
|
|
24
|
+
return result
|
|
25
|
+
}
|
|
26
|
+
const defaultCols = 80
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const terminalCols = execSync('tput cols', { stdio: ['pipe', 'pipe', 'ignore'] })
|
|
30
|
+
result = parseInt(terminalCols.toString()) || defaultCols
|
|
31
|
+
} catch (e) {
|
|
32
|
+
result = defaultCols
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return result
|
|
36
|
+
}
|
|
37
|
+
})()
|
|
38
|
+
|
|
39
|
+
// 只在 osx 系统上展示 emoji
|
|
40
|
+
const emoji = (emoji) => (process.stdout.isTTY && !isWin32 ? emoji : '')
|
|
41
|
+
|
|
42
|
+
function printFooter() {
|
|
43
|
+
const yellow = print('yellow')
|
|
44
|
+
// const yellow = str => console.log(chalk.yellow(str))
|
|
45
|
+
const emptyLine = print()
|
|
46
|
+
|
|
47
|
+
emptyLine()
|
|
48
|
+
|
|
49
|
+
yellow('了解如何使用 CloudBase CLI')
|
|
50
|
+
yellow('请查看使用文档')
|
|
51
|
+
|
|
52
|
+
print()(
|
|
53
|
+
' '.repeat(15) +
|
|
54
|
+
`${chalk.bold(emoji('👉'))} ${chalk.underline(
|
|
55
|
+
'https://docs.cloudbase.net/cli-v1/quick-start.html'
|
|
56
|
+
)}`
|
|
57
|
+
)
|
|
58
|
+
emptyLine()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
printFooter()
|