@serverless-devs/s 0.0.44 → 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,176 +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.PlatformLoginManager = void 0;
|
|
40
|
-
var inquirer = require('inquirer');
|
|
41
|
-
var axios_1 = require("axios");
|
|
42
|
-
var fs = require("fs-extra");
|
|
43
|
-
var os = require("os");
|
|
44
|
-
var path = require("path");
|
|
45
|
-
var logger_1 = require("../../utils/logger");
|
|
46
|
-
var login_error_1 = require("../../error/login-error");
|
|
47
|
-
var static_variable_1 = require("../../constants/static-variable");
|
|
48
|
-
var gui_service_1 = require("../../gui/gui-service");
|
|
49
|
-
var i18n_1 = require("../../utils/i18n");
|
|
50
|
-
var CONFIG_COMMAND_MAP = {
|
|
51
|
-
username: {
|
|
52
|
-
type: 'input',
|
|
53
|
-
message: i18n_1.default.__('Please input username'),
|
|
54
|
-
name: 'username',
|
|
55
|
-
default: '' // 默认值
|
|
56
|
-
},
|
|
57
|
-
password: {
|
|
58
|
-
type: 'password',
|
|
59
|
-
message: i18n_1.default.__('Please input password'),
|
|
60
|
-
name: 'password',
|
|
61
|
-
default: '' // 默认值
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
var PlatformLoginManager = /** @class */ (function () {
|
|
65
|
-
function PlatformLoginManager() {
|
|
66
|
-
}
|
|
67
|
-
PlatformLoginManager.prototype.init = function (context) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
var username, password, gui, guiService, promptList_1, _a, username_1, password_1, password_2;
|
|
70
|
-
return __generator(this, function (_b) {
|
|
71
|
-
switch (_b.label) {
|
|
72
|
-
case 0:
|
|
73
|
-
username = context.username, password = context.password, gui = context.gui;
|
|
74
|
-
if (gui) {
|
|
75
|
-
guiService = new gui_service_1.default('/login');
|
|
76
|
-
guiService.start();
|
|
77
|
-
return [2 /*return*/];
|
|
78
|
-
}
|
|
79
|
-
if (!(username && password)) return [3 /*break*/, 2];
|
|
80
|
-
return [4 /*yield*/, this.login(context)];
|
|
81
|
-
case 1:
|
|
82
|
-
_b.sent();
|
|
83
|
-
return [3 /*break*/, 8];
|
|
84
|
-
case 2:
|
|
85
|
-
promptList_1 = [];
|
|
86
|
-
if (!(!username && !password)) return [3 /*break*/, 5];
|
|
87
|
-
Object.keys(CONFIG_COMMAND_MAP).forEach(function (key) {
|
|
88
|
-
promptList_1.push(CONFIG_COMMAND_MAP[key]);
|
|
89
|
-
});
|
|
90
|
-
return [4 /*yield*/, inquirer.prompt(promptList_1)];
|
|
91
|
-
case 3:
|
|
92
|
-
_a = _b.sent(), username_1 = _a.username, password_1 = _a.password;
|
|
93
|
-
return [4 /*yield*/, this.login({ username: username_1, password: password_1 })];
|
|
94
|
-
case 4:
|
|
95
|
-
_b.sent();
|
|
96
|
-
return [3 /*break*/, 8];
|
|
97
|
-
case 5:
|
|
98
|
-
if (!(username && !password)) return [3 /*break*/, 8];
|
|
99
|
-
promptList_1.push(CONFIG_COMMAND_MAP.password);
|
|
100
|
-
return [4 /*yield*/, inquirer.prompt(promptList_1)];
|
|
101
|
-
case 6:
|
|
102
|
-
password_2 = (_b.sent()).password;
|
|
103
|
-
return [4 /*yield*/, this.login({ username: username, password: password_2 })];
|
|
104
|
-
case 7:
|
|
105
|
-
_b.sent();
|
|
106
|
-
_b.label = 8;
|
|
107
|
-
case 8: return [2 /*return*/];
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
PlatformLoginManager.prototype.login = function (loginData) {
|
|
113
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
-
var options, result, err_1, token, tokenFile;
|
|
115
|
-
return __generator(this, function (_a) {
|
|
116
|
-
switch (_a.label) {
|
|
117
|
-
case 0:
|
|
118
|
-
logger_1.default.info('In operation......');
|
|
119
|
-
options = {
|
|
120
|
-
// url: LOGIN_URL,
|
|
121
|
-
// type: 'post',
|
|
122
|
-
timeout: 5000,
|
|
123
|
-
headers: {
|
|
124
|
-
'User-Agent': 's'
|
|
125
|
-
}
|
|
126
|
-
// data: loginData
|
|
127
|
-
};
|
|
128
|
-
_a.label = 1;
|
|
129
|
-
case 1:
|
|
130
|
-
_a.trys.push([1, 3, , 4]);
|
|
131
|
-
return [4 /*yield*/, axios_1.default.post(static_variable_1.SERVERLESS_LOGIN_URL, { username: loginData.username, password: loginData.password }, options)];
|
|
132
|
-
case 2:
|
|
133
|
-
result = _a.sent();
|
|
134
|
-
return [3 /*break*/, 4];
|
|
135
|
-
case 3:
|
|
136
|
-
err_1 = _a.sent();
|
|
137
|
-
throw new login_error_1.LoginError('Failed to login, error: {{error}}', { error: err_1.message });
|
|
138
|
-
case 4:
|
|
139
|
-
if (result.status !== 200) {
|
|
140
|
-
throw new login_error_1.LoginError('Failed to login, http code: {{code}}', { code: result.status });
|
|
141
|
-
}
|
|
142
|
-
if (result.data.Error) {
|
|
143
|
-
throw new login_error_1.LoginError('Failed to login, code: {{code}}, message: {{msg}}', { code: result.data.Error.Code, msg: result.data.Error.Message });
|
|
144
|
-
}
|
|
145
|
-
token = result.data.Response.Code;
|
|
146
|
-
if (!fs.existsSync(this.getTokenDir())) {
|
|
147
|
-
fs.mkdirSync(this.getTokenDir());
|
|
148
|
-
}
|
|
149
|
-
tokenFile = this.getTokenFile();
|
|
150
|
-
if (fs.existsSync(tokenFile)) {
|
|
151
|
-
fs.removeSync(tokenFile);
|
|
152
|
-
}
|
|
153
|
-
fs.writeFileSync(tokenFile, token);
|
|
154
|
-
logger_1.default.success('Login information obtained successfully.');
|
|
155
|
-
return [2 /*return*/];
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
PlatformLoginManager.prototype.isCurrentLogin = function () {
|
|
161
|
-
return fs.existsSync(this.getTokenFile());
|
|
162
|
-
};
|
|
163
|
-
PlatformLoginManager.prototype.getLoginToken = function () {
|
|
164
|
-
return fs.readFileSync(this.getTokenFile(), 'utf-8');
|
|
165
|
-
};
|
|
166
|
-
PlatformLoginManager.prototype.getTokenFile = function () {
|
|
167
|
-
var dir = this.getTokenDir();
|
|
168
|
-
return path.join(dir, 'login-token');
|
|
169
|
-
};
|
|
170
|
-
PlatformLoginManager.prototype.getTokenDir = function () {
|
|
171
|
-
return path.join(os.homedir(), '.s');
|
|
172
|
-
};
|
|
173
|
-
return PlatformLoginManager;
|
|
174
|
-
}());
|
|
175
|
-
exports.PlatformLoginManager = PlatformLoginManager;
|
|
176
|
-
//# sourceMappingURL=login-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"login-manager.js","sourceRoot":"","sources":["../../../src/platform/login/login-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACrC,+BAA0B;AAC1B,6BAA+B;AAC/B,uBAAyB;AACzB,2BAA6B;AAE7B,6CAAwC;AACxC,uDAAqD;AACrD,mEAAuE;AACvE,qDAA+C;AAC/C,yCAAoC;AA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
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/publish/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,93 +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
|
-
var program = require("commander");
|
|
40
|
-
var fs = require("fs-extra");
|
|
41
|
-
var i18n_1 = require("../../utils/i18n");
|
|
42
|
-
var platform_publish_manager_1 = require("./platform-publish-manager");
|
|
43
|
-
var login_manager_1 = require("../login/login-manager");
|
|
44
|
-
var gui_service_1 = require("../../gui/gui-service");
|
|
45
|
-
var platform_publish_error_1 = require("../../error/platform-publish-error");
|
|
46
|
-
var command_error_1 = require("../../error/command-error");
|
|
47
|
-
var description = " " + i18n_1.default.__('Publish package.') + "\n\n " + i18n_1.default.__('Example') + ":\n $ s platform publish";
|
|
48
|
-
program
|
|
49
|
-
.name('s platform publish')
|
|
50
|
-
.option('-g, --gui', i18n_1.default.__('Start gui service'))
|
|
51
|
-
// .option('-s, --skip', i18n.__('Skip the update configuration information step and publish directly'))
|
|
52
|
-
.description(description)
|
|
53
|
-
.helpOption('-h, --help', i18n_1.default.__('Display help for command'))
|
|
54
|
-
.parse(process.argv);
|
|
55
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var gui, guiService, loginManger, token, publishManager, encoding, publish, readme;
|
|
57
|
-
return __generator(this, function (_a) {
|
|
58
|
-
switch (_a.label) {
|
|
59
|
-
case 0:
|
|
60
|
-
gui = program.gui;
|
|
61
|
-
if (gui) {
|
|
62
|
-
guiService = new gui_service_1.default('/publish');
|
|
63
|
-
guiService.start();
|
|
64
|
-
return [2 /*return*/];
|
|
65
|
-
}
|
|
66
|
-
loginManger = new login_manager_1.PlatformLoginManager();
|
|
67
|
-
if (!loginManger.isCurrentLogin()) {
|
|
68
|
-
throw new platform_publish_error_1.PlatformPublishError('Please login in first.');
|
|
69
|
-
}
|
|
70
|
-
token = loginManger.getLoginToken();
|
|
71
|
-
if (!fs.existsSync('publish.yaml')) {
|
|
72
|
-
throw new Error('No publish.yaml exists in current dir.');
|
|
73
|
-
}
|
|
74
|
-
if (!fs.existsSync('readme.md')) {
|
|
75
|
-
throw new Error('No readme exists in current dir.');
|
|
76
|
-
}
|
|
77
|
-
if (!fs.existsSync('src')) {
|
|
78
|
-
throw new Error('No src exists in current dir.');
|
|
79
|
-
}
|
|
80
|
-
publishManager = new platform_publish_manager_1.PlatformPublishManager();
|
|
81
|
-
encoding = 'utf-8';
|
|
82
|
-
publish = fs.readFileSync('publish.yaml', encoding);
|
|
83
|
-
readme = fs.readFileSync('readme.md', encoding);
|
|
84
|
-
return [4 /*yield*/, publishManager.publish(token, publish, readme)];
|
|
85
|
-
case 1:
|
|
86
|
-
_a.sent();
|
|
87
|
-
return [2 /*return*/];
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}); })().catch(function (err) {
|
|
91
|
-
throw new command_error_1.CommandError(err.message);
|
|
92
|
-
});
|
|
93
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/publish/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAqC;AACrC,6BAA+B;AAC/B,y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,+BAA+B,CAAC,CAAC;iBAClD;gBACK,cAAc,GAAG,IAAI,iDAAsB,EAAE,CAAC;gBAC9C,QAAQ,GAAG,OAAO,CAAC;gBACnB,OAAO,GAAW,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;gBAC5D,MAAM,GAAW,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;gBAE9D,qBAAM,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAA;;gBAApD,SAAoD,CAAC;;;;KACtD,CAAC,EAAE,CAAC,KAAK,CAAC,UAAC,GAAG;IACb,MAAM,IAAI,4BAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform-publish-manager.d.ts","sourceRoot":"","sources":["../../../src/platform/publish/platform-publish-manager.ts"],"names":[],"mappings":"AAUA,qBAAa,sBAAsB;IAC3B,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAqD3D,OAAO,CAAC,YAAY;CAIrB"}
|
|
@@ -1,115 +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.PlatformPublishManager = void 0;
|
|
40
|
-
var axios_1 = require("axios");
|
|
41
|
-
var platform_publish_error_1 = require("../../error/platform-publish-error");
|
|
42
|
-
var logger_1 = require("../../utils/logger");
|
|
43
|
-
var path = require("path");
|
|
44
|
-
var os = require("os");
|
|
45
|
-
var Zip = require('adm-zip');
|
|
46
|
-
var PUBLISH_PACKAGE_URL = 'http://tool.serverlessfans.com/api/package/put/object/url';
|
|
47
|
-
var PlatformPublishManager = /** @class */ (function () {
|
|
48
|
-
function PlatformPublishManager() {
|
|
49
|
-
}
|
|
50
|
-
PlatformPublishManager.prototype.publish = function (user, content, readme) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
52
|
-
var zipFile, zipper, result, url, options, uploadResult, err_1;
|
|
53
|
-
return __generator(this, function (_a) {
|
|
54
|
-
switch (_a.label) {
|
|
55
|
-
case 0:
|
|
56
|
-
_a.trys.push([0, 3, , 4]);
|
|
57
|
-
logger_1.default.info('Publishing......');
|
|
58
|
-
zipFile = path.join(os.tmpdir(), this.generateUUID() + '.zip');
|
|
59
|
-
zipper = new Zip();
|
|
60
|
-
zipper.addLocalFolder('src', 'src');
|
|
61
|
-
zipper.writeZip(zipFile);
|
|
62
|
-
return [4 /*yield*/, axios_1.default.post(PUBLISH_PACKAGE_URL, {
|
|
63
|
-
user: user,
|
|
64
|
-
publish: content,
|
|
65
|
-
readme: readme
|
|
66
|
-
})];
|
|
67
|
-
case 1:
|
|
68
|
-
result = _a.sent();
|
|
69
|
-
// eslint-disable-next-line eqeqeq
|
|
70
|
-
if (result.status != 200) {
|
|
71
|
-
throw new Error("Failed to publish package, http status code: " + result.status);
|
|
72
|
-
}
|
|
73
|
-
if (result.data.Error) {
|
|
74
|
-
throw new Error("Failed to publish package, code: " + result.data.Error.Code + ", message: " + result.data.Error.Message);
|
|
75
|
-
}
|
|
76
|
-
url = result.data.Response.Url;
|
|
77
|
-
options = {
|
|
78
|
-
url: url,
|
|
79
|
-
method: 'put',
|
|
80
|
-
timeout: 30 * 60 * 1000,
|
|
81
|
-
headers: {
|
|
82
|
-
'User-Agent': 's'
|
|
83
|
-
},
|
|
84
|
-
data: zipper.toBuffer(),
|
|
85
|
-
maxContentLength: Infinity,
|
|
86
|
-
maxBodyLength: Infinity,
|
|
87
|
-
transformRequest: function (data, headers) {
|
|
88
|
-
delete headers.put;
|
|
89
|
-
return data;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
return [4 /*yield*/, axios_1.default(options)];
|
|
93
|
-
case 2:
|
|
94
|
-
uploadResult = _a.sent();
|
|
95
|
-
// eslint-disable-next-line eqeqeq
|
|
96
|
-
if (uploadResult.status != 200) {
|
|
97
|
-
throw new Error("Failed to upload package, status code is: " + uploadResult.status + ", messge is : " + uploadResult);
|
|
98
|
-
}
|
|
99
|
-
logger_1.default.success('Publish successfully');
|
|
100
|
-
return [3 /*break*/, 4];
|
|
101
|
-
case 3:
|
|
102
|
-
err_1 = _a.sent();
|
|
103
|
-
throw new platform_publish_error_1.PlatformPublishError(err_1.message);
|
|
104
|
-
case 4: return [2 /*return*/];
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
PlatformPublishManager.prototype.generateUUID = function () {
|
|
110
|
-
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
111
|
-
};
|
|
112
|
-
return PlatformPublishManager;
|
|
113
|
-
}());
|
|
114
|
-
exports.PlatformPublishManager = PlatformPublishManager;
|
|
115
|
-
//# sourceMappingURL=platform-publish-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform-publish-manager.js","sourceRoot":"","sources":["../../../src/platform/publish/platform-publish-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAA0B;AAC1B,6EAA0E;AAC1E,6CAAwC;AACxC,2BAA6B;AAC7B,u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E;gCACP,YAAY,EAAE,GAAG;6BAClB;4BACD,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE;4BACvB,gBAAgB,EAAE,QAAQ;4BAC1B,aAAa,EAAE,QAAQ;4BACvB,gBAAgB,EAAE,UAAC,IAAS,EAAE,OAAY;gCACxC,OAAO,OAAO,CAAC,GAAG,CAAC;gCACnB,OAAO,IAAI,CAAC;4BACd,CAAC;yBACF,CAAC;wBAGmB,qBAAM,eAAK,CAAC,OAAO,CAAC,EAAA;;wBAAnC,YAAY,GAAG,SAAoB;wBACzC,kCAAkC;wBAClC,IAAI,YAAY,CAAC,MAAM,IAAI,GAAG,EAAE;4BAC9B,MAAM,IAAI,KAAK,CAAC,+CAA6C,YAAY,CAAC,MAAM,sBAAiB,YAAc,CAAC,CAAC;yBAClH;wBACD,gBAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;;;;wBAEvC,MAAM,IAAI,6CAAoB,CAAC,KAAG,CAAC,OAAO,CAAC,CAAC;;;;;KAE/C;IAEO,6CAAY,GAApB;QACE,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACnG,CAAC;IAEH,6BAAC;AAAD,CAAC,AA1DD,IA0DC;AA1DY,wDAAsB"}
|
package/lib/plugin/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PackageType } from '../utils/package-type';
|
|
2
|
-
export interface PluginConifg {
|
|
3
|
-
name: string;
|
|
4
|
-
}
|
|
5
|
-
export declare class PluginExeCute {
|
|
6
|
-
protected pluginConfig: PluginConifg;
|
|
7
|
-
protected pluginPath: string;
|
|
8
|
-
constructor(pluginConfig: PluginConifg);
|
|
9
|
-
init(): Promise<void>;
|
|
10
|
-
pluginExist(): any;
|
|
11
|
-
getRemotePluginVersion({ name, type }: {
|
|
12
|
-
name: string;
|
|
13
|
-
type: PackageType;
|
|
14
|
-
}): Promise<any>;
|
|
15
|
-
getLocalComponentVersion(): any;
|
|
16
|
-
checkVersion(localVersion: string | null, remoteVersion: string): boolean;
|
|
17
|
-
downLoadPlugin(type: PackageType, name: string): Promise<void>;
|
|
18
|
-
loadPlugin(): Promise<any>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AASpD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,qBAAa,aAAa;IAGZ,SAAS,CAAC,YAAY,EAAE,YAAY;IAFhD,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEP,YAAY,EAAE,YAAY;IAO1C,IAAI;IAcV,WAAW;IAGL,sBAAsB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE;IAqBhF,wBAAwB;IASxB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,EAAE,aAAa,EAAE,MAAM;IAGzD,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAQ9C,UAAU;CAMjB"}
|
package/lib/plugin/index.js
DELETED
|
@@ -1,175 +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
|
-
var _a;
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.PluginExeCute = void 0;
|
|
41
|
-
var fs = require('fs');
|
|
42
|
-
var path = require('path');
|
|
43
|
-
var os = require('os');
|
|
44
|
-
var axios_1 = require("axios");
|
|
45
|
-
var download_manager_1 = require("../utils/download-manager");
|
|
46
|
-
var logger = require("../utils/logger");
|
|
47
|
-
var package_type_1 = require("../utils/package-type");
|
|
48
|
-
var S_PLUGIN_BASE_PATH = path.join(os.homedir(), ".s/plugins");
|
|
49
|
-
var BASE_API_URL = 'https://tool.serverlessfans.com/api';
|
|
50
|
-
var CHECK_VERSION_URL = '/package/object/version';
|
|
51
|
-
var TYPE_MAP = (_a = {},
|
|
52
|
-
_a[package_type_1.PackageType.component] = 'Component',
|
|
53
|
-
_a[package_type_1.PackageType.plugin] = 'Plugin',
|
|
54
|
-
_a[package_type_1.PackageType.application] = 'Application',
|
|
55
|
-
_a);
|
|
56
|
-
var PluginExeCute = /** @class */ (function () {
|
|
57
|
-
function PluginExeCute(pluginConfig) {
|
|
58
|
-
this.pluginConfig = pluginConfig;
|
|
59
|
-
if (!fs.existsSync(S_PLUGIN_BASE_PATH)) {
|
|
60
|
-
fs.mkdirSync(S_PLUGIN_BASE_PATH);
|
|
61
|
-
}
|
|
62
|
-
var name = this.pluginConfig.name;
|
|
63
|
-
this.pluginPath = path.join(S_PLUGIN_BASE_PATH, "/" + name);
|
|
64
|
-
}
|
|
65
|
-
PluginExeCute.prototype.init = function () {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
var name, localVersion, remoteVersion, isSameVersion;
|
|
68
|
-
return __generator(this, function (_a) {
|
|
69
|
-
switch (_a.label) {
|
|
70
|
-
case 0:
|
|
71
|
-
name = this.pluginConfig.name;
|
|
72
|
-
if (!!this.pluginExist()) return [3 /*break*/, 2];
|
|
73
|
-
return [4 /*yield*/, this.downLoadPlugin(package_type_1.PackageType.plugin, name)];
|
|
74
|
-
case 1:
|
|
75
|
-
_a.sent();
|
|
76
|
-
return [3 /*break*/, 5];
|
|
77
|
-
case 2:
|
|
78
|
-
localVersion = this.getLocalComponentVersion();
|
|
79
|
-
return [4 /*yield*/, this.getRemotePluginVersion({ name: name, type: package_type_1.PackageType.plugin })];
|
|
80
|
-
case 3:
|
|
81
|
-
remoteVersion = _a.sent();
|
|
82
|
-
isSameVersion = this.checkVersion(localVersion, remoteVersion);
|
|
83
|
-
if (!!isSameVersion) return [3 /*break*/, 5];
|
|
84
|
-
return [4 /*yield*/, this.downLoadPlugin(package_type_1.PackageType.plugin, name)];
|
|
85
|
-
case 4:
|
|
86
|
-
_a.sent();
|
|
87
|
-
_a.label = 5;
|
|
88
|
-
case 5: return [2 /*return*/];
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
PluginExeCute.prototype.pluginExist = function () {
|
|
94
|
-
return fs.existsSync(this.pluginPath);
|
|
95
|
-
};
|
|
96
|
-
PluginExeCute.prototype.getRemotePluginVersion = function (_a) {
|
|
97
|
-
var name = _a.name, type = _a.type;
|
|
98
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
-
var url, version, result, e_1;
|
|
100
|
-
return __generator(this, function (_b) {
|
|
101
|
-
switch (_b.label) {
|
|
102
|
-
case 0:
|
|
103
|
-
url = "" + BASE_API_URL + CHECK_VERSION_URL;
|
|
104
|
-
version = null;
|
|
105
|
-
_b.label = 1;
|
|
106
|
-
case 1:
|
|
107
|
-
_b.trys.push([1, 3, , 4]);
|
|
108
|
-
return [4 /*yield*/, axios_1.default.get(url, {
|
|
109
|
-
params: {
|
|
110
|
-
name: name,
|
|
111
|
-
type: TYPE_MAP[type]
|
|
112
|
-
}
|
|
113
|
-
})];
|
|
114
|
-
case 2:
|
|
115
|
-
result = _b.sent();
|
|
116
|
-
if (result.data && result.data.Response && result.data.Response.Version) {
|
|
117
|
-
version = result.data.Response.Version;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
// throw new Error("Please Check the plugin name");
|
|
121
|
-
}
|
|
122
|
-
return [3 /*break*/, 4];
|
|
123
|
-
case 3:
|
|
124
|
-
e_1 = _b.sent();
|
|
125
|
-
logger.error(e_1.message);
|
|
126
|
-
return [3 /*break*/, 4];
|
|
127
|
-
case 4: return [2 /*return*/, version];
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
PluginExeCute.prototype.getLocalComponentVersion = function () {
|
|
133
|
-
var name = this.pluginConfig.name;
|
|
134
|
-
var pkgFile = path.join(S_PLUGIN_BASE_PATH, "/" + name + "/package.json");
|
|
135
|
-
if (!fs.existsSync(pkgFile)) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
var componentPackageJsonObj = require(pkgFile);
|
|
139
|
-
return componentPackageJsonObj.version;
|
|
140
|
-
};
|
|
141
|
-
PluginExeCute.prototype.checkVersion = function (localVersion, remoteVersion) {
|
|
142
|
-
return remoteVersion === localVersion;
|
|
143
|
-
};
|
|
144
|
-
PluginExeCute.prototype.downLoadPlugin = function (type, name) {
|
|
145
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
146
|
-
var downloadManager, pluginPath;
|
|
147
|
-
return __generator(this, function (_a) {
|
|
148
|
-
switch (_a.label) {
|
|
149
|
-
case 0:
|
|
150
|
-
downloadManager = new download_manager_1.DownloadManager();
|
|
151
|
-
pluginPath = path.join(S_PLUGIN_BASE_PATH, "/" + name);
|
|
152
|
-
if (!fs.existsSync(pluginPath)) {
|
|
153
|
-
fs.mkdirSync(pluginPath);
|
|
154
|
-
}
|
|
155
|
-
return [4 /*yield*/, downloadManager.downloadTemplateFromAppCenter(type, name, pluginPath)];
|
|
156
|
-
case 1:
|
|
157
|
-
_a.sent();
|
|
158
|
-
return [2 /*return*/];
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
PluginExeCute.prototype.loadPlugin = function () {
|
|
164
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
165
|
-
var PluginModule;
|
|
166
|
-
return __generator(this, function (_a) {
|
|
167
|
-
PluginModule = require(this.pluginPath);
|
|
168
|
-
return [2 /*return*/, PluginModule];
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
return PluginExeCute;
|
|
173
|
-
}());
|
|
174
|
-
exports.PluginExeCute = PluginExeCute;
|
|
175
|
-
//# sourceMappingURL=index.js.map
|
package/lib/plugin/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,+BAA0B;AAC1B,8DAA4D;AAC5D,wCAA0C;AAC1C,sDAAoD;AACpD,IAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AACjE,IAAM,YAAY,GAAG,qCAAqC,CAAC;AAC3D,IAAM,iBAAiB,GAAG,yBAAyB,CAAC;AACpD,IAAM,QAAQ;IACZ,GAAC,0BAAW,CAAC,SAAS,IAAG,WAAW;IACpC,GAAC,0BAAW,CAAC,MAAM,IAAG,QAAQ;IAC9B,GAAC,0BA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