@cloudbase/cli 2.0.0 → 2.0.3-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/.editorconfig +9 -9
- package/.eslintignore +7 -7
- package/.eslintrc +35 -35
- package/.prettierrc.js +29 -29
- package/.vscode/launch.json +16 -16
- package/LICENSE +5 -5
- package/README.md +35 -35
- package/bin/cloudbase.js +5 -5
- package/bin/tcb.js +6 -4
- package/changelog.md +6 -6
- package/jest.config.js +17 -17
- package/lib/commands/account/login.js +18 -18
- package/lib/commands/storage/storage.js +1 -1
- package/lib/env/login.js +7 -7
- package/lib/run/service/deployPackage.js +6 -4
- package/lib/utils/net/http-request.js +4 -4
- package/lib/utils/tcbrApi/tcbr-cloud-api/request.js +3 -3
- package/package.json +17 -17
- package/post-install.js +61 -61
- package/runtime/nodejs/bootstrap.js +255 -255
- package/runtime/nodejs/runtime.js +183 -183
- package/src/auth/index.ts +1 -1
- package/src/auth/login.ts +91 -91
- package/src/auth/logout.ts +7 -7
- package/src/commands/account/index.ts +2 -2
- package/src/commands/account/login.ts +192 -192
- package/src/commands/account/logout.ts +24 -24
- package/src/commands/common.ts +246 -246
- package/src/commands/env/base.ts +90 -90
- package/src/commands/env/create.ts +92 -92
- package/src/commands/env/domain.ts +186 -186
- package/src/commands/env/index.ts +4 -4
- package/src/commands/env/login.ts +235 -235
- package/src/commands/framework/index.ts +124 -124
- package/src/commands/functions/alias/getRoute.ts +76 -76
- package/src/commands/functions/alias/index.ts +2 -2
- package/src/commands/functions/alias/setRoute.ts +82 -82
- package/src/commands/functions/code-download.ts +100 -100
- package/src/commands/functions/code-update.ts +62 -62
- package/src/commands/functions/concurrency/delete.ts +45 -45
- package/src/commands/functions/concurrency/index.ts +2 -2
- package/src/commands/functions/concurrency/list.ts +58 -58
- package/src/commands/functions/concurrency/set.ts +47 -47
- package/src/commands/functions/config-update.ts +76 -76
- package/src/commands/functions/copy.ts +62 -62
- package/src/commands/functions/delete.ts +79 -79
- package/src/commands/functions/deploy.ts +293 -293
- package/src/commands/functions/detail.ts +138 -138
- package/src/commands/functions/index.ts +16 -16
- package/src/commands/functions/invoke.ts +121 -121
- package/src/commands/functions/layer/bind.ts +182 -182
- package/src/commands/functions/layer/common.ts +8 -8
- package/src/commands/functions/layer/create.ts +49 -49
- package/src/commands/functions/layer/delete.ts +73 -73
- package/src/commands/functions/layer/download.ts +92 -92
- package/src/commands/functions/layer/index.ts +7 -7
- package/src/commands/functions/layer/list.ts +94 -94
- package/src/commands/functions/layer/sort.ts +76 -76
- package/src/commands/functions/list.ts +68 -68
- package/src/commands/functions/log.ts +148 -148
- package/src/commands/functions/run.ts +249 -249
- package/src/commands/functions/trigger-create.ts +79 -79
- package/src/commands/functions/trigger-delete.ts +105 -105
- package/src/commands/functions/version/index.ts +1 -1
- package/src/commands/functions/version/list.ts +73 -73
- package/src/commands/functions/version/publish.ts +43 -43
- package/src/commands/gateway/create.ts +109 -109
- package/src/commands/gateway/delete.ts +81 -81
- package/src/commands/gateway/domain.ts +159 -159
- package/src/commands/gateway/index.ts +5 -5
- package/src/commands/gateway/list.ts +76 -76
- package/src/commands/gateway/switch.ts +107 -107
- package/src/commands/helpers/index.ts +2 -2
- package/src/commands/helpers/init.ts +431 -431
- package/src/commands/helpers/new.ts +117 -117
- package/src/commands/helpers/open.ts +67 -67
- package/src/commands/hosting/hosting.ts +360 -360
- package/src/commands/index.ts +13 -13
- package/src/commands/lowcode/app.ts +34 -34
- package/src/commands/lowcode/comps.ts +322 -322
- package/src/commands/lowcode/index.ts +1 -1
- package/src/commands/lowcode/utils.ts +24 -24
- package/src/commands/run/image/index.ts +4 -4
- package/src/commands/run/standalonegateway/common.ts +7 -7
- package/src/commands/run/standalonegateway/create.ts +85 -85
- package/src/commands/run/standalonegateway/destroy.ts +59 -59
- package/src/commands/run/standalonegateway/index.ts +4 -4
- package/src/commands/run/standalonegateway/list.ts +53 -53
- package/src/commands/run/standalonegateway/package.ts +62 -62
- package/src/commands/run/standalonegateway/turn.ts +63 -63
- package/src/commands/run/version/index.ts +4 -4
- package/src/commands/smart.ts +132 -132
- package/src/commands/storage/storage.ts +464 -464
- package/src/commands/third/thirdAttach.ts +49 -49
- package/src/completion/index.ts +13 -13
- package/src/decorators/captureError.ts +25 -25
- package/src/decorators/constants.ts +12 -12
- package/src/decorators/deprecate.ts +25 -25
- package/src/decorators/guard.ts +42 -42
- package/src/decorators/index.ts +7 -7
- package/src/decorators/injectParams.ts +54 -54
- package/src/decorators/params/common.ts +28 -28
- package/src/decorators/params/index.ts +35 -35
- package/src/env/domain.ts +33 -33
- package/src/env/index.ts +63 -63
- package/src/env/login.ts +80 -80
- package/src/error.ts +36 -36
- package/src/function/alias.ts +43 -43
- package/src/function/base.ts +253 -253
- package/src/function/code.ts +55 -55
- package/src/function/concurrency.ts +57 -57
- package/src/function/create.ts +78 -78
- package/src/function/delete.ts +42 -42
- package/src/function/index.ts +10 -10
- package/src/function/layer/attach.ts +68 -68
- package/src/function/layer/create.ts +63 -63
- package/src/function/layer/delete.ts +21 -21
- package/src/function/layer/download.ts +54 -54
- package/src/function/layer/index.ts +7 -7
- package/src/function/layer/list.ts +32 -32
- package/src/function/layer/sort.ts +24 -24
- package/src/function/trigger.ts +97 -97
- package/src/function/update.ts +35 -35
- package/src/function/version.ts +38 -38
- package/src/function/vpc.ts +22 -22
- package/src/gateway/index.ts +137 -137
- package/src/hosting.ts +212 -212
- package/src/index.ts +13 -13
- package/src/logger.ts +17 -17
- package/src/run/create.ts +23 -23
- package/src/run/delete.ts +15 -15
- package/src/run/image/build.ts +36 -36
- package/src/run/image/delete.ts +13 -13
- package/src/run/image/index.ts +3 -3
- package/src/run/image/info.ts +26 -26
- package/src/run/list.ts +29 -29
- package/src/run/repo.ts +24 -24
- package/src/run/service/deployPackage.ts +6 -4
- package/src/run/standalonegateway/create.ts +24 -24
- package/src/run/standalonegateway/destroy.ts +19 -19
- package/src/run/standalonegateway/index.ts +4 -4
- package/src/run/standalonegateway/list.ts +74 -74
- package/src/run/standalonegateway/package/list.ts +24 -24
- package/src/run/standalonegateway/turn/index.ts +1 -1
- package/src/run/standalonegateway/turn/off.ts +19 -19
- package/src/run/standalonegateway/turn/on.ts +19 -19
- package/src/run/version/create.ts +68 -68
- package/src/run/version/delete.ts +15 -15
- package/src/run/version/index.ts +5 -5
- package/src/run/version/list.ts +16 -16
- package/src/run/version/modify.ts +16 -16
- package/src/run/version/repo.ts +27 -27
- package/src/run/version/update.ts +58 -58
- package/src/storage.ts +114 -114
- package/src/third/index.ts +12 -12
- package/src/utils/auth.ts +15 -15
- package/src/utils/cli-table.ts +23 -23
- package/src/utils/config.ts +39 -39
- package/src/utils/env.ts +244 -244
- package/src/utils/fs/del.ts +5 -5
- package/src/utils/fs/index.ts +71 -71
- package/src/utils/function-packer.ts +97 -97
- package/src/utils/log.ts +81 -81
- package/src/utils/net/cloud-api-request.ts +62 -62
- package/src/utils/net/credential.ts +53 -53
- package/src/utils/net/http-request.ts +84 -84
- package/src/utils/net/index.ts +4 -4
- package/src/utils/net/manager-service.ts +36 -36
- package/src/utils/net/proxy.ts +6 -6
- package/src/utils/notice.ts +28 -28
- package/src/utils/output/highlight.ts +5 -5
- package/src/utils/output/index.ts +2 -2
- package/src/utils/output/link.ts +10 -10
- package/src/utils/output/loading.ts +82 -82
- package/src/utils/parallel.ts +82 -82
- package/src/utils/platform/index.ts +2 -2
- package/src/utils/platform/mac.ts +21 -21
- package/src/utils/platform/os.ts +64 -64
- package/src/utils/platform/port.ts +10 -10
- package/src/utils/progress-bar.ts +38 -38
- package/src/utils/prompt/select.ts +59 -59
- package/src/utils/reporter/agree.ts +20 -20
- package/src/utils/reporter/download.ts +26 -26
- package/src/utils/reporter/index.ts +3 -3
- package/src/utils/reporter/usage.ts +20 -20
- package/src/utils/store/auth.ts +49 -49
- package/src/utils/store/common.ts +8 -8
- package/src/utils/store/db.ts +68 -68
- package/src/utils/store/index.ts +4 -4
- package/src/utils/store/usage.ts +12 -12
- package/src/utils/tcbrApi/tcbr-cloud-api/request.ts +13 -13
- package/src/utils/template.ts +170 -170
- package/src/utils/tools/encoding.ts +8 -8
- package/src/utils/tools/index.ts +4 -4
- package/src/utils/tools/object.ts +33 -33
- package/src/utils/tools/time.ts +38 -38
- package/src/utils/tools/uid.ts +19 -19
- 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
- package/.vscode/settings.json +0 -3
package/.editorconfig
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[!{node_modules}/**]
|
|
4
|
-
end_of_line = lf
|
|
5
|
-
charset = utf-8
|
|
6
|
-
|
|
7
|
-
[{*.js,*.ts,*.html,*.json,*.gql,*.graqhql}]
|
|
8
|
-
indent_style = space
|
|
9
|
-
indent_size = 4
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[!{node_modules}/**]
|
|
4
|
+
end_of_line = lf
|
|
5
|
+
charset = utf-8
|
|
6
|
+
|
|
7
|
+
[{*.js,*.ts,*.html,*.json,*.gql,*.graqhql}]
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 4
|
|
10
10
|
|
package/.eslintignore
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
server_node_modules/
|
|
2
|
-
deps/
|
|
3
|
-
addons/
|
|
4
|
-
lib/
|
|
5
|
-
types/
|
|
6
|
-
node_modules
|
|
7
|
-
bin/
|
|
1
|
+
server_node_modules/
|
|
2
|
+
deps/
|
|
3
|
+
addons/
|
|
4
|
+
lib/
|
|
5
|
+
types/
|
|
6
|
+
node_modules
|
|
7
|
+
bin/
|
|
8
8
|
functions/
|
package/.eslintrc
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["alloy", "alloy/typescript"],
|
|
3
|
-
"rules": {
|
|
4
|
-
"no-console": "off",
|
|
5
|
-
"no-unused-vars": "off",
|
|
6
|
-
"no-implicit-coercion": [2, { "number": false }],
|
|
7
|
-
"quotes": [
|
|
8
|
-
"error",
|
|
9
|
-
"single",
|
|
10
|
-
{
|
|
11
|
-
"avoidEscape": true
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"semi": ["error", "never"],
|
|
15
|
-
"max-params": "off",
|
|
16
|
-
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
17
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
18
|
-
"@typescript-eslint/interface-name-prefix": "off",
|
|
19
|
-
"@typescript-eslint/no-explicit-any": "off"
|
|
20
|
-
},
|
|
21
|
-
"env": {
|
|
22
|
-
"es6": true,
|
|
23
|
-
"node": true,
|
|
24
|
-
"jest": true
|
|
25
|
-
},
|
|
26
|
-
"parser": "@typescript-eslint/parser",
|
|
27
|
-
"overrides": [
|
|
28
|
-
{
|
|
29
|
-
"files": ["*.js"],
|
|
30
|
-
"rules": {
|
|
31
|
-
"@typescript-eslint/no-var-requires": "off"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": ["alloy", "alloy/typescript"],
|
|
3
|
+
"rules": {
|
|
4
|
+
"no-console": "off",
|
|
5
|
+
"no-unused-vars": "off",
|
|
6
|
+
"no-implicit-coercion": [2, { "number": false }],
|
|
7
|
+
"quotes": [
|
|
8
|
+
"error",
|
|
9
|
+
"single",
|
|
10
|
+
{
|
|
11
|
+
"avoidEscape": true
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"semi": ["error", "never"],
|
|
15
|
+
"max-params": "off",
|
|
16
|
+
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
17
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
18
|
+
"@typescript-eslint/interface-name-prefix": "off",
|
|
19
|
+
"@typescript-eslint/no-explicit-any": "off"
|
|
20
|
+
},
|
|
21
|
+
"env": {
|
|
22
|
+
"es6": true,
|
|
23
|
+
"node": true,
|
|
24
|
+
"jest": true
|
|
25
|
+
},
|
|
26
|
+
"parser": "@typescript-eslint/parser",
|
|
27
|
+
"overrides": [
|
|
28
|
+
{
|
|
29
|
+
"files": ["*.js"],
|
|
30
|
+
"rules": {
|
|
31
|
+
"@typescript-eslint/no-var-requires": "off"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
package/.prettierrc.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
// 一行最多 100 字符
|
|
3
|
-
printWidth: 100,
|
|
4
|
-
// 使用 4 个空格缩进
|
|
5
|
-
tabWidth: 4,
|
|
6
|
-
// 不使用缩进符,而使用空格
|
|
7
|
-
useTabs: false,
|
|
8
|
-
// 行尾无分号
|
|
9
|
-
semi: false,
|
|
10
|
-
// 使用单引号
|
|
11
|
-
singleQuote: true,
|
|
12
|
-
// 对象的 key 仅在必要时用引号
|
|
13
|
-
quoteProps: 'as-needed',
|
|
14
|
-
// 末尾不需要逗号
|
|
15
|
-
trailingComma: 'none',
|
|
16
|
-
// 大括号内的首尾需要空格
|
|
17
|
-
bracketSpacing: true,
|
|
18
|
-
// 每个文件格式化的范围是文件的全部内容
|
|
19
|
-
rangeStart: 0,
|
|
20
|
-
rangeEnd: Infinity,
|
|
21
|
-
// 不需要写文件开头的 @prettier
|
|
22
|
-
requirePragma: false,
|
|
23
|
-
// 不需要自动在文件开头插入 @prettier
|
|
24
|
-
insertPragma: false,
|
|
25
|
-
// 使用默认的折行标准
|
|
26
|
-
proseWrap: 'preserve',
|
|
27
|
-
// 换行符使用 lf
|
|
28
|
-
endOfLine: 'lf'
|
|
29
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
// 一行最多 100 字符
|
|
3
|
+
printWidth: 100,
|
|
4
|
+
// 使用 4 个空格缩进
|
|
5
|
+
tabWidth: 4,
|
|
6
|
+
// 不使用缩进符,而使用空格
|
|
7
|
+
useTabs: false,
|
|
8
|
+
// 行尾无分号
|
|
9
|
+
semi: false,
|
|
10
|
+
// 使用单引号
|
|
11
|
+
singleQuote: true,
|
|
12
|
+
// 对象的 key 仅在必要时用引号
|
|
13
|
+
quoteProps: 'as-needed',
|
|
14
|
+
// 末尾不需要逗号
|
|
15
|
+
trailingComma: 'none',
|
|
16
|
+
// 大括号内的首尾需要空格
|
|
17
|
+
bracketSpacing: true,
|
|
18
|
+
// 每个文件格式化的范围是文件的全部内容
|
|
19
|
+
rangeStart: 0,
|
|
20
|
+
rangeEnd: Infinity,
|
|
21
|
+
// 不需要写文件开头的 @prettier
|
|
22
|
+
requirePragma: false,
|
|
23
|
+
// 不需要自动在文件开头插入 @prettier
|
|
24
|
+
insertPragma: false,
|
|
25
|
+
// 使用默认的折行标准
|
|
26
|
+
proseWrap: 'preserve',
|
|
27
|
+
// 换行符使用 lf
|
|
28
|
+
endOfLine: 'lf'
|
|
29
|
+
}
|
package/.vscode/launch.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
// 使用 IntelliSense 了解相关属性。
|
|
3
|
-
// 悬停以查看现有属性的描述。
|
|
4
|
-
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"configurations": [
|
|
7
|
-
{
|
|
8
|
-
"type": "node",
|
|
9
|
-
"request": "launch",
|
|
10
|
-
"name": "Debug: cloudbase logout",
|
|
11
|
-
"program": "${workspaceFolder}/bin/cloudbase.js",
|
|
12
|
-
"args": ["open"],
|
|
13
|
-
"outFiles": ["${workspaceFolder}/lib/**/*.js"]
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
// 使用 IntelliSense 了解相关属性。
|
|
3
|
+
// 悬停以查看现有属性的描述。
|
|
4
|
+
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"type": "node",
|
|
9
|
+
"request": "launch",
|
|
10
|
+
"name": "Debug: cloudbase logout",
|
|
11
|
+
"program": "${workspaceFolder}/bin/cloudbase.js",
|
|
12
|
+
"args": ["open"],
|
|
13
|
+
"outFiles": ["${workspaceFolder}/lib/**/*.js"]
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
ISC License (ISC)
|
|
2
|
-
Copyright <2019> <Tencent Cloud Base>
|
|
3
|
-
|
|
4
|
-
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
5
|
-
|
|
1
|
+
ISC License (ISC)
|
|
2
|
+
Copyright <2019> <Tencent Cloud Base>
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
5
|
+
|
|
6
6
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
# CloudBase 命令行工具 
|
|
2
|
-
|
|
3
|
-
CloudBase CLI 是一个开源的命令行界面交互工具,用于帮助用户快速、方便的部署项目,管理云开发资源。
|
|
4
|
-
|
|
5
|
-
## 安装 CloudBase CLI
|
|
6
|
-
|
|
7
|
-
### npm
|
|
8
|
-
|
|
9
|
-
```shell
|
|
10
|
-
npm install -g @cloudbase/cli
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
### yarn
|
|
14
|
-
|
|
15
|
-
```shell
|
|
16
|
-
yarn global add @cloudbase/cli
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
安装完成后,你可以使用 `cloudbase -v` 验证是否安装成功,如果输出了类似下面的版本号,则表明 CloudBase CLI 被成功安装到您的计算机中。
|
|
20
|
-
|
|
21
|
-
```text
|
|
22
|
-
0.6.0
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## CloudBase CLI 运行要求
|
|
26
|
-
|
|
27
|
-
**Node.js 8.6.0+**
|
|
28
|
-
|
|
29
|
-
## 文档
|
|
30
|
-
|
|
31
|
-
请访问[教程与文档](https://docs.cloudbase.net/cli/intro.html)了解详细的使用方法。
|
|
32
|
-
|
|
33
|
-
## 意见反馈
|
|
34
|
-
|
|
35
|
-
您可以到 GitHub Repo 新建一个 [issue](https://github.com/TencentCloudBase/cloudbase-cli/issues) 反馈您在使用过程中遇到的问题或建议。
|
|
1
|
+
# CloudBase 命令行工具 
|
|
2
|
+
|
|
3
|
+
CloudBase CLI 是一个开源的命令行界面交互工具,用于帮助用户快速、方便的部署项目,管理云开发资源。
|
|
4
|
+
|
|
5
|
+
## 安装 CloudBase CLI
|
|
6
|
+
|
|
7
|
+
### npm
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
npm install -g @cloudbase/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### yarn
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
yarn global add @cloudbase/cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
安装完成后,你可以使用 `cloudbase -v` 验证是否安装成功,如果输出了类似下面的版本号,则表明 CloudBase CLI 被成功安装到您的计算机中。
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
0.6.0
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## CloudBase CLI 运行要求
|
|
26
|
+
|
|
27
|
+
**Node.js 8.6.0+**
|
|
28
|
+
|
|
29
|
+
## 文档
|
|
30
|
+
|
|
31
|
+
请访问[教程与文档](https://docs.cloudbase.net/cli/intro.html)了解详细的使用方法。
|
|
32
|
+
|
|
33
|
+
## 意见反馈
|
|
34
|
+
|
|
35
|
+
您可以到 GitHub Repo 新建一个 [issue](https://github.com/TencentCloudBase/cloudbase-cli/issues) 反馈您在使用过程中遇到的问题或建议。
|
package/bin/cloudbase.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const chalk = require('chalk')
|
|
3
|
-
|
|
4
|
-
console.log(chalk.bold.yellowBright('\n', `Tip: cloudbase 命令可以简写为 tcb`), '\n')
|
|
5
|
-
|
|
6
|
-
require('./tcb')
|
|
2
|
+
const chalk = require('chalk')
|
|
3
|
+
|
|
4
|
+
console.log(chalk.bold.yellowBright('\n', `Tip: cloudbase 命令可以简写为 tcb`), '\n')
|
|
5
|
+
|
|
6
|
+
require('./tcb')
|
package/bin/tcb.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const os = require('os')
|
|
3
|
-
const
|
|
3
|
+
const yargsParser = require('yargs-parser')
|
|
4
4
|
const chalk = require('chalk')
|
|
5
5
|
const address = require('address')
|
|
6
6
|
const { program } = require('commander')
|
|
@@ -72,8 +72,10 @@ program.option('-r, --region <region>', '指定环境地域')
|
|
|
72
72
|
|
|
73
73
|
// HACK: 隐藏自动生成的 help 信息
|
|
74
74
|
program.helpOption(false)
|
|
75
|
+
const isCommandEmpty = yargsParser(process.argv.slice(2))._.length === 0;
|
|
76
|
+
|
|
75
77
|
// -v 时输出的版本信息,设置时避免影响其他命令使用 -v
|
|
76
|
-
if (
|
|
78
|
+
if (isCommandEmpty) {
|
|
77
79
|
program.version(
|
|
78
80
|
`\nCLI: ${pkg.version}\nFramework: ${frameworkPkg.version}`,
|
|
79
81
|
'-v, --version',
|
|
@@ -99,7 +101,7 @@ program.action((command) => {
|
|
|
99
101
|
})
|
|
100
102
|
|
|
101
103
|
// 没有使用命令
|
|
102
|
-
if (
|
|
104
|
+
if (isCommandEmpty) {
|
|
103
105
|
if (['-h', '--help'].includes(processArgv[2])) {
|
|
104
106
|
// 需要隐藏的选项
|
|
105
107
|
const hideArgs = ['-h', '--help']
|
|
@@ -111,7 +113,7 @@ if (yargs.argv._.length === 0) {
|
|
|
111
113
|
})
|
|
112
114
|
const { outputHelpInfo } = require('../lib/help')
|
|
113
115
|
outputHelpInfo()
|
|
114
|
-
} else if (!['-v', '--
|
|
116
|
+
} else if (!['-v', '--version'].includes(processArgv[2])) {
|
|
115
117
|
// HACK: framework 智能命令
|
|
116
118
|
const { smartDeploy } = require('../lib')
|
|
117
119
|
smartDeploy()
|
package/changelog.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# V1.0
|
|
2
|
-
|
|
3
|
-
## 不兼容变更
|
|
4
|
-
|
|
5
|
-
- 废弃编程式调用
|
|
6
|
-
-
|
|
1
|
+
# V1.0
|
|
2
|
+
|
|
3
|
+
## 不兼容变更
|
|
4
|
+
|
|
5
|
+
- 废弃编程式调用
|
|
6
|
+
-
|
package/jest.config.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
roots: ['<rootDir>/test'],
|
|
3
|
-
globals: {
|
|
4
|
-
'ts-jest': {
|
|
5
|
-
tsConfig: 'tsconfig.test.json'
|
|
6
|
-
}
|
|
7
|
-
},
|
|
8
|
-
transform: {
|
|
9
|
-
'^.+\\.ts?$': 'ts-jest'
|
|
10
|
-
},
|
|
11
|
-
transformIgnorePatterns: ['node_modules'],
|
|
12
|
-
testEnvironment: 'node',
|
|
13
|
-
// https://github.com/facebook/jest/issues/5164
|
|
14
|
-
globalSetup: './test/global-setup-hook.js',
|
|
15
|
-
// globalTeardown: './test/global-teardown-hook.js',
|
|
16
|
-
coverageReporters: ['json', 'lcov', 'clover', 'text-summary']
|
|
17
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
roots: ['<rootDir>/test'],
|
|
3
|
+
globals: {
|
|
4
|
+
'ts-jest': {
|
|
5
|
+
tsConfig: 'tsconfig.test.json'
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
transform: {
|
|
9
|
+
'^.+\\.ts?$': 'ts-jest'
|
|
10
|
+
},
|
|
11
|
+
transformIgnorePatterns: ['node_modules'],
|
|
12
|
+
testEnvironment: 'node',
|
|
13
|
+
// https://github.com/facebook/jest/issues/5164
|
|
14
|
+
globalSetup: './test/global-setup-hook.js',
|
|
15
|
+
// globalTeardown: './test/global-teardown-hook.js',
|
|
16
|
+
coverageReporters: ['json', 'lcov', 'clover', 'text-summary']
|
|
17
|
+
}
|
|
@@ -35,24 +35,24 @@ const error_1 = require("../../error");
|
|
|
35
35
|
const decorators_1 = require("../../decorators");
|
|
36
36
|
const utils_1 = require("../../utils");
|
|
37
37
|
function printSuggestion() {
|
|
38
|
-
const tips = `可使用下面命令继续操作:
|
|
39
|
-
|
|
40
|
-
${chalk_1.default.gray('–')} 创建免费环境
|
|
41
|
-
|
|
42
|
-
${chalk_1.default.cyan('$ tcb env create envName')}
|
|
43
|
-
|
|
44
|
-
${chalk_1.default.gray('–')} 初始化云开发项目
|
|
45
|
-
|
|
46
|
-
${chalk_1.default.cyan('$ tcb new')}
|
|
47
|
-
|
|
48
|
-
${chalk_1.default.gray('–')} 部署云函数
|
|
49
|
-
|
|
50
|
-
${chalk_1.default.cyan('$ tcb fn deploy')}
|
|
51
|
-
|
|
52
|
-
${chalk_1.default.gray('–')} 查看命令使用介绍
|
|
53
|
-
|
|
54
|
-
${chalk_1.default.cyan('$ tcb -h')}
|
|
55
|
-
|
|
38
|
+
const tips = `可使用下面命令继续操作:
|
|
39
|
+
|
|
40
|
+
${chalk_1.default.gray('–')} 创建免费环境
|
|
41
|
+
|
|
42
|
+
${chalk_1.default.cyan('$ tcb env create envName')}
|
|
43
|
+
|
|
44
|
+
${chalk_1.default.gray('–')} 初始化云开发项目
|
|
45
|
+
|
|
46
|
+
${chalk_1.default.cyan('$ tcb new')}
|
|
47
|
+
|
|
48
|
+
${chalk_1.default.gray('–')} 部署云函数
|
|
49
|
+
|
|
50
|
+
${chalk_1.default.cyan('$ tcb fn deploy')}
|
|
51
|
+
|
|
52
|
+
${chalk_1.default.gray('–')} 查看命令使用介绍
|
|
53
|
+
|
|
54
|
+
${chalk_1.default.cyan('$ tcb -h')}
|
|
55
|
+
|
|
56
56
|
Tips:可以使用简写命令 tcb 代替 cloudbase`;
|
|
57
57
|
console.log(tips);
|
|
58
58
|
}
|
|
@@ -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);
|
|
@@ -36,11 +36,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.packageDeploy = void 0;
|
|
39
|
-
const __1 = require("..");
|
|
40
|
-
const toolbox_1 = require("@cloudbase/toolbox");
|
|
41
|
-
const axios_1 = __importDefault(require("axios"));
|
|
42
39
|
const path_1 = __importDefault(require("path"));
|
|
43
40
|
const fs = __importStar(require("fs"));
|
|
41
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
42
|
+
const __1 = require("..");
|
|
43
|
+
const toolbox_1 = require("@cloudbase/toolbox");
|
|
44
44
|
function packageDeploy(options) {
|
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
46
|
let { envId, serviceName, filePath, fileToIgnore } = options;
|
|
@@ -68,7 +68,9 @@ function packageDeploy(options) {
|
|
|
68
68
|
}
|
|
69
69
|
try {
|
|
70
70
|
return yield (0, toolbox_1.execWithLoading)(() => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
yield
|
|
71
|
+
yield (0, node_fetch_1.default)(UploadUrl, {
|
|
72
|
+
method: 'PUT',
|
|
73
|
+
body: fs.createReadStream(zipFile),
|
|
72
74
|
headers: {
|
|
73
75
|
'content-type': 'application/zip'
|
|
74
76
|
}
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.fetchStream = exports.postFetch = exports.fetch = void 0;
|
|
16
16
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
17
|
-
const https_proxy_agent_1 =
|
|
17
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
18
18
|
const constant_1 = require("../../constant");
|
|
19
19
|
const error_1 = require("../../error");
|
|
20
20
|
const proxy_1 = require("./proxy");
|
|
@@ -30,7 +30,7 @@ function fetch(url, config = {}) {
|
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
const proxy = (0, proxy_1.getProxy)();
|
|
32
32
|
if (proxy) {
|
|
33
|
-
config.agent = new https_proxy_agent_1.
|
|
33
|
+
config.agent = new https_proxy_agent_1.HttpsProxyAgent(proxy);
|
|
34
34
|
}
|
|
35
35
|
config.timeout = constant_1.REQUEST_TIMEOUT;
|
|
36
36
|
let json;
|
|
@@ -59,7 +59,7 @@ function postFetch(url, data) {
|
|
|
59
59
|
body: JSON.stringify(data)
|
|
60
60
|
};
|
|
61
61
|
if (proxy) {
|
|
62
|
-
config.agent = new https_proxy_agent_1.
|
|
62
|
+
config.agent = new https_proxy_agent_1.HttpsProxyAgent(proxy);
|
|
63
63
|
}
|
|
64
64
|
config.timeout = constant_1.REQUEST_TIMEOUT;
|
|
65
65
|
let json;
|
|
@@ -81,7 +81,7 @@ function fetchStream(url, config = {}) {
|
|
|
81
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
82
|
const proxy = (0, proxy_1.getProxy)();
|
|
83
83
|
if (proxy) {
|
|
84
|
-
config.agent = new https_proxy_agent_1.
|
|
84
|
+
config.agent = new https_proxy_agent_1.HttpsProxyAgent(proxy);
|
|
85
85
|
}
|
|
86
86
|
config.timeout = constant_1.REQUEST_TIMEOUT;
|
|
87
87
|
try {
|
|
@@ -15,12 +15,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.fetchStream = exports.fetch = exports.nodeFetch = void 0;
|
|
16
16
|
const url_1 = require("url");
|
|
17
17
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
18
|
-
const https_proxy_agent_1 =
|
|
18
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
19
19
|
exports.nodeFetch = node_fetch_1.default;
|
|
20
20
|
function fetch(url, config = {}, proxy = '') {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
if (proxy) {
|
|
23
|
-
config.agent = new https_proxy_agent_1.
|
|
23
|
+
config.agent = new https_proxy_agent_1.HttpsProxyAgent(proxy);
|
|
24
24
|
}
|
|
25
25
|
const escapeUrl = new url_1.URL(url).toString();
|
|
26
26
|
const res = yield (0, node_fetch_1.default)(escapeUrl, config);
|
|
@@ -31,7 +31,7 @@ exports.fetch = fetch;
|
|
|
31
31
|
function fetchStream(url, config = {}, proxy = '') {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
33
|
if (proxy) {
|
|
34
|
-
config.agent = new https_proxy_agent_1.
|
|
34
|
+
config.agent = new https_proxy_agent_1.HttpsProxyAgent(proxy);
|
|
35
35
|
}
|
|
36
36
|
const escapeUrl = new url_1.URL(url).toString();
|
|
37
37
|
return (0, node_fetch_1.default)(escapeUrl, config);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.0.0",
|
|
3
|
+
"version": "2.0.3-alpha.0",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,45 +31,45 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@cloudbase/cloud-api": "^0.4.0",
|
|
33
33
|
"@cloudbase/framework-core": "^1.6.1",
|
|
34
|
-
"@cloudbase/lowcode-cli": "^0.
|
|
35
|
-
"@cloudbase/manager-node": "
|
|
34
|
+
"@cloudbase/lowcode-cli": "^0.13.1-alpha.3",
|
|
35
|
+
"@cloudbase/manager-node": "4.0.0",
|
|
36
36
|
"@cloudbase/toolbox": "^0.7.2",
|
|
37
37
|
"@sentry/node": "^5.10.2",
|
|
38
38
|
"address": "^1.1.2",
|
|
39
|
-
"axios": "^0.21.1",
|
|
40
39
|
"chalk": "^2.4.2",
|
|
41
40
|
"cli-table3": "^0.5.1",
|
|
42
41
|
"commander": "7",
|
|
43
42
|
"del": "^5.1.0",
|
|
44
|
-
"didyoumean": "^1.2.
|
|
43
|
+
"didyoumean": "^1.2.2",
|
|
45
44
|
"enquirer": "^2.3.6",
|
|
46
45
|
"execa": "^4.0.3",
|
|
47
46
|
"fs-extra": "^8.1.0",
|
|
48
|
-
"https-proxy-agent": "^
|
|
47
|
+
"https-proxy-agent": "^5.0.1",
|
|
49
48
|
"inquirer": "^6.5.0",
|
|
50
|
-
"lodash": "^4.17.
|
|
49
|
+
"lodash": "^4.17.21",
|
|
51
50
|
"log-symbols": "^3.0.0",
|
|
52
51
|
"lowdb": "^1.0.0",
|
|
53
52
|
"make-dir": "^3.0.0",
|
|
54
53
|
"node-fetch": "^2.6.0",
|
|
55
54
|
"open": "^7.0.0",
|
|
56
55
|
"ora": "^4.0.2",
|
|
57
|
-
"portfinder": "^1.0.
|
|
56
|
+
"portfinder": "^1.0.28",
|
|
58
57
|
"progress": "^2.0.3",
|
|
59
58
|
"query-string": "^6.8.1",
|
|
60
59
|
"reflect-metadata": "^0.1.13",
|
|
61
|
-
"semver": "^7.3.
|
|
60
|
+
"semver": "^7.3.7",
|
|
62
61
|
"tar-fs": "^2.0.1",
|
|
63
62
|
"terminal-link": "^2.1.1",
|
|
64
63
|
"unzipper": "^0.10.10",
|
|
65
64
|
"update-notifier": "^4.0.0",
|
|
66
65
|
"xdg-basedir": "^4.0.0",
|
|
67
|
-
"yargs": "^16.2.0"
|
|
66
|
+
"yargs": "^16.2.0",
|
|
67
|
+
"yargs-parser": "^21.0.1"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@types/jest": "^
|
|
71
|
-
"@types/koa__router": "^8.0.
|
|
72
|
-
"@types/lodash": "^4.14.
|
|
70
|
+
"@types/jest": "^27",
|
|
71
|
+
"@types/koa__router": "^8.0.11",
|
|
72
|
+
"@types/lodash": "^4.14.182",
|
|
73
73
|
"@types/node": "^12.12.38",
|
|
74
74
|
"@types/node-fetch": "^2.5.4",
|
|
75
75
|
"@types/react": "^17.0.37",
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"eslint": "^7.14.0",
|
|
81
81
|
"eslint-config-alloy": "^3.8.2",
|
|
82
82
|
"husky": "^3.0.9",
|
|
83
|
-
"jest": "^
|
|
84
|
-
"rimraf": "^3.0.
|
|
85
|
-
"ts-jest": "^
|
|
86
|
-
"typescript": "^4.
|
|
83
|
+
"jest": "^27",
|
|
84
|
+
"rimraf": "^3.0.2",
|
|
85
|
+
"ts-jest": "^27",
|
|
86
|
+
"typescript": "^4.7.2"
|
|
87
87
|
}
|
|
88
88
|
}
|