@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
package/lib/utils/command.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.recordCommandHistory = exports.registerVerbose = exports.regiserUniversalCommand = exports.registerCustomerCommand = exports.registerExitOverride = exports.registerCommandChecker = exports.createCustomerCommand = exports.getCustomerCommandInfo = exports.getParsedTemplateObj = exports.getCommandDetail = void 0;
|
|
40
|
-
var commander_1 = require("commander");
|
|
41
|
-
var axios_1 = require("axios");
|
|
42
|
-
var logger_1 = require("./logger");
|
|
43
|
-
var storage = require("./storage");
|
|
44
|
-
var check_version_1 = require("./check-version");
|
|
45
|
-
var parse_1 = require("./parse");
|
|
46
|
-
var fs = require("fs-extra");
|
|
47
|
-
var os = require("os");
|
|
48
|
-
var command_1 = require("../command");
|
|
49
|
-
var BASE_API_URL = 'https://tool.serverlessfans.com';
|
|
50
|
-
var COMMAND_DESC_URL = '/api/package/command';
|
|
51
|
-
function getCommandDetail(name, provider, version) {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
-
var url, command_list, result, command_2, e_1;
|
|
54
|
-
return __generator(this, function (_a) {
|
|
55
|
-
switch (_a.label) {
|
|
56
|
-
case 0:
|
|
57
|
-
url = "" + BASE_API_URL + COMMAND_DESC_URL;
|
|
58
|
-
command_list = [];
|
|
59
|
-
_a.label = 1;
|
|
60
|
-
case 1:
|
|
61
|
-
_a.trys.push([1, 3, , 4]);
|
|
62
|
-
return [4 /*yield*/, axios_1.default.get(url, {
|
|
63
|
-
params: {
|
|
64
|
-
name: name, provider: provider, version: version
|
|
65
|
-
}
|
|
66
|
-
})];
|
|
67
|
-
case 2:
|
|
68
|
-
result = _a.sent();
|
|
69
|
-
if (result.data && result.data.Response) {
|
|
70
|
-
command_2 = result.data.Response.Command || {};
|
|
71
|
-
command_list = Object.keys(command_2).map(function (key) {
|
|
72
|
-
return {
|
|
73
|
-
name: key,
|
|
74
|
-
desc: command_2[key]
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return [3 /*break*/, 4];
|
|
79
|
-
case 3:
|
|
80
|
-
e_1 = _a.sent();
|
|
81
|
-
logger_1.default.error(e_1.message);
|
|
82
|
-
return [3 /*break*/, 4];
|
|
83
|
-
case 4: return [2 /*return*/, command_list];
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
exports.getCommandDetail = getCommandDetail;
|
|
89
|
-
function getParsedTemplateObj(templateFile) {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
91
|
-
var parse, parsedObj;
|
|
92
|
-
return __generator(this, function (_a) {
|
|
93
|
-
switch (_a.label) {
|
|
94
|
-
case 0:
|
|
95
|
-
parse = new parse_1.Parse(templateFile);
|
|
96
|
-
parsedObj = parse.getOriginalParsedObj();
|
|
97
|
-
return [4 /*yield*/, parse.getRealVariables(parsedObj)];
|
|
98
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
exports.getParsedTemplateObj = getParsedTemplateObj;
|
|
104
|
-
function getCustomerCommandInfo(parsedTemplateObj) {
|
|
105
|
-
return Object.keys(parsedTemplateObj).filter(function (key) { return key !== 'Global'; });
|
|
106
|
-
}
|
|
107
|
-
exports.getCustomerCommandInfo = getCustomerCommandInfo;
|
|
108
|
-
function createCustomerCommand(templateFile) {
|
|
109
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
-
var customerCommands, doc, commandListPromise, commondListDetail;
|
|
111
|
-
var _this = this;
|
|
112
|
-
return __generator(this, function (_a) {
|
|
113
|
-
switch (_a.label) {
|
|
114
|
-
case 0:
|
|
115
|
-
customerCommands = [];
|
|
116
|
-
return [4 /*yield*/, getParsedTemplateObj(templateFile)];
|
|
117
|
-
case 1:
|
|
118
|
-
doc = _a.sent();
|
|
119
|
-
commandListPromise = getCustomerCommandInfo(doc).map(function (projectName) { return __awaiter(_this, void 0, void 0, function () {
|
|
120
|
-
var projectDocDetail, Provider, Component, commandList;
|
|
121
|
-
return __generator(this, function (_a) {
|
|
122
|
-
switch (_a.label) {
|
|
123
|
-
case 0:
|
|
124
|
-
projectDocDetail = doc[projectName];
|
|
125
|
-
Provider = projectDocDetail.Provider, Component = projectDocDetail.Component;
|
|
126
|
-
return [4 /*yield*/, getCommandDetail(Component, Provider, '')];
|
|
127
|
-
case 1:
|
|
128
|
-
commandList = _a.sent();
|
|
129
|
-
return [2 /*return*/, { projectName: projectName, commandList: commandList, projectDocDetail: projectDocDetail }];
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}); });
|
|
133
|
-
return [4 /*yield*/, Promise.all(commandListPromise)];
|
|
134
|
-
case 2:
|
|
135
|
-
commondListDetail = _a.sent();
|
|
136
|
-
commondListDetail.forEach(function (_a) {
|
|
137
|
-
var projectName = _a.projectName, commandList = _a.commandList, projectDocDetail = _a.projectDocDetail;
|
|
138
|
-
var customerCommand = new commander_1.Command(projectName);
|
|
139
|
-
commandList.forEach(function (command) { return __awaiter(_this, void 0, void 0, function () {
|
|
140
|
-
var commandName, desc, universialCommandInstance;
|
|
141
|
-
return __generator(this, function (_a) {
|
|
142
|
-
switch (_a.label) {
|
|
143
|
-
case 0:
|
|
144
|
-
commandName = command.name, desc = command.desc;
|
|
145
|
-
return [4 /*yield*/, command_1.default(commandName, projectName, desc)];
|
|
146
|
-
case 1:
|
|
147
|
-
universialCommandInstance = _a.sent();
|
|
148
|
-
customerCommand.addCommand(universialCommandInstance);
|
|
149
|
-
return [2 /*return*/];
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}); });
|
|
153
|
-
customerCommands.push(customerCommand);
|
|
154
|
-
});
|
|
155
|
-
return [2 /*return*/, customerCommands];
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
exports.createCustomerCommand = createCustomerCommand;
|
|
161
|
-
function registerCommandChecker(program) {
|
|
162
|
-
program.on('command:*', function (cmds) {
|
|
163
|
-
var commands = program.commands.map(function (command) { return command.name(); });
|
|
164
|
-
if (!commands.includes(cmds[0])) {
|
|
165
|
-
logger_1.default.error(" error: unknown command " + cmds[0]);
|
|
166
|
-
logger_1.default.error();
|
|
167
|
-
program.help();
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
exports.registerCommandChecker = registerCommandChecker;
|
|
172
|
-
function registerExitOverride(program) {
|
|
173
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
-
var checkVersion;
|
|
175
|
-
var _this = this;
|
|
176
|
-
return __generator(this, function (_a) {
|
|
177
|
-
switch (_a.label) {
|
|
178
|
-
case 0:
|
|
179
|
-
checkVersion = new check_version_1.CheckVersion();
|
|
180
|
-
return [4 /*yield*/, checkVersion.init()];
|
|
181
|
-
case 1:
|
|
182
|
-
_a.sent();
|
|
183
|
-
program.exitOverride(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
184
|
-
return __generator(this, function (_a) {
|
|
185
|
-
checkVersion.showMessage();
|
|
186
|
-
return [2 /*return*/];
|
|
187
|
-
});
|
|
188
|
-
}); });
|
|
189
|
-
return [2 /*return*/];
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
exports.registerExitOverride = registerExitOverride;
|
|
195
|
-
function registerCustomerCommand(system_command, templateFile) {
|
|
196
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
197
|
-
var customerCommands;
|
|
198
|
-
return __generator(this, function (_a) {
|
|
199
|
-
switch (_a.label) {
|
|
200
|
-
case 0:
|
|
201
|
-
if (!templateFile) return [3 /*break*/, 2];
|
|
202
|
-
return [4 /*yield*/, createCustomerCommand(templateFile)];
|
|
203
|
-
case 1:
|
|
204
|
-
customerCommands = _a.sent();
|
|
205
|
-
customerCommands.forEach(function (command) {
|
|
206
|
-
system_command.addCommand(command);
|
|
207
|
-
});
|
|
208
|
-
_a.label = 2;
|
|
209
|
-
case 2: return [2 /*return*/];
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
exports.registerCustomerCommand = registerCustomerCommand;
|
|
215
|
-
function regiserUniversalCommand(system_command, templateFile) {
|
|
216
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
217
|
-
var parsedTemplateObj, customerCommands;
|
|
218
|
-
return __generator(this, function (_a) {
|
|
219
|
-
switch (_a.label) {
|
|
220
|
-
case 0:
|
|
221
|
-
if (!templateFile) return [3 /*break*/, 2];
|
|
222
|
-
return [4 /*yield*/, getParsedTemplateObj(templateFile)];
|
|
223
|
-
case 1:
|
|
224
|
-
parsedTemplateObj = _a.sent();
|
|
225
|
-
customerCommands = getCustomerCommandInfo(parsedTemplateObj);
|
|
226
|
-
if (process.argv[2] && !customerCommands.includes(process.argv[2])) {
|
|
227
|
-
system_command.addCommand(command_1.default(process.argv[2]));
|
|
228
|
-
}
|
|
229
|
-
else if (process.argv[2] && customerCommands.includes(process.argv[2]) && process.argv[3] && !customerCommands.includes(process.argv[3])) {
|
|
230
|
-
system_command.addCommand(command_1.default(process.argv[3]));
|
|
231
|
-
}
|
|
232
|
-
_a.label = 2;
|
|
233
|
-
case 2: return [2 /*return*/];
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
exports.regiserUniversalCommand = regiserUniversalCommand;
|
|
239
|
-
function registerVerbose(program) {
|
|
240
|
-
if (process.argv.includes('--verbose')) {
|
|
241
|
-
process.env.VERBOSE = program.verbose;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
exports.registerVerbose = registerVerbose;
|
|
245
|
-
function recordCommandHistory(argv) {
|
|
246
|
-
var file = storage.getHistoryFile();
|
|
247
|
-
fs.appendFileSync(file, argv.join(',') + os.EOL);
|
|
248
|
-
}
|
|
249
|
-
exports.recordCommandHistory = recordCommandHistory;
|
|
250
|
-
exports.default = registerCommandChecker;
|
|
251
|
-
//# sourceMappingURL=command.js.map
|
package/lib/utils/command.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/utils/command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAkC;AAClC,+BAA0B;AAC1B,mCAA8B;AAC9B,mCAAqC;AACrC,iDAA6C;AAC7C,iCAA8B;AAC9B,6BAA+B;AAC/B,uBAAyB;AACzB,sCAAgD;AAEhD,IAAM,YAAY,GAAG,iCAAiC,CAAC;AACvD,IAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAChD,SAAsB,gBAAgB,CAAC,IAAS,EAAE,QAAa,EAAE,OAAW;;;;;;oBACpE,GAAG,GAAQ,KAAG,YAAY,GAAG,gBAAkB,CAAC;oBAClD,YAAY,GAAQ,EAAE,CAAC;;;;oBAEL,qBAAM,eAAK,CAAC,GAAG,CAAC,GAAG,EAAE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AAM,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,SAAM,UAM1C"}
|
package/lib/utils/common.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.printn = exports.checkTemplateFile = exports.checkAndReturnTemplateFile = void 0;
|
|
4
|
-
var path = require('path');
|
|
5
|
-
var fs = require('fs');
|
|
6
|
-
function checkAndReturnTemplateFile() {
|
|
7
|
-
var currentDir = process.cwd();
|
|
8
|
-
var index = process.argv.indexOf('-t') || process.argv.indexOf('--template');
|
|
9
|
-
if (index !== -1) {
|
|
10
|
-
var tempFileIndex = index + 1;
|
|
11
|
-
var tempFileName = process.argv[tempFileIndex];
|
|
12
|
-
if (tempFileName) {
|
|
13
|
-
if (tempFileName.endsWith('.yaml') || tempFileName.endsWith('.yml')) {
|
|
14
|
-
if (fs.existsSync(path.join(currentDir, tempFileName))) {
|
|
15
|
-
process.argv.splice(index, 2);
|
|
16
|
-
return path.join(currentDir, tempFileName);
|
|
17
|
-
}
|
|
18
|
-
else if (fs.existsSync(tempFileName)) {
|
|
19
|
-
process.argv.splice(index, 2);
|
|
20
|
-
return tempFileName;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (fs.existsSync(path.join(currentDir, 'template.yaml'))) {
|
|
26
|
-
return path.join(currentDir, 'template.yaml');
|
|
27
|
-
}
|
|
28
|
-
if (fs.existsSync(path.join(currentDir, 'template.yml'))) {
|
|
29
|
-
return path.join(currentDir, 'template.yml');
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
exports.checkAndReturnTemplateFile = checkAndReturnTemplateFile;
|
|
34
|
-
function checkTemplateFile(templateFile) {
|
|
35
|
-
if (fs.existsSync(templateFile)) {
|
|
36
|
-
return templateFile;
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
exports.checkTemplateFile = checkTemplateFile;
|
|
41
|
-
function printn(n, str) {
|
|
42
|
-
if (str === void 0) { str = ' '; }
|
|
43
|
-
var temp_str = '';
|
|
44
|
-
for (var i = 0; i < n; i++) {
|
|
45
|
-
temp_str = temp_str + str;
|
|
46
|
-
}
|
|
47
|
-
return temp_str;
|
|
48
|
-
}
|
|
49
|
-
exports.printn = printn;
|
|
50
|
-
//# sourceMappingURL=common.js.map
|
package/lib/utils/common.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":";;;AAAA,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAIzB,SAAgB,0BAA0B;IACxC,IAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACjC,IAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/E,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;QAChB,IAAM,aAAa,GAAG,KAAK,GAAG,CAAC,CAAC;QAChC,IAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjD,IAAI,YAAY,EAAE;YAChB,IAAI,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;gBACnE,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,EAAE;oBACtD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;iBAC5C;qBAAM,IAAI,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;oBACtC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;oBAC9B,OAAO,YAAY,CAAC;iBACrB;aACF;SACF;KACF;IACD,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,EAAE;QACzD,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;KAC/C;IACD,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE;QACxD,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;KAC9C;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAzBD,gEAyBC;AAED,SAAgB,iBAAiB,CAAC,YAAoB;IACpD,IAAI,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;QAC/B,OAAO,YAAY,CAAC;KACrB;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AALD,8CAKC;AAGD,SAAgB,MAAM,CAAC,CAAS,EAAE,GAAS;IAAT,oBAAA,EAAA,SAAS;IACzC,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAC,CAAC,GAAG,CAAC,EAAC,CAAC,EAAE,EAAE;QACxB,QAAQ,GAAG,QAAQ,GAAG,GAAG,CAAC;KAC3B;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAND,wBAMC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import * as URL from 'url';
|
|
3
|
-
import * as download from 'download';
|
|
4
|
-
import { PackageType } from '../utils/package-type';
|
|
5
|
-
import { RepoTemplate } from './repo-template-entity';
|
|
6
|
-
export declare class DownloadManager {
|
|
7
|
-
constructor();
|
|
8
|
-
/**
|
|
9
|
-
* Download template from app center
|
|
10
|
-
* @param packageType: package type, such as application, component or plugin
|
|
11
|
-
* @param packageName: package name
|
|
12
|
-
* @param outputDir: outputDir
|
|
13
|
-
* @param provider: package provider, will promopt if not given
|
|
14
|
-
*/
|
|
15
|
-
downloadTemplateFromAppCenter(packageType: PackageType, packageName: string, outputDir: string, provider?: string): Promise<void>;
|
|
16
|
-
downloadTemplateByUrl(template: RepoTemplate, outputDir: string): Promise<void>;
|
|
17
|
-
downloadTemplateByGitClone(url: URL.Url, outputDir: string): Promise<void>;
|
|
18
|
-
private getPackageProvider;
|
|
19
|
-
private getPackageDownloadUrl;
|
|
20
|
-
private generateUUID;
|
|
21
|
-
proxyDownload(url: string, dest: string, options: download.DownloadOptions): Promise<void>;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=download-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"download-manager.d.ts","sourceRoot":"","sources":["../../src/utils/download-manager.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAE3B,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AASrC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAStD,qBAAa,eAAe;;IAK1B;;;;;;SAMK;IACC,6BAA6B,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAuBjH,qBAAqB,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM;IAkB/D,0BAA0B,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM;YAUlD,kBAAkB;YAiDlB,qBAAqB;IA2BnC,OAAO,CAAC,YAAY;IAId,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,eAAe;CA+BjF"}
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.DownloadManager = void 0;
|
|
40
|
-
var path = require("path");
|
|
41
|
-
var download = require("download");
|
|
42
|
-
var os = require("os");
|
|
43
|
-
var fs = require("fs-extra");
|
|
44
|
-
var axios_1 = require("axios");
|
|
45
|
-
var inquirer = require("inquirer");
|
|
46
|
-
var init_error_1 = require("../error/init-error");
|
|
47
|
-
var ChildProcess = require("child_process");
|
|
48
|
-
var util = require("util");
|
|
49
|
-
var logger_1 = require("../utils/logger");
|
|
50
|
-
var package_type_1 = require("../utils/package-type");
|
|
51
|
-
var i18n_1 = require("./i18n");
|
|
52
|
-
var static_variable_1 = require("../constants/static-variable");
|
|
53
|
-
// eslint-disable-next-line no-unused-vars
|
|
54
|
-
var s_progress_bar_1 = require("@serverless-devs/s-progress-bar");
|
|
55
|
-
var got = require('got');
|
|
56
|
-
var colors_1 = require("colors");
|
|
57
|
-
var DownloadManager = /** @class */ (function () {
|
|
58
|
-
function DownloadManager() {
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Download template from app center
|
|
62
|
-
* @param packageType: package type, such as application, component or plugin
|
|
63
|
-
* @param packageName: package name
|
|
64
|
-
* @param outputDir: outputDir
|
|
65
|
-
* @param provider: package provider, will promopt if not given
|
|
66
|
-
*/
|
|
67
|
-
DownloadManager.prototype.downloadTemplateFromAppCenter = function (packageType, packageName, outputDir, provider) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
var err_1, url, err_2;
|
|
70
|
-
return __generator(this, function (_a) {
|
|
71
|
-
switch (_a.label) {
|
|
72
|
-
case 0:
|
|
73
|
-
if (!(packageType !== package_type_1.PackageType.plugin && !provider)) return [3 /*break*/, 4];
|
|
74
|
-
_a.label = 1;
|
|
75
|
-
case 1:
|
|
76
|
-
_a.trys.push([1, 3, , 4]);
|
|
77
|
-
return [4 /*yield*/, this.getPackageProvider(packageType, packageName)];
|
|
78
|
-
case 2:
|
|
79
|
-
provider = _a.sent();
|
|
80
|
-
logger_1.default.info(' Init Information:');
|
|
81
|
-
logger_1.default.info(i18n_1.default.__(" Package: {{package}} Provider: {{provider}}", { 'package': packageName, 'provider': provider }));
|
|
82
|
-
return [3 /*break*/, 4];
|
|
83
|
-
case 3:
|
|
84
|
-
err_1 = _a.sent();
|
|
85
|
-
throw new init_error_1.InitError(err_1.message);
|
|
86
|
-
case 4:
|
|
87
|
-
_a.trys.push([4, 7, , 8]);
|
|
88
|
-
return [4 /*yield*/, this.getPackageDownloadUrl(packageType, packageName, provider)];
|
|
89
|
-
case 5:
|
|
90
|
-
url = _a.sent();
|
|
91
|
-
return [4 /*yield*/, this.downloadTemplateByUrl({
|
|
92
|
-
zipFile: url,
|
|
93
|
-
hasSubPath: false
|
|
94
|
-
}, outputDir)];
|
|
95
|
-
case 6:
|
|
96
|
-
_a.sent();
|
|
97
|
-
return [3 /*break*/, 8];
|
|
98
|
-
case 7:
|
|
99
|
-
err_2 = _a.sent();
|
|
100
|
-
throw err_2;
|
|
101
|
-
case 8: return [2 /*return*/];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
DownloadManager.prototype.downloadTemplateByUrl = function (template, outputDir) {
|
|
107
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
-
var uuid, srcDirName, err_3, srcSubDirName, destSubDirName;
|
|
109
|
-
return __generator(this, function (_a) {
|
|
110
|
-
switch (_a.label) {
|
|
111
|
-
case 0:
|
|
112
|
-
uuid = this.generateUUID();
|
|
113
|
-
srcDirName = path.join(os.tmpdir(), "" + uuid);
|
|
114
|
-
_a.label = 1;
|
|
115
|
-
case 1:
|
|
116
|
-
_a.trys.push([1, 3, , 4]);
|
|
117
|
-
return [4 /*yield*/, this.proxyDownload(template.zipFile, srcDirName, { extract: true, strip: 1 })];
|
|
118
|
-
case 2:
|
|
119
|
-
_a.sent();
|
|
120
|
-
return [3 /*break*/, 4];
|
|
121
|
-
case 3:
|
|
122
|
-
err_3 = _a.sent();
|
|
123
|
-
throw new init_error_1.InitError('Download template by url failed, error: {{msg}}', { msg: err_3.message });
|
|
124
|
-
case 4:
|
|
125
|
-
if (!template.hasSubPath) {
|
|
126
|
-
fs.copySync(srcDirName, outputDir, { dereference: true });
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
srcSubDirName = path.join(srcDirName, template.subPath || '');
|
|
130
|
-
destSubDirName = path.join(outputDir, template.subPath || '');
|
|
131
|
-
fs.copySync(srcSubDirName, destSubDirName, { dereference: true });
|
|
132
|
-
}
|
|
133
|
-
return [2 /*return*/];
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
DownloadManager.prototype.downloadTemplateByGitClone = function (url, outputDir) {
|
|
139
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
-
var cmd, exec, err_4;
|
|
141
|
-
return __generator(this, function (_a) {
|
|
142
|
-
switch (_a.label) {
|
|
143
|
-
case 0:
|
|
144
|
-
cmd = "git clone " + url.href + " " + outputDir;
|
|
145
|
-
exec = util.promisify(ChildProcess.exec);
|
|
146
|
-
_a.label = 1;
|
|
147
|
-
case 1:
|
|
148
|
-
_a.trys.push([1, 3, , 4]);
|
|
149
|
-
return [4 /*yield*/, exec(cmd)];
|
|
150
|
-
case 2:
|
|
151
|
-
_a.sent();
|
|
152
|
-
return [3 /*break*/, 4];
|
|
153
|
-
case 3:
|
|
154
|
-
err_4 = _a.sent();
|
|
155
|
-
throw err_4;
|
|
156
|
-
case 4: return [2 /*return*/];
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
DownloadManager.prototype.getPackageProvider = function (packageType, project) {
|
|
162
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
163
|
-
var options, result, err_5, providers, provider_1;
|
|
164
|
-
return __generator(this, function (_a) {
|
|
165
|
-
switch (_a.label) {
|
|
166
|
-
case 0:
|
|
167
|
-
options = {
|
|
168
|
-
url: static_variable_1.SERVERLESS_GET_PACKAGE_PROVIDER,
|
|
169
|
-
type: 'get',
|
|
170
|
-
timeout: 5000,
|
|
171
|
-
headers: {},
|
|
172
|
-
params: {
|
|
173
|
-
name: project,
|
|
174
|
-
type: package_type_1.PackageType[packageType]
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
_a.label = 1;
|
|
178
|
-
case 1:
|
|
179
|
-
_a.trys.push([1, 3, , 4]);
|
|
180
|
-
return [4 /*yield*/, axios_1.default.request(options)];
|
|
181
|
-
case 2:
|
|
182
|
-
result = _a.sent();
|
|
183
|
-
return [3 /*break*/, 4];
|
|
184
|
-
case 3:
|
|
185
|
-
err_5 = _a.sent();
|
|
186
|
-
throw new init_error_1.InitError('Failed to get package provider, error: {{msg}}', { msg: err_5.message });
|
|
187
|
-
case 4:
|
|
188
|
-
if (result.status !== 200) {
|
|
189
|
-
throw new init_error_1.InitError('Failed to get package provider, http code: {{code}}', { code: result.status });
|
|
190
|
-
}
|
|
191
|
-
if (result.data.Error) {
|
|
192
|
-
throw new init_error_1.InitError('Failed to get package provider, error message: {{msg}}', { msg: result.data.Error });
|
|
193
|
-
}
|
|
194
|
-
providers = result.data.Response.Providers;
|
|
195
|
-
if (!providers || providers.length === 0) {
|
|
196
|
-
throw new init_error_1.InitError('No available provider for {{project}}', { project: project });
|
|
197
|
-
}
|
|
198
|
-
if (!(providers.length === 0)) return [3 /*break*/, 5];
|
|
199
|
-
throw new init_error_1.InitError('Could not get package.');
|
|
200
|
-
case 5:
|
|
201
|
-
if (!(providers.length === 1)) return [3 /*break*/, 6];
|
|
202
|
-
return [2 /*return*/, providers[0]];
|
|
203
|
-
case 6: return [4 /*yield*/, inquirer.prompt([
|
|
204
|
-
{
|
|
205
|
-
type: 'list',
|
|
206
|
-
name: 'provider',
|
|
207
|
-
message: i18n_1.default.__('Please choose a provider'),
|
|
208
|
-
choices: providers
|
|
209
|
-
}
|
|
210
|
-
])];
|
|
211
|
-
case 7:
|
|
212
|
-
provider_1 = (_a.sent()).provider;
|
|
213
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
214
|
-
resolve(provider_1);
|
|
215
|
-
})];
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
|
-
DownloadManager.prototype.getPackageDownloadUrl = function (packageType, packageName, provider) {
|
|
221
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
222
|
-
var options, result;
|
|
223
|
-
return __generator(this, function (_a) {
|
|
224
|
-
switch (_a.label) {
|
|
225
|
-
case 0:
|
|
226
|
-
options = {
|
|
227
|
-
url: static_variable_1.SERVERLESS_GET_APP_INFO_URL,
|
|
228
|
-
type: 'get',
|
|
229
|
-
timeout: 5000,
|
|
230
|
-
headers: {
|
|
231
|
-
'User-Agent': 's'
|
|
232
|
-
},
|
|
233
|
-
params: {
|
|
234
|
-
name: packageName,
|
|
235
|
-
provider: provider,
|
|
236
|
-
type: package_type_1.PackageType[packageType]
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
return [4 /*yield*/, axios_1.default.request(options)];
|
|
240
|
-
case 1:
|
|
241
|
-
result = _a.sent();
|
|
242
|
-
if (result.status !== 200) {
|
|
243
|
-
throw new init_error_1.InitError('Failed to get package information, http code: {{code}}', { code: result.status });
|
|
244
|
-
}
|
|
245
|
-
if (!result.data.Response) {
|
|
246
|
-
throw new init_error_1.InitError('Failed to get package information, error: {{msg}}', { msg: result.data.Response || i18n_1.default.__('Please try again later') });
|
|
247
|
-
}
|
|
248
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
249
|
-
resolve(result.data.Response.Url);
|
|
250
|
-
})];
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
};
|
|
255
|
-
DownloadManager.prototype.generateUUID = function () {
|
|
256
|
-
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
257
|
-
};
|
|
258
|
-
DownloadManager.prototype.proxyDownload = function (url, dest, options) {
|
|
259
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
260
|
-
var len, headers, err_6, bar, pbo, pbo, format;
|
|
261
|
-
return __generator(this, function (_a) {
|
|
262
|
-
switch (_a.label) {
|
|
263
|
-
case 0:
|
|
264
|
-
_a.trys.push([0, 2, , 3]);
|
|
265
|
-
return [4 /*yield*/, got(url, { method: 'HEAD' })];
|
|
266
|
-
case 1:
|
|
267
|
-
headers = (_a.sent()).headers;
|
|
268
|
-
len = parseInt(headers['content-length'], 10);
|
|
269
|
-
return [3 /*break*/, 3];
|
|
270
|
-
case 2:
|
|
271
|
-
err_6 = _a.sent();
|
|
272
|
-
return [3 /*break*/, 3];
|
|
273
|
-
case 3:
|
|
274
|
-
if (len) {
|
|
275
|
-
pbo = {
|
|
276
|
-
total: len
|
|
277
|
-
};
|
|
278
|
-
bar = new s_progress_bar_1.ProgressService(s_progress_bar_1.ProgressType.Bar, pbo);
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
pbo = {
|
|
282
|
-
total: 100,
|
|
283
|
-
width: 0
|
|
284
|
-
};
|
|
285
|
-
format = colors_1.green(':loading') + " " + colors_1.green(i18n_1.default.__('Downloading ...')) + " ";
|
|
286
|
-
bar = new s_progress_bar_1.ProgressService(s_progress_bar_1.ProgressType.Loading, pbo, format);
|
|
287
|
-
}
|
|
288
|
-
return [4 /*yield*/, download(url, dest, options).on('downloadProgress', function (progress) {
|
|
289
|
-
bar.update(progress.transferred);
|
|
290
|
-
})];
|
|
291
|
-
case 4:
|
|
292
|
-
_a.sent();
|
|
293
|
-
bar.terminate();
|
|
294
|
-
return [2 /*return*/];
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
};
|
|
299
|
-
return DownloadManager;
|
|
300
|
-
}());
|
|
301
|
-
exports.DownloadManager = DownloadManager;
|
|
302
|
-
//# sourceMappingURL=download-manager.js.map
|