@serverless-devs/s 0.0.45 → 0.1.4-18cdd23b
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/LICENSE +201 -21
- package/OWNERS +33 -0
- package/_config.yml +1 -0
- package/bin/s +1 -1
- package/lib/daemon/lib.js +327 -0
- package/lib/daemon/report.js +50 -0
- package/lib/daemon/update-cli.js +20 -0
- package/lib/daemon/update-component.js +21 -0
- package/lib/daemon/update-templates.js +19 -0
- package/lib/index.js +1732 -0
- package/package.json +73 -61
- package/readme.md +127 -0
- package/.eslintrc +0 -75
- package/README.md +0 -65
- package/bin/s-config +0 -2
- package/bin/s-config-add +0 -2
- package/bin/s-config-delete +0 -2
- package/bin/s-config-get +0 -3
- package/bin/s-config-update +0 -3
- package/bin/s-deploy +0 -2
- package/bin/s-gui +0 -2
- package/bin/s-init +0 -2
- package/bin/s-platform +0 -2
- package/bin/s-platform-delete +0 -2
- package/bin/s-platform-init +0 -2
- package/bin/s-platform-login +0 -2
- package/bin/s-platform-publish +0 -2
- package/bin/s-remove +0 -2
- package/bin/s-search +0 -2
- package/bin/s-set +0 -2
- package/bin/s-set-analysis +0 -2
- package/bin/s-set-language +0 -2
- package/bin/s-set-output-color +0 -2
- package/compile.tsconfig.json +0 -12
- package/configs/base.tsconfig.json +0 -25
- package/lib/command/command-manager.d.ts +0 -12
- package/lib/command/command-manager.d.ts.map +0 -1
- package/lib/command/command-manager.js +0 -144
- package/lib/command/command-manager.js.map +0 -1
- package/lib/command/index.d.ts +0 -2
- package/lib/command/index.d.ts.map +0 -1
- package/lib/command/index.js +0 -41
- package/lib/command/index.js.map +0 -1
- package/lib/component/hook.d.ts +0 -17
- package/lib/component/hook.d.ts.map +0 -1
- package/lib/component/hook.js +0 -201
- package/lib/component/hook.js.map +0 -1
- package/lib/component/index.d.ts +0 -53
- package/lib/component/index.d.ts.map +0 -1
- package/lib/component/index.js +0 -577
- package/lib/component/index.js.map +0 -1
- package/lib/config/add/add-manager.d.ts +0 -23
- package/lib/config/add/add-manager.d.ts.map +0 -1
- package/lib/config/add/add-manager.js +0 -282
- package/lib/config/add/add-manager.js.map +0 -1
- package/lib/config/add/index.d.ts +0 -2
- package/lib/config/add/index.d.ts.map +0 -1
- package/lib/config/add/index.js +0 -77
- package/lib/config/add/index.js.map +0 -1
- package/lib/config/common/common.d.ts +0 -7
- package/lib/config/common/common.d.ts.map +0 -1
- package/lib/config/common/common.js +0 -175
- package/lib/config/common/common.js.map +0 -1
- package/lib/config/delete/delete-manager.d.ts +0 -11
- package/lib/config/delete/delete-manager.d.ts.map +0 -1
- package/lib/config/delete/delete-manager.js +0 -133
- package/lib/config/delete/delete-manager.js.map +0 -1
- package/lib/config/delete/index.d.ts +0 -2
- package/lib/config/delete/index.d.ts.map +0 -1
- package/lib/config/delete/index.js +0 -77
- package/lib/config/delete/index.js.map +0 -1
- package/lib/config/get/get-manager.d.ts +0 -14
- package/lib/config/get/get-manager.d.ts.map +0 -1
- package/lib/config/get/get-manager.js +0 -205
- package/lib/config/get/get-manager.js.map +0 -1
- package/lib/config/get/index.d.ts +0 -2
- package/lib/config/get/index.d.ts.map +0 -1
- package/lib/config/get/index.js +0 -86
- package/lib/config/get/index.js.map +0 -1
- package/lib/config/index.d.ts +0 -2
- package/lib/config/index.d.ts.map +0 -1
- package/lib/config/index.js +0 -15
- package/lib/config/index.js.map +0 -1
- package/lib/config/update/index.d.ts +0 -2
- package/lib/config/update/index.d.ts.map +0 -1
- package/lib/config/update/index.js +0 -83
- package/lib/config/update/index.js.map +0 -1
- package/lib/config/update/update-manager.d.ts +0 -23
- package/lib/config/update/update-manager.d.ts.map +0 -1
- package/lib/config/update/update-manager.js +0 -208
- package/lib/config/update/update-manager.js.map +0 -1
- package/lib/constants/static-variable.d.ts +0 -12
- package/lib/constants/static-variable.d.ts.map +0 -1
- package/lib/constants/static-variable.js +0 -15
- package/lib/constants/static-variable.js.map +0 -1
- package/lib/entity.d.ts +0 -11
- package/lib/entity.d.ts.map +0 -1
- package/lib/entity.js +0 -3
- package/lib/entity.js.map +0 -1
- package/lib/error/command-error.d.ts +0 -5
- package/lib/error/command-error.d.ts.map +0 -1
- package/lib/error/command-error.js +0 -26
- package/lib/error/command-error.js.map +0 -1
- package/lib/error/config-delete-error.d.ts +0 -5
- package/lib/error/config-delete-error.d.ts.map +0 -1
- package/lib/error/config-delete-error.js +0 -26
- package/lib/error/config-delete-error.js.map +0 -1
- package/lib/error/config-error.d.ts +0 -5
- package/lib/error/config-error.d.ts.map +0 -1
- package/lib/error/config-error.js +0 -26
- package/lib/error/config-error.js.map +0 -1
- package/lib/error/config-get-error.d.ts +0 -5
- package/lib/error/config-get-error.d.ts.map +0 -1
- package/lib/error/config-get-error.js +0 -26
- package/lib/error/config-get-error.js.map +0 -1
- package/lib/error/config-update-error.d.ts +0 -5
- package/lib/error/config-update-error.d.ts.map +0 -1
- package/lib/error/config-update-error.js +0 -26
- package/lib/error/config-update-error.js.map +0 -1
- package/lib/error/init-error.d.ts +0 -5
- package/lib/error/init-error.d.ts.map +0 -1
- package/lib/error/init-error.js +0 -26
- package/lib/error/init-error.js.map +0 -1
- package/lib/error/login-error.d.ts +0 -5
- package/lib/error/login-error.d.ts.map +0 -1
- package/lib/error/login-error.js +0 -26
- package/lib/error/login-error.js.map +0 -1
- package/lib/error/platform-delete-error.d.ts +0 -5
- package/lib/error/platform-delete-error.d.ts.map +0 -1
- package/lib/error/platform-delete-error.js +0 -26
- package/lib/error/platform-delete-error.js.map +0 -1
- package/lib/error/platform-init-error.d.ts +0 -5
- package/lib/error/platform-init-error.d.ts.map +0 -1
- package/lib/error/platform-init-error.js +0 -26
- package/lib/error/platform-init-error.js.map +0 -1
- package/lib/error/platform-publish-error.d.ts +0 -5
- package/lib/error/platform-publish-error.d.ts.map +0 -1
- package/lib/error/platform-publish-error.js +0 -26
- package/lib/error/platform-publish-error.js.map +0 -1
- package/lib/error/search-error.d.ts +0 -5
- package/lib/error/search-error.d.ts.map +0 -1
- package/lib/error/search-error.js +0 -26
- package/lib/error/search-error.js.map +0 -1
- package/lib/error/serverless-error.d.ts +0 -4
- package/lib/error/serverless-error.d.ts.map +0 -1
- package/lib/error/serverless-error.js +0 -20
- package/lib/error/serverless-error.js.map +0 -1
- package/lib/error/set-analysis-error.d.ts +0 -5
- package/lib/error/set-analysis-error.d.ts.map +0 -1
- package/lib/error/set-analysis-error.js +0 -26
- package/lib/error/set-analysis-error.js.map +0 -1
- package/lib/error/set-language-error.d.ts +0 -5
- package/lib/error/set-language-error.d.ts.map +0 -1
- package/lib/error/set-language-error.js +0 -26
- package/lib/error/set-language-error.js.map +0 -1
- package/lib/gui/gui-service.d.ts +0 -11
- package/lib/gui/gui-service.d.ts.map +0 -1
- package/lib/gui/gui-service.js +0 -276
- package/lib/gui/gui-service.js.map +0 -1
- package/lib/gui/index.d.ts +0 -2
- package/lib/gui/index.d.ts.map +0 -1
- package/lib/gui/index.js +0 -67
- package/lib/gui/index.js.map +0 -1
- package/lib/init/init-manager.d.ts +0 -9
- package/lib/init/init-manager.d.ts.map +0 -1
- package/lib/init/init-manager.js +0 -171
- package/lib/init/init-manager.js.map +0 -1
- package/lib/init/init-message.d.ts +0 -6
- package/lib/init/init-message.d.ts.map +0 -1
- package/lib/init/init-message.js +0 -9
- package/lib/init/init-message.js.map +0 -1
- package/lib/init/init.d.ts +0 -2
- package/lib/init/init.d.ts.map +0 -1
- package/lib/init/init.js +0 -87
- package/lib/init/init.js.map +0 -1
- package/lib/platform/delete/index.d.ts +0 -2
- package/lib/platform/delete/index.d.ts.map +0 -1
- package/lib/platform/delete/index.js +0 -89
- package/lib/platform/delete/index.js.map +0 -1
- package/lib/platform/delete/platform-delete-manager.d.ts +0 -4
- package/lib/platform/delete/platform-delete-manager.d.ts.map +0 -1
- package/lib/platform/delete/platform-delete-manager.js +0 -100
- package/lib/platform/delete/platform-delete-manager.js.map +0 -1
- package/lib/platform/index.d.ts +0 -2
- package/lib/platform/index.d.ts.map +0 -1
- package/lib/platform/index.js +0 -25
- package/lib/platform/index.js.map +0 -1
- package/lib/platform/init/index.d.ts +0 -2
- package/lib/platform/init/index.d.ts.map +0 -1
- package/lib/platform/init/index.js +0 -70
- package/lib/platform/init/index.js.map +0 -1
- package/lib/platform/init/platform-init-manager.d.ts +0 -4
- package/lib/platform/init/platform-init-manager.d.ts.map +0 -1
- package/lib/platform/init/platform-init-manager.js +0 -24
- package/lib/platform/init/platform-init-manager.js.map +0 -1
- package/lib/platform/login/index.d.ts +0 -2
- package/lib/platform/login/index.d.ts.map +0 -1
- package/lib/platform/login/index.js +0 -68
- package/lib/platform/login/index.js.map +0 -1
- package/lib/platform/login/login-manager.d.ts +0 -15
- package/lib/platform/login/login-manager.d.ts.map +0 -1
- package/lib/platform/login/login-manager.js +0 -176
- package/lib/platform/login/login-manager.js.map +0 -1
- package/lib/platform/publish/index.d.ts +0 -2
- package/lib/platform/publish/index.d.ts.map +0 -1
- package/lib/platform/publish/index.js +0 -93
- package/lib/platform/publish/index.js.map +0 -1
- package/lib/platform/publish/platform-publish-manager.d.ts +0 -5
- package/lib/platform/publish/platform-publish-manager.d.ts.map +0 -1
- package/lib/platform/publish/platform-publish-manager.js +0 -115
- package/lib/platform/publish/platform-publish-manager.js.map +0 -1
- package/lib/plugin/index.d.ts +0 -20
- package/lib/plugin/index.d.ts.map +0 -1
- package/lib/plugin/index.js +0 -175
- package/lib/plugin/index.js.map +0 -1
- package/lib/s.d.ts +0 -2
- package/lib/s.d.ts.map +0 -1
- package/lib/s.js +0 -134
- package/lib/s.js.map +0 -1
- package/lib/search/search.d.ts +0 -2
- package/lib/search/search.d.ts.map +0 -1
- package/lib/search/search.js +0 -233
- package/lib/search/search.js.map +0 -1
- package/lib/set/analysis/index.d.ts +0 -2
- package/lib/set/analysis/index.d.ts.map +0 -1
- package/lib/set/analysis/index.js +0 -84
- package/lib/set/analysis/index.js.map +0 -1
- package/lib/set/index.d.ts +0 -2
- package/lib/set/index.d.ts.map +0 -1
- package/lib/set/index.js +0 -16
- package/lib/set/index.js.map +0 -1
- package/lib/set/language/index.d.ts +0 -2
- package/lib/set/language/index.d.ts.map +0 -1
- package/lib/set/language/index.js +0 -73
- package/lib/set/language/index.js.map +0 -1
- package/lib/set/output-color/index.d.ts +0 -2
- package/lib/set/output-color/index.d.ts.map +0 -1
- package/lib/set/output-color/index.js +0 -87
- package/lib/set/output-color/index.js.map +0 -1
- package/lib/utils/analysis.d.ts +0 -12
- package/lib/utils/analysis.d.ts.map +0 -1
- package/lib/utils/analysis.js +0 -42
- package/lib/utils/analysis.js.map +0 -1
- package/lib/utils/check-version.d.ts +0 -13
- package/lib/utils/check-version.d.ts.map +0 -1
- package/lib/utils/check-version.js +0 -241
- package/lib/utils/check-version.js.map +0 -1
- package/lib/utils/command.d.ts +0 -14
- package/lib/utils/command.d.ts.map +0 -1
- package/lib/utils/command.js +0 -251
- package/lib/utils/command.js.map +0 -1
- package/lib/utils/common.d.ts +0 -4
- package/lib/utils/common.d.ts.map +0 -1
- package/lib/utils/common.js +0 -50
- package/lib/utils/common.js.map +0 -1
- package/lib/utils/download-manager.d.ts +0 -23
- package/lib/utils/download-manager.d.ts.map +0 -1
- package/lib/utils/download-manager.js +0 -302
- package/lib/utils/download-manager.js.map +0 -1
- package/lib/utils/handler-set-config.d.ts +0 -14
- package/lib/utils/handler-set-config.d.ts.map +0 -1
- package/lib/utils/handler-set-config.js +0 -122
- package/lib/utils/handler-set-config.js.map +0 -1
- package/lib/utils/i18n.d.ts +0 -3
- package/lib/utils/i18n.d.ts.map +0 -1
- package/lib/utils/i18n.js +0 -21
- package/lib/utils/i18n.js.map +0 -1
- package/lib/utils/locales/en.json +0 -9
- package/lib/utils/locales/zh.json +0 -203
- package/lib/utils/logger.d.ts +0 -18
- package/lib/utils/logger.d.ts.map +0 -1
- package/lib/utils/logger.js +0 -196
- package/lib/utils/logger.js.map +0 -1
- package/lib/utils/package-type.d.ts +0 -6
- package/lib/utils/package-type.d.ts.map +0 -1
- package/lib/utils/package-type.js +0 -10
- package/lib/utils/package-type.js.map +0 -1
- package/lib/utils/parse.d.ts +0 -26
- package/lib/utils/parse.d.ts.map +0 -1
- package/lib/utils/parse.js +0 -229
- package/lib/utils/parse.js.map +0 -1
- package/lib/utils/repo-template-entity.d.ts +0 -12
- package/lib/utils/repo-template-entity.d.ts.map +0 -1
- package/lib/utils/repo-template-entity.js +0 -3
- package/lib/utils/repo-template-entity.js.map +0 -1
- package/lib/utils/start-service.d.ts +0 -22
- package/lib/utils/start-service.d.ts.map +0 -1
- package/lib/utils/start-service.js +0 -97
- package/lib/utils/start-service.js.map +0 -1
- package/lib/utils/storage.d.ts +0 -3
- package/lib/utils/storage.d.ts.map +0 -1
- package/lib/utils/storage.js +0 -23
- package/lib/utils/storage.js.map +0 -1
- package/lib/utils/url-parser.d.ts +0 -8
- package/lib/utils/url-parser.d.ts.map +0 -1
- package/lib/utils/url-parser.js +0 -58
- package/lib/utils/url-parser.js.map +0 -1
- package/scripts/tests/deploy/parse.ts +0 -0
- package/scripts/tests/download-manager-test.ts +0 -135
- package/scripts/tests/init-manager-test.ts +0 -232
- package/scripts/tests/url-parser-test.ts +0 -44
- package/src/command/command-manager.ts +0 -83
- package/src/command/index.ts +0 -42
- package/src/component/hook.ts +0 -88
- package/src/component/index.ts +0 -433
- package/src/config/add/add-manager.ts +0 -207
- package/src/config/add/index.ts +0 -45
- package/src/config/common/common.ts +0 -186
- package/src/config/delete/delete-manager.ts +0 -51
- package/src/config/delete/index.ts +0 -38
- package/src/config/get/get-manager.ts +0 -148
- package/src/config/get/index.ts +0 -49
- package/src/config/index.ts +0 -13
- package/src/config/update/index.ts +0 -46
- package/src/config/update/update-manager.ts +0 -120
- package/src/constants/static-variable.ts +0 -12
- package/src/entity.ts +0 -10
- package/src/error/command-error.ts +0 -7
- package/src/error/config-delete-error.ts +0 -7
- package/src/error/config-error.ts +0 -7
- package/src/error/config-get-error.ts +0 -7
- package/src/error/config-update-error.ts +0 -7
- package/src/error/init-error.ts +0 -7
- package/src/error/login-error.ts +0 -7
- package/src/error/platform-delete-error.ts +0 -7
- package/src/error/platform-init-error.ts +0 -7
- package/src/error/platform-publish-error.ts +0 -7
- package/src/error/search-error.ts +0 -7
- package/src/error/serverless-error.ts +0 -17
- package/src/error/set-analysis-error.ts +0 -7
- package/src/error/set-language-error.ts +0 -7
- package/src/gui/gui-service.ts +0 -183
- package/src/gui/index.ts +0 -26
- package/src/init/init-manager.ts +0 -104
- package/src/init/init-message.ts +0 -8
- package/src/init/init.ts +0 -56
- package/src/platform/delete/index.ts +0 -46
- package/src/platform/delete/platform-delete-manager.ts +0 -46
- package/src/platform/index.ts +0 -26
- package/src/platform/init/index.ts +0 -33
- package/src/platform/init/platform-init-manager.ts +0 -17
- package/src/platform/login/index.ts +0 -25
- package/src/platform/login/login-manager.ts +0 -121
- package/src/platform/publish/index.ts +0 -52
- package/src/platform/publish/platform-publish-manager.ts +0 -69
- package/src/plugin/index.ts +0 -96
- package/src/s.ts +0 -83
- package/src/search/search.ts +0 -127
- package/src/set/analysis/index.ts +0 -45
- package/src/set/index.ts +0 -19
- package/src/set/language/index.ts +0 -39
- package/src/set/output-color/index.ts +0 -49
- package/src/utils/analysis.ts +0 -36
- package/src/utils/check-version.ts +0 -139
- package/src/utils/command.ts +0 -123
- package/src/utils/common.ts +0 -47
- package/src/utils/download-manager.ts +0 -197
- package/src/utils/handler-set-config.ts +0 -83
- package/src/utils/i18n.ts +0 -21
- package/src/utils/locales/en.json +0 -9
- package/src/utils/locales/zh.json +0 -228
- package/src/utils/logger.ts +0 -84
- package/src/utils/package-type.ts +0 -3
- package/src/utils/parse.ts +0 -176
- package/src/utils/repo-template-entity.ts +0 -14
- package/src/utils/start-service.ts +0 -64
- package/src/utils/storage.ts +0 -20
- package/src/utils/url-parser.ts +0 -60
- package/templates/application/common/publish.yaml +0 -16
- package/templates/application/common/readme.md +0 -99
- package/templates/application/common/src/index.js +0 -13
- package/templates/application/common/src/template.yaml +0 -16
- package/templates/component/common/publish.yaml +0 -24
- package/templates/component/common/readme.md +0 -386
- package/templates/component/common/src/index.js +0 -18
- package/templates/component/common/src/package.json +0 -7
- package/templates/plugin/common/publish.yaml +0 -9
- package/templates/plugin/common/readme.md +0 -128
- package/templates/plugin/common/src/index.js +0 -9
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"In operation......": "In operation......",
|
|
3
|
-
"Welcome to the Serverless Tool.": "Welcome to the Serverless Tool.",
|
|
4
|
-
"You can use the corresponding function through the following instructions.": "You can use the corresponding function through the following instructions.",
|
|
5
|
-
"s config add help": "You can add an account.\n\n Example:\n $ s config add\n $ s config add -p alibaba\n $ s config add -p alibaba --AccessKeyID ****** --AccessKeySecret ****** --AccountID ******\n $ s config add -p huaweicloud --AccessKey ****** --SecretKey ******\n\n Configuration parameters for cloud vendors:\n alibaba: AccountID, AccessKeyID, AccessKeySecret\n aws: AccessKeyID, SecretAccessKey\n baidu: AccessKeyID, SecretAccessKey\n huawei: AccessKey, SecretKey\n tencent: AccountID, SecretID, SecretKey",
|
|
6
|
-
"s config delete help": "You can delete an account.\n\n Example:\n $ s config delete -p alibaba -a demo\n",
|
|
7
|
-
"s config get help": "You can get accounts.\n \n Example:\n $ s config get -l\n $ s config get -p alibaba -a demo\n ",
|
|
8
|
-
"s config update help": "You can delete an account.\n \n Example:\n $ s config update -p alibaba -a demo\n $ s config update -p alibaba -a demo --AccountID ************\n"
|
|
9
|
-
}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"In operation......": "操作中",
|
|
3
|
-
"Welcome to the Serverless Tool.": "欢迎使用Serverless命令行工具",
|
|
4
|
-
"You can use the corresponding function through the following instructions.": "您可根据如下提示来使用功能。",
|
|
5
|
-
"Verbose output": "详细输出",
|
|
6
|
-
"Configure cloud service account.": "配置云服务账号",
|
|
7
|
-
"Initializing a project.": "初始化项目",
|
|
8
|
-
"Initialization successfully": "初始化成功",
|
|
9
|
-
"Search the package.": "搜索包",
|
|
10
|
-
"Publish a(an) Component/Plugin/Application.": "发布一个组件/插件/应用",
|
|
11
|
-
"Settings for the tool.": "设置",
|
|
12
|
-
"Display help for command": "获取帮助信息",
|
|
13
|
-
"Output the version number": "获取版本号",
|
|
14
|
-
"Initialization failed": "初始化失败",
|
|
15
|
-
"Unknown host({{host}}), we support github currently.": "未知域名({{host}}), 当前只支持github.",
|
|
16
|
-
"Initializing......": "正在初始化......",
|
|
17
|
-
"Directory already exists: {{{outputDir}}}": "目录已存在:{{{outputDir}}}",
|
|
18
|
-
"Download Template failed: {{msg}}": "下载模板失败:{{msg}}",
|
|
19
|
-
"Git clone Template failed: {{msg}}": "Git克隆模板失败:{{msg}}",
|
|
20
|
-
"Unknown project format: {{target}}": "未知项目格式:{{target}}",
|
|
21
|
-
"Download Template from app center failed: {{msg}}": "从应用中心下载模板失败:{{msg}}",
|
|
22
|
-
"Unable to get package provider: {{msg}}": "获取包提供者失败:{{msg}}",
|
|
23
|
-
"Failed to get package provider, http code: {{code}}": "获取包提供者失败,http状态码:{{code}}",
|
|
24
|
-
"Failed to get package provider, error message: {{msg}}": "获取包提供者失败,错误信息:{{msg}}",
|
|
25
|
-
"No available provider for {{project}}": "项目{{project}}没有可用的提供者",
|
|
26
|
-
"Please choose a provider": "请选择一个提供者",
|
|
27
|
-
"Failed to get package information, http code: {{code}}": "获取包信息失败,http状态码:{{code}}",
|
|
28
|
-
"Failed to get package information, error: {{msg}}": "获取包信息失败,错误信息:{{msg}}",
|
|
29
|
-
"Download template by url failed, error: {{msg}}": "通过URL下载模板失败,错误信息:{{msg}}",
|
|
30
|
-
"Git repo url not correct.": "Git仓库地址格式不正确",
|
|
31
|
-
|
|
32
|
-
"Delete package failed": "删除报失败",
|
|
33
|
-
"Deleting......": "删除中...",
|
|
34
|
-
"Failed to delete package, error: {{error}}": "删除包失败, 错误信息:{{error}}",
|
|
35
|
-
"Failed to delete package, http status code: {{code}}": "删除包失败,http状态码:{{code}}",
|
|
36
|
-
"Failed to delete package, code: {{code}}, message: {{msg}}": "删除包失败,错误码:{{code}},错误信息:{{msg}}",
|
|
37
|
-
"Delete successfully": "删除成功",
|
|
38
|
-
"Initialize a package to be released.": "初始化包模板",
|
|
39
|
-
"Example": "样例",
|
|
40
|
-
"Package type.": "包类型",
|
|
41
|
-
"Package type [Component/Plugin/Application].": "包类型 [Component/Plugin/Application]",
|
|
42
|
-
"Unknown package type: {{type}}": "未知包类型:{{type}}",
|
|
43
|
-
|
|
44
|
-
"Login failed": "登录失败",
|
|
45
|
-
"Failed to login, error: {{error}}": "登录失败,错误信息为:{{error}}",
|
|
46
|
-
"Failed to login, http code: {{code}}": "登录失败,http状态码为:{{code}}",
|
|
47
|
-
"Failed to login, code: {{code}}, message: {{msg}}": "登录失败,错误码为:{{code}},错误信息为:{{msg}}",
|
|
48
|
-
"Login information obtained successfully.": "登录成功",
|
|
49
|
-
"Please login in first.": "请使用s platform login先登录",
|
|
50
|
-
|
|
51
|
-
"Package management.For component/plugin/application developers: including publishing, query, delete and other functions.": "包管理,此功能适用于组件/插件/应用开发者,包含发布、查询、删除等功能。",
|
|
52
|
-
"Login Serverless Tool.": "登录",
|
|
53
|
-
"Publish package.": "发布包",
|
|
54
|
-
"Delete package.": "删除包",
|
|
55
|
-
|
|
56
|
-
"Search packages": "搜索包",
|
|
57
|
-
"The cloud service provider.": "云提供商",
|
|
58
|
-
"The package type. [component/plugin/application]": "包类型,[component/plugin/application]",
|
|
59
|
-
"Search failed": "搜索失败",
|
|
60
|
-
|
|
61
|
-
"Search failed, error: {{error}}": "搜索失败,错误信息:{{error}}",
|
|
62
|
-
"Search failed, status code: {{code}}": "搜索失败,http状态码:{{code}}",
|
|
63
|
-
"Search failed, error code: {{code}}, message:{{msg}}": "搜索失败,错误码:{{code}},错误信息:{{msg}}",
|
|
64
|
-
|
|
65
|
-
"Analysis failed": "分析操作失败",
|
|
66
|
-
"No 参数 input": "没有参数输入",
|
|
67
|
-
"Too many args input": "参数过多",
|
|
68
|
-
"Unknown input: {{input}}": "未知输入:{{input}}",
|
|
69
|
-
"Setup succeeded": "设置成功",
|
|
70
|
-
|
|
71
|
-
"You can set language.": "设置语言",
|
|
72
|
-
|
|
73
|
-
"Deploy project.": "发布项目",
|
|
74
|
-
|
|
75
|
-
"Add an account": "添加一个账号",
|
|
76
|
-
"Get accounts": "获取帐号信息",
|
|
77
|
-
"Delete an account": "删除指定账号",
|
|
78
|
-
"Update an account": "升级指定账号",
|
|
79
|
-
"You can configure provider accounts, including Alibaba Cloud, Baidu Cloud, Huawei Cloud, Tencent Cloud, etc.": "您可以配置厂商账号信息,例如阿里云、百度云、华为云、腾讯云等。",
|
|
80
|
-
|
|
81
|
-
"Please input username": "请输入用户名",
|
|
82
|
-
"Please input password": "请输入密码",
|
|
83
|
-
"Init Error": "初始化失败",
|
|
84
|
-
"The cloud service provider. [alibaba/aws/azure/baidu/google/huawei/tencent]": "云服务提供商。 [alibaba/aws/azure/baidu/google/huawei/tencent]",
|
|
85
|
-
"Key pair alias, if the alias is not set, use default instead": "密钥对的别名,如果没有设置,将会用默认值代替。",
|
|
86
|
-
"Configure the AccountID": "配置AccountID",
|
|
87
|
-
"Configure the AccessKeyID": "配置AccessKeyID",
|
|
88
|
-
"Configure the AccessKeySecret": "配置AccessKeySecret",
|
|
89
|
-
"Configure the SecretID": "配置SecretID",
|
|
90
|
-
"Configure the SecretKey": "配置SecretKey",
|
|
91
|
-
"Configure the SecretAccessKey": "配置SecretAccessKey",
|
|
92
|
-
"Configure the KeyVault": "配置KeyVault ",
|
|
93
|
-
"Configure the Secret": "配置Secret ",
|
|
94
|
-
"Configure the PrivateKeyData": "配置PrivateKeyData ",
|
|
95
|
-
|
|
96
|
-
"Configuration successful": "配置成功",
|
|
97
|
-
"Configuration failed": "配置失败",
|
|
98
|
-
"Please select a provider:": "请选择一个云厂商",
|
|
99
|
-
"Provider + Alias already exists. You can set a different alias or modify it through: {{input}}": "云厂商 + 别名已存在,您可以更换别名或者通过{{input}}进行修改",
|
|
100
|
-
"Please create alias for key pair. If not, please enter to skip": "是否为当前密钥设置别名,可按回车键跳过",
|
|
101
|
-
"Configuration parameter exception": "配置参数异常",
|
|
102
|
-
"The Provider[{{provider}}]: key[{{key}}] is required.": "云厂商{{provider}}中,参数{{key}}是必填参数。",
|
|
103
|
-
"The cloud vendor[{{provider}}] was not found. [alibaba/aws/azure/baidu/google/huawei/tencent]": "默认支持的厂商列表未找到厂商:{{provider}}。[alibaba/aws/azure/baidu/google/huawei/tencent]",
|
|
104
|
-
|
|
105
|
-
"Download Success......": "下载成功",
|
|
106
|
-
|
|
107
|
-
"Detailed output information is not available.": "未获得到详细输出信息。",
|
|
108
|
-
"s config add help": "您可以添加一个云厂商的账号信息。\n\n 例如:\n $ s config add\n $ s config add -p alibaba\n $ s config add -p alibaba --AccessKeyID ****** --AccessKeySecret ****** --AccountID ******\n $ s config add -p huaweicloud --AccessKey ****** --SecretKey ******\n\n 配置不同云厂商所需要的密钥内容:\n alibaba: AccountID, AccessKeyID, AccessKeySecret\n aws: AccessKeyID, SecretAccessKey\n baidu: AccessKeyID, SecretAccessKey\n huawei: AccessKey, SecretKey\n tencent: AccountID, SecretID, SecretKey",
|
|
109
|
-
"s config delete help": "您可以删除一个云厂商的账号信息.\n\n 例如:\n $ s config delete -p alibaba -a demo\n ",
|
|
110
|
-
"s config get help": "您可以获取一个云厂商的账号信息.\n \n 例如:\n $ s config get -l\n $ s config get -p alibaba -a demo\n",
|
|
111
|
-
"s config update help": "您可以更新一个云厂商的账号信息.\n \n 例如:\n $ s config update -p alibaba -a demo\n $ s config update -p alibaba -a demo --AccountID ************\n",
|
|
112
|
-
"Key pair alia, if the alias is not set, use default instead": "密钥对别名(如果未设置别名,默认为default)",
|
|
113
|
-
|
|
114
|
-
"Update AccountID": "更新AccountID ",
|
|
115
|
-
"Update AccessKeyID": "更新AccessKeyID ",
|
|
116
|
-
"Update AccessKeySecret": "更新AccessKeySecret ",
|
|
117
|
-
"Update SecretID": "更新SecretID ",
|
|
118
|
-
"Update SecretKey": "更新SecretKey ",
|
|
119
|
-
"Update SecretAccessKey": "更新SecretAccessKey ",
|
|
120
|
-
"Update KeyVault": "更新KeyVault ",
|
|
121
|
-
"Update Secret": "更新Secret ",
|
|
122
|
-
"Update PrivateKeyData": "更新PrivateKeyData ",
|
|
123
|
-
|
|
124
|
-
"The key information is not found. You can obtain the key information through: s config get -l.": "删除失败:找不到密钥信息。您可以通过以下方法获取密钥信息:s config get -l",
|
|
125
|
-
"Need to enter provider and aliasName at the same time. You can obtain the key information through: s config delete -h.": "删除失败:需要同时输入provider和aliasName。您可以通过以下方式获取密钥信息:s config delete -h",
|
|
126
|
-
"The configuration list is empty. You can add configuration through: s config add": "配置列表为空。您可以通过以下方式添加配置:s config add",
|
|
127
|
-
|
|
128
|
-
"Query failed : Please input right format. You can obtain the key information through: s config get -h": "查询失败:请输入正确的格式。您可以通过以下方式获取关键信息:s config get -h",
|
|
129
|
-
"Query failed : The key information is not found. You can obtain the key information through: s config get -l": "查询失败:找不到关键信息。 您可以通过以下方法获取关键信息:s config get -l",
|
|
130
|
-
"Show user configuration list": "显示用户配置列表",
|
|
131
|
-
|
|
132
|
-
"The provider or alias information is not found. You can obtain the key information through: s config get -l": "找不到云厂商或别名信息。 您可以通过以下方法获取关键信息:s config get -l",
|
|
133
|
-
|
|
134
|
-
" You can configure the specified key in yaml. For example:": "您可以在Yaml中配置指定密钥信息,例如:",
|
|
135
|
-
" Access: Fill in the specified key here": " Access: 在此处填写已经配置过的密钥",
|
|
136
|
-
|
|
137
|
-
"Alibaba Cloud": "阿里云",
|
|
138
|
-
"Huawei Cloud": "华为云",
|
|
139
|
-
"Baidu Cloud": "百度云",
|
|
140
|
-
"Tencent Cloud": "腾讯云",
|
|
141
|
-
"AWS": "AWS",
|
|
142
|
-
"Azure": "Azure",
|
|
143
|
-
"Google Cloud": "谷歌云",
|
|
144
|
-
"Alibaba Cloud (alibaba)": "阿里云 (alibaba)",
|
|
145
|
-
"Huawei Cloud (huawei)": "华为云 (huawei)",
|
|
146
|
-
"Baidu Cloud (baidu)": "百度云 (baidu)",
|
|
147
|
-
"Tencent Cloud (tencent)": "腾讯云 (tencent)",
|
|
148
|
-
"AWS (aws)": "AWS (aws)",
|
|
149
|
-
"Azure (azure)": "Azure (azure)",
|
|
150
|
-
"Google Cloud (google)": "谷歌云 (google)",
|
|
151
|
-
|
|
152
|
-
"Update succeeded.": "更新成功",
|
|
153
|
-
"Deletion succeeded": "删除成功",
|
|
154
|
-
"Update failed": "更新失败",
|
|
155
|
-
"Deletion failed": "删除失败",
|
|
156
|
-
"Get failed": "获取失败",
|
|
157
|
-
"Config failed": "配置失败",
|
|
158
|
-
|
|
159
|
-
"You can make some default settings for the tool here.": "您可以在此处对工具做一些个性化设置。",
|
|
160
|
-
"Upload your usage habits to help us improve our products": "与我们分享您的行为习惯,有助于我们改善产品。",
|
|
161
|
-
"Output language switch": "语言选择",
|
|
162
|
-
"Control color output": "颜色输出选择",
|
|
163
|
-
|
|
164
|
-
"Start ......": "开始 ......",
|
|
165
|
-
"It is detected that your project has the following project/projects < {{projects}} > to be execute": "检测到您有以下项目 < {{projects}} > 要执行" ,
|
|
166
|
-
"End of method: {{method}}": "方法结束: {{method}}",
|
|
167
|
-
"End the pre-hook": "完成前置条件的执行",
|
|
168
|
-
"Start the pre-hook": "开始执行前置条件",
|
|
169
|
-
"End the after-hook": "完成后置条件的执行",
|
|
170
|
-
"Start the after-hook": "开始执行后置条件",
|
|
171
|
-
"Execute:": "执行结果:",
|
|
172
|
-
"Execute stdout:": "异常输出:",
|
|
173
|
-
|
|
174
|
-
"Name": "名称",
|
|
175
|
-
"Provider & Type": "云厂商&类型",
|
|
176
|
-
"Description": "描述",
|
|
177
|
-
"Could not get packages.": "无法获取到包信息。",
|
|
178
|
-
"Could not get package.": "无法获取到包信息。",
|
|
179
|
-
" Init Information:": " 初始化信息:",
|
|
180
|
-
" Package: {{package}} Provider: {{provider}}": " 包名:{{package}} 云厂商:{{provider}}",
|
|
181
|
-
|
|
182
|
-
"The cloud service provider": "用服务提供商",
|
|
183
|
-
"Initialize a new project based on a template.": "基于模板等初始化一个项目。",
|
|
184
|
-
"Example:": "例如:",
|
|
185
|
-
"Here you can set whether the output has color.": "您可以在这里设置输出信息是否带有颜色",
|
|
186
|
-
"Package management.For component/plugin/application developers: including publishing, query, delete and other functions.": "包管理,组件/插件/应用开发者开在这里进行发布、更新、删除等操作",
|
|
187
|
-
"Username of Serverless Devs Tool Platform": "Serverless Devs Tool 平台账号",
|
|
188
|
-
"Password of Serverless Devs Tool Platform": "Serverless Devs Tool 平台密码",
|
|
189
|
-
"Publish successfully": "发布成功",
|
|
190
|
-
"[Required] Package name and version, like: test@0.0.1": "[必填] 包名称和版本,例如:test@0.0.1",
|
|
191
|
-
"[Required] Package version": "[必填] 包版本",
|
|
192
|
-
"[Required] Package type [Component/Plugin/Application]": "[必填] 包类型,包括Component、Plugin、Application",
|
|
193
|
-
"[Required] Provider": "[必填] 云厂商",
|
|
194
|
-
"Could not get component name and version, please check you component content.": "无法获得到组件名称和版本,请检查您填写的组件。",
|
|
195
|
-
"Please select an access:": "请选择一个账号:",
|
|
196
|
-
"Start executing project {{projectName}}": "开始执行项目{{projectName}}",
|
|
197
|
-
"Project {{projectName}} successfully to execute \n\t": "项目{{projectName}}已成功执行 \n\t",
|
|
198
|
-
"Project {{projectName}} failed to execute": "项目{{projectName}}执行失败",
|
|
199
|
-
"Project {{projectName}} doesn't have the method: {{method}}": "项目{{projectName}}中未找到指定方法:{{method}}",
|
|
200
|
-
"No credential found please set": "未找到账号信息,请设置",
|
|
201
|
-
"No component {{name}}-{{provider}}@{{version}} is found, it will be downloaded soon, this may take a few minutes......": "本地未找到{{name}}-{{provider}}@{{version}},系统将会下载,这可能需要一些时间......",
|
|
202
|
-
"Please Check the provider and component": "请检查云厂商和组件",
|
|
203
|
-
"Please try again later": "请稍后重试",
|
|
204
|
-
"Where to output the initialized app into (default: ./ )": "生成的应用/模板路径",
|
|
205
|
-
"Skip the Extends section": "跳过/忽略Extends",
|
|
206
|
-
"Downloading ...": "下载中 ...",
|
|
207
|
-
"Executing ...": "执行中 ...",
|
|
208
|
-
"If your want output colorful": "如果您想输出彩色的",
|
|
209
|
-
"If your want output with default color": "如果您想使用默认颜色输出",
|
|
210
|
-
"Unable to format the output, the system will display the original output of the component:": "无法格式化输出,系统即将把组件的原始输出展示出来:",
|
|
211
|
-
"Calling @serverless-devs/s tools in Extends requires configuring Access in Yaml.": "在Extends中使用@serverless-devs/s工具需要配置Access在您的Yaml中。",
|
|
212
|
-
"Start GUI service.": "启动GUI服务。",
|
|
213
|
-
"Start GUI service": "启动GUI服务",
|
|
214
|
-
"Check that you don’t have a gui client, download it now, it will take you about 1 minute.": "系统未监测到GUI客户端,现在开始下载,请您稍等1分钟左右。",
|
|
215
|
-
":Loading ...": ":加载中",
|
|
216
|
-
":Unziping ...": ":解压中",
|
|
217
|
-
"Download successfully, now start to unzip.": "下载成功,现在开始解压。",
|
|
218
|
-
"Unzip success begin to start.": "解压成功,开始启动。",
|
|
219
|
-
"The system has detected a new version of the GUI. You can use `s gui --update` to upgrade.": "系统检测GUI服务有新版本,您可以使用`s gui --update`升级。",
|
|
220
|
-
"Upgrade GUI": "升级GUI",
|
|
221
|
-
"GUI updating ......": "GUI 升级中",
|
|
222
|
-
" You can upgrade through : npm install @serverless-devs/s -g": " 您可以通过:npm install @serverless-devs/s -g 进行升级",
|
|
223
|
-
" Update information:": " 升级信息:",
|
|
224
|
-
"Init project through GUI service": "通过GUI进行项目初始化",
|
|
225
|
-
"You could get a project from Serverless Devs App Store. Like:": "您可以通过Serverless Devs应用中心获取一个项目。例如:",
|
|
226
|
-
"Package type [Component/Plugin/Application]": "包类型 [Component/Plugin/Application]"
|
|
227
|
-
|
|
228
|
-
}
|
package/src/utils/logger.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { ServerlessError } from '../error/serverless-error';
|
|
2
|
-
import i18n from '../utils/i18n';
|
|
3
|
-
|
|
4
|
-
const colors = require('colors');
|
|
5
|
-
const { red, white, gray, cyan, yellow, green } = colors;
|
|
6
|
-
|
|
7
|
-
// 输出信息颜色启用或关闭
|
|
8
|
-
export const colorSwitch = (flag: boolean) => {
|
|
9
|
-
process.env.COLORFLAG = `${flag}`;
|
|
10
|
-
|
|
11
|
-
if (flag) {
|
|
12
|
-
colors.enable();
|
|
13
|
-
} else {
|
|
14
|
-
colors.disable();
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
if (typeof process.env.COLORFLAG === 'string') {
|
|
19
|
-
colorSwitch(process.env.COLORFLAG === 'true');
|
|
20
|
-
}
|
|
21
|
-
/*
|
|
22
|
-
debug 只有 debug 模式才可以输出
|
|
23
|
-
error 判断是否属于 error 类型,error.messsage, debug 输出所有
|
|
24
|
-
*/
|
|
25
|
-
// 框架信息输出 白色
|
|
26
|
-
export const log = (...message: any) => {
|
|
27
|
-
for (let m of message) {
|
|
28
|
-
console.log(white(i18n.__(m)));
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
// 组件输出 灰色
|
|
32
|
-
export const debug = (...message: any) => {
|
|
33
|
-
if (process.env.VERBOSE) {
|
|
34
|
-
console.log(gray(...message));
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
// 错误输出 红色
|
|
38
|
-
export const error = (...message: any) => {
|
|
39
|
-
for (let m of message) {
|
|
40
|
-
if (typeof m === 'string' || m instanceof String) {
|
|
41
|
-
console.log(red(i18n.__(m)));
|
|
42
|
-
} else if (m instanceof ServerlessError) {
|
|
43
|
-
//already i18n for serverless error
|
|
44
|
-
console.log(red(m));
|
|
45
|
-
} else if (m instanceof Error) {
|
|
46
|
-
console.log(red(i18n.__(m.message)));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/*
|
|
50
|
-
if (process.env.VERBOSE) {
|
|
51
|
-
console.log(red(...message));
|
|
52
|
-
} else {
|
|
53
|
-
const m: any[] = message.map((item: any) => {
|
|
54
|
-
if (item instanceof Error) {
|
|
55
|
-
return item.message;
|
|
56
|
-
}
|
|
57
|
-
return item;
|
|
58
|
-
});
|
|
59
|
-
console.log(red(...m));
|
|
60
|
-
}
|
|
61
|
-
*/
|
|
62
|
-
};
|
|
63
|
-
// 提醒信息 蓝色
|
|
64
|
-
export const info = (...message: any) => {
|
|
65
|
-
for (let m of message) {
|
|
66
|
-
console.log(cyan(i18n.__(m)));
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
// 警告信息 黄色
|
|
70
|
-
export const warning = (...message: any) => {
|
|
71
|
-
for (let m of message) {
|
|
72
|
-
console.log(yellow(i18n.__(m)));
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
// 成功信息 绿色
|
|
76
|
-
export const success = (...message: any) => {
|
|
77
|
-
for (let m of message) {
|
|
78
|
-
console.log(green(i18n.__(m)));
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export default {
|
|
83
|
-
info, debug, error, log, warning, success, colorSwitch
|
|
84
|
-
};
|
package/src/utils/parse.ts
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
const yaml = require('js-yaml');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
import * as logger from './logger';
|
|
5
|
-
type MAP_OBJECT = {
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const COMMON_VARIABLE_TYPE_REG = new RegExp(/\$\{(.*)\}/, 'i');
|
|
10
|
-
const SPECIALL_VARIABLE_TYPE_REG = new RegExp(/(.*)\((.*)\)/, 'i');
|
|
11
|
-
|
|
12
|
-
const OTHER_BASIC_DATA_TYPE = ['[object Number]', '[object Boolean]'];
|
|
13
|
-
const BASIC_DATA_TYPE = ['string', 'number', 'boolean'];
|
|
14
|
-
// parse file get variables
|
|
15
|
-
// find variables value
|
|
16
|
-
export class Parse {
|
|
17
|
-
protected parsedObj: any = {};
|
|
18
|
-
public dependenciesMap: { [key: string]: any } = {};
|
|
19
|
-
protected globalJsonKeyMap: any = {};
|
|
20
|
-
protected globalKeyArr: any[] = [];
|
|
21
|
-
protected magicVariablesArray: any[] = [];
|
|
22
|
-
private globalJsonKeyMparentKeyap: any;
|
|
23
|
-
constructor(protected path: string) {
|
|
24
|
-
if (fs.existsSync(path)) {
|
|
25
|
-
try {
|
|
26
|
-
this.init(path);
|
|
27
|
-
} catch (ex) {
|
|
28
|
-
throw new Error(ex.message);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
getFileObj(filePath: string) {
|
|
33
|
-
let fileObj = {};
|
|
34
|
-
try {
|
|
35
|
-
const extname = path.extname(filePath);
|
|
36
|
-
if (extname.indexOf('.yaml') !== -1 || extname.indexOf('.yml') !== -1) {
|
|
37
|
-
fileObj = yaml.safeLoad(fs.readFileSync(filePath, 'utf8'));
|
|
38
|
-
}
|
|
39
|
-
if (extname.indexOf('.json') !== -1) {
|
|
40
|
-
fileObj = JSON.parse(fs.readFileSync(filePath));
|
|
41
|
-
}
|
|
42
|
-
} catch (e) {
|
|
43
|
-
logger.error(e.message);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return fileObj;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async init(filePath: string) {
|
|
50
|
-
this.parsedObj = this.getFileObj(filePath);
|
|
51
|
-
}
|
|
52
|
-
getOriginalParsedObj() {
|
|
53
|
-
return this.parsedObj;
|
|
54
|
-
}
|
|
55
|
-
private findVariableValue(variableObj: any) {
|
|
56
|
-
const { variableName, type, funName, funVariable } = variableObj;
|
|
57
|
-
let result = '';
|
|
58
|
-
if (type === 'Literal') {
|
|
59
|
-
return this.globalJsonKeyMparentKeyap[variableName] || '${' + variableName + '}';
|
|
60
|
-
}
|
|
61
|
-
if (type === 'Fun' && funName === 'Env') {
|
|
62
|
-
return process.env[funVariable];
|
|
63
|
-
}
|
|
64
|
-
if (type === 'Fun' && funName === 'File') {
|
|
65
|
-
return this.getFileObj(funVariable);
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
generateMagicVariables(value: any, arr: any[] = [], parentStr = '') {
|
|
70
|
-
if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
71
|
-
if (parentStr !== '') {
|
|
72
|
-
parentStr = `${parentStr}.`;
|
|
73
|
-
}
|
|
74
|
-
Object.keys(value).map((key) => {
|
|
75
|
-
let showKey = `${parentStr}${key}`;
|
|
76
|
-
let objValue = value[key];
|
|
77
|
-
arr.push(showKey);
|
|
78
|
-
arr.concat(this.generateMagicVariables(objValue, arr, `${showKey}`));
|
|
79
|
-
try {
|
|
80
|
-
if (!BASIC_DATA_TYPE.includes(typeof objValue)) {
|
|
81
|
-
objValue = JSON.stringify(objValue);
|
|
82
|
-
}
|
|
83
|
-
} catch (e) {
|
|
84
|
-
objValue = objValue.toString();
|
|
85
|
-
}
|
|
86
|
-
this.globalJsonKeyMap[showKey] = objValue;
|
|
87
|
-
});
|
|
88
|
-
} else if (Object.prototype.toString.call(value) === '[object Array]') {
|
|
89
|
-
value.forEach((_arrValue: any, i: number) => {
|
|
90
|
-
let showKey = `${parentStr}[${i}]`;
|
|
91
|
-
let showKeyNe = `${parentStr}[${i - value.length}]`;
|
|
92
|
-
arr.push(showKey);
|
|
93
|
-
arr.push(showKeyNe);
|
|
94
|
-
arr.concat(this.generateMagicVariables(_arrValue, arr, `${showKey}`));
|
|
95
|
-
arr.concat(this.generateMagicVariables(_arrValue, arr, `${showKeyNe}`));
|
|
96
|
-
try {
|
|
97
|
-
if (typeof _arrValue !== 'string') {
|
|
98
|
-
_arrValue = JSON.stringify(_arrValue);
|
|
99
|
-
}
|
|
100
|
-
} catch (e) {
|
|
101
|
-
_arrValue = _arrValue.toString();
|
|
102
|
-
}
|
|
103
|
-
this.globalJsonKeyMap[showKey] = _arrValue;
|
|
104
|
-
this.globalJsonKeyMap[showKeyNe] = _arrValue;
|
|
105
|
-
});
|
|
106
|
-
} else {
|
|
107
|
-
arr = [];
|
|
108
|
-
}
|
|
109
|
-
return arr;
|
|
110
|
-
}
|
|
111
|
-
isProjectProperties(topKey: string, parentKey: any) {
|
|
112
|
-
let projProperties = false;
|
|
113
|
-
if (parentKey === 'Properties' && this.globalJsonKeyMap[`${topKey}.${parentKey}`]) {
|
|
114
|
-
projProperties = true;
|
|
115
|
-
}
|
|
116
|
-
return projProperties;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
iteratorToSetValue(objValue: any, topKey: string, parentKey?: any) {
|
|
120
|
-
if (OTHER_BASIC_DATA_TYPE.includes(Object.prototype.toString.call(objValue))) {
|
|
121
|
-
return objValue;
|
|
122
|
-
}
|
|
123
|
-
if (Object.prototype.toString.call(objValue) === '[object String]') {
|
|
124
|
-
|
|
125
|
-
// const filePath = !this.isProjectProperties(topKey, parentKey) ? path.resolve(this.path, '..', objValue) : objValue;
|
|
126
|
-
const regResult = objValue.match(COMMON_VARIABLE_TYPE_REG);
|
|
127
|
-
if (regResult) {
|
|
128
|
-
const matchResult = regResult[1]; // get match result like projectName.key.variable
|
|
129
|
-
const variableObj = { variableName: matchResult, type: 'Literal', funName: null, funVariable: '' };
|
|
130
|
-
const funMatchResult = matchResult.match(SPECIALL_VARIABLE_TYPE_REG);
|
|
131
|
-
if (funMatchResult) {
|
|
132
|
-
// eg Env(SecretId) or ${File(./path)}
|
|
133
|
-
variableObj.funName = funMatchResult[1];
|
|
134
|
-
variableObj.funVariable = funMatchResult[2];
|
|
135
|
-
variableObj.type = 'Fun';
|
|
136
|
-
} else {
|
|
137
|
-
let topKeyDependencisMap = this.dependenciesMap[topKey];
|
|
138
|
-
if (!topKeyDependencisMap) {
|
|
139
|
-
topKeyDependencisMap = {};
|
|
140
|
-
}
|
|
141
|
-
const dependProjName = matchResult.split('.')[0];
|
|
142
|
-
topKeyDependencisMap[dependProjName] = 1; // Dependent priority
|
|
143
|
-
this.dependenciesMap[topKey] = topKeyDependencisMap;
|
|
144
|
-
}
|
|
145
|
-
return this.findVariableValue(variableObj);
|
|
146
|
-
}
|
|
147
|
-
this.dependenciesMap[topKey] = {};
|
|
148
|
-
|
|
149
|
-
return objValue;
|
|
150
|
-
}
|
|
151
|
-
if (Object.prototype.toString.call(objValue) === '[object Array]') {
|
|
152
|
-
return objValue.map((item: any) => {
|
|
153
|
-
return this.iteratorToSetValue(item, topKey);
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
if (Object.prototype.toString.call(objValue) === '[object Object]') {
|
|
157
|
-
Object.keys(objValue).forEach((key) => {
|
|
158
|
-
objValue[key] = this.iteratorToSetValue(objValue[key], topKey, parentKey || key);
|
|
159
|
-
});
|
|
160
|
-
return objValue;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
replaceVariable(variable: MAP_OBJECT) {
|
|
164
|
-
Object.keys(variable).forEach((key) => {
|
|
165
|
-
const objValue = variable[key];
|
|
166
|
-
variable[key] = this.iteratorToSetValue(objValue, key);
|
|
167
|
-
});
|
|
168
|
-
return variable;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
async getRealVariables(parsedObj: any) {
|
|
172
|
-
this.globalKeyArr = this.generateMagicVariables(parsedObj);
|
|
173
|
-
const replacedObj = this.replaceVariable(parsedObj);
|
|
174
|
-
return replacedObj;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface RepoTemplate {
|
|
4
|
-
zipFile : string;
|
|
5
|
-
subPath ?: string;
|
|
6
|
-
hasSubPath : boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface GitRepoTemplate extends RepoTemplate {
|
|
10
|
-
host : string | null;
|
|
11
|
-
ownerName : string;
|
|
12
|
-
branch : string;
|
|
13
|
-
repoName : string;
|
|
14
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const express = require('express');
|
|
2
|
-
const { execSync } = require('child_process');
|
|
3
|
-
import logger from './logger';
|
|
4
|
-
|
|
5
|
-
interface Callback {
|
|
6
|
-
(app: any): void
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface StartServiceData {
|
|
10
|
-
port?: number,
|
|
11
|
-
openBrowser?: boolean,
|
|
12
|
-
callback: Callback
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default class StartService {
|
|
16
|
-
private app: any;
|
|
17
|
-
private server: any;
|
|
18
|
-
private port = 3000;
|
|
19
|
-
private counter = 0;
|
|
20
|
-
|
|
21
|
-
constructor(protected readonly context: StartServiceData) {
|
|
22
|
-
this.app = express();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
private randomNum(): number {
|
|
26
|
-
return 3000 + Math.round(Math.random() * 2000);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
start() {
|
|
30
|
-
const { callback, port = 3000 } = this.context;
|
|
31
|
-
this.port = port;
|
|
32
|
-
callback(this.app);
|
|
33
|
-
this.listen();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
private async listen() {
|
|
37
|
-
this.counter += 1;
|
|
38
|
-
this.server = this.app.listen(this.port, () => {
|
|
39
|
-
const uri = `http://localhost:${this.port}`;
|
|
40
|
-
|
|
41
|
-
logger.log(uri);
|
|
42
|
-
|
|
43
|
-
if (this.context.openBrowser) {
|
|
44
|
-
const startInstruction = process.platform === 'win32' ? 'start' : 'open';
|
|
45
|
-
execSync(`${startInstruction} ${uri}`);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
this.server.on('error', (e: any) => {
|
|
50
|
-
if (e.code === 'EADDRINUSE') {
|
|
51
|
-
if (this.counter < 5) {
|
|
52
|
-
this.port = this.randomNum();
|
|
53
|
-
this.listen();
|
|
54
|
-
} else {
|
|
55
|
-
logger.error(e);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async stop() {
|
|
62
|
-
this.server.close();
|
|
63
|
-
}
|
|
64
|
-
}
|
package/src/utils/storage.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import * as os from 'os';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import * as fs from 'fs-extra';
|
|
5
|
-
|
|
6
|
-
export function getHomeDir() : string {
|
|
7
|
-
const home = path.join(os.homedir(), '.s');
|
|
8
|
-
if (!fs.existsSync(home)) {
|
|
9
|
-
fs.mkdirSync(home);
|
|
10
|
-
}
|
|
11
|
-
return home;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function getHistoryFile() : string {
|
|
15
|
-
const file = path.join(getHomeDir(), 'history');
|
|
16
|
-
if (!fs.existsSync(file)) {
|
|
17
|
-
fs.createFileSync(file);
|
|
18
|
-
}
|
|
19
|
-
return file;
|
|
20
|
-
}
|
package/src/utils/url-parser.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import * as URL from 'url';
|
|
3
|
-
import { GitRepoTemplate } from './repo-template-entity';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import { InitError } from '../error/init-error';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export function parse(url: string): URL.Url {
|
|
9
|
-
return URL.parse(url);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function getProjectNameFromUrl(url: string) {
|
|
13
|
-
let slash = url.lastIndexOf('/');
|
|
14
|
-
if (slash && slash >= 0) {
|
|
15
|
-
url = url.substr(slash + 1);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (url.endsWith('.git')) {
|
|
19
|
-
return url.substr(0, url.length - 4);
|
|
20
|
-
}
|
|
21
|
-
return url;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function isUrlFormat(url: string) {
|
|
25
|
-
return url.includes(':') || url.includes('/');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function extractTemplateInfo(url: URL.Url) : GitRepoTemplate {
|
|
29
|
-
let pathname = url.pathname || '';
|
|
30
|
-
if (pathname.endsWith('.git')) {
|
|
31
|
-
pathname = pathname.substr(0, pathname.length - 4);
|
|
32
|
-
}
|
|
33
|
-
const pathArr = pathname.split('/');
|
|
34
|
-
if (pathArr.length < 3) {
|
|
35
|
-
throw new InitError('Git repo url not correct.');
|
|
36
|
-
}
|
|
37
|
-
const ownerName = pathArr[1];
|
|
38
|
-
const repoName = pathArr[2];
|
|
39
|
-
const branch = (pathArr.length < 5) ? 'master' : pathArr[4];
|
|
40
|
-
const hasSubPath = pathArr.length > 5;
|
|
41
|
-
let subPath = '';
|
|
42
|
-
if (hasSubPath) {
|
|
43
|
-
subPath = path.join.apply(null, pathArr.slice(5));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
let zipFile = '';
|
|
47
|
-
if (url.hostname && url.hostname.includes('github')) {
|
|
48
|
-
zipFile = `${url.protocol}//${url.host}/${ownerName}/${repoName}/archive/${branch}.zip`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
host: url.host,
|
|
53
|
-
ownerName: ownerName,
|
|
54
|
-
repoName: repoName,
|
|
55
|
-
branch: branch,
|
|
56
|
-
hasSubPath: hasSubPath,
|
|
57
|
-
subPath: subPath,
|
|
58
|
-
zipFile: zipFile
|
|
59
|
-
};
|
|
60
|
-
}
|