1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const jovo_cli_deploy_lambda_1 = require("jovo-cli-deploy-lambda");
|
4 | const jovo_cli_core_1 = require("jovo-cli-core");
|
5 | const DeployTargets = require("../utils/DeployTargets");
|
6 | const instances = {};
|
7 | const AVAILABLE_DEPLOY_TARGETS = [
|
8 | jovo_cli_deploy_lambda_1.JovoCliDeployLambda,
|
9 | ];
|
10 | function createDeployInstance(name) {
|
11 | name = name.toString();
|
12 | for (let i = 0; i < AVAILABLE_DEPLOY_TARGETS.length; i++) {
|
13 | if (AVAILABLE_DEPLOY_TARGETS[i].TARGET_KEY === name) {
|
14 | return new AVAILABLE_DEPLOY_TARGETS[i]();
|
15 | }
|
16 | }
|
17 | throw (new Error(`The deploy target "${name}" is not supported!`));
|
18 | }
|
19 | function getDeployExampleText() {
|
20 | const availableDeployTargets = DeployTargets.getAllPluginTargets();
|
21 | return `<${jovo_cli_core_1.TARGET_MODEL}|${jovo_cli_core_1.TARGET_INFO}|${jovo_cli_core_1.TARGET_ZIP}|${jovo_cli_core_1.TARGET_ALL}|${availableDeployTargets.join('|')}> Default: ${jovo_cli_core_1.DEFAULT_TARGET}`;
|
22 | }
|
23 | exports.getDeployExampleText = getDeployExampleText;
|
24 | function getAllAvailable() {
|
25 | const targetNames = [
|
26 | jovo_cli_core_1.TARGET_MODEL,
|
27 | jovo_cli_core_1.TARGET_INFO,
|
28 | jovo_cli_core_1.TARGET_ZIP,
|
29 | ];
|
30 | const pluginDeployTargets = DeployTargets.getAllPluginTargets();
|
31 | targetNames.push.apply(targetNames, pluginDeployTargets);
|
32 | return targetNames;
|
33 | }
|
34 | exports.getAllAvailable = getAllAvailable;
|
35 | function getAllPluginTargets() {
|
36 | const targetNames = [];
|
37 | AVAILABLE_DEPLOY_TARGETS.forEach((platform) => {
|
38 | targetNames.push(platform.TARGET_KEY);
|
39 | });
|
40 | return targetNames;
|
41 | }
|
42 | exports.getAllPluginTargets = getAllPluginTargets;
|
43 | function get(name) {
|
44 | if (!instances.hasOwnProperty(name)) {
|
45 | instances[name] = createDeployInstance(name);
|
46 | }
|
47 | return instances[name];
|
48 | }
|
49 | exports.get = get;
|
50 | //# sourceMappingURL=DeployTargets.js.map |
\ | No newline at end of file |