UNPKG

1.91 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const jovo_cli_deploy_lambda_1 = require("jovo-cli-deploy-lambda");
4const jovo_cli_core_1 = require("jovo-cli-core");
5const DeployTargets = require("../utils/DeployTargets");
6const instances = {};
7const AVAILABLE_DEPLOY_TARGETS = [
8 jovo_cli_deploy_lambda_1.JovoCliDeployLambda,
9];
10function 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}
19function 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}
23exports.getDeployExampleText = getDeployExampleText;
24function 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}
34exports.getAllAvailable = getAllAvailable;
35function getAllPluginTargets() {
36 const targetNames = [];
37 AVAILABLE_DEPLOY_TARGETS.forEach((platform) => {
38 targetNames.push(platform.TARGET_KEY);
39 });
40 return targetNames;
41}
42exports.getAllPluginTargets = getAllPluginTargets;
43function get(name) {
44 if (!instances.hasOwnProperty(name)) {
45 instances[name] = createDeployInstance(name);
46 }
47 return instances[name];
48}
49exports.get = get;
50//# sourceMappingURL=DeployTargets.js.map
\No newline at end of file