1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const jovo_cli_core_1 = require("jovo-cli-core");
|
4 | const deployTargets = require("./DeployTargets");
|
5 | const platforms = require("./Platforms");
|
6 | function isValidPlatform(platform) {
|
7 | const platformNames = platforms.getAllAvailable();
|
8 | if (platform) {
|
9 | if (!platformNames.includes(platform)) {
|
10 | console.log(`Please use a valid platform: (${platformNames.join('|')})`);
|
11 | return false;
|
12 | }
|
13 | }
|
14 | return true;
|
15 | }
|
16 | exports.isValidPlatform = isValidPlatform;
|
17 | function isValidTemplate(template) {
|
18 | if (template) {
|
19 | const reg = /^[0-9a-zA-Z-/_]+$/;
|
20 | if (!reg.test(template)) {
|
21 | console.log('Please use a valid template name.');
|
22 | return false;
|
23 | }
|
24 | }
|
25 | return true;
|
26 | }
|
27 | exports.isValidTemplate = isValidTemplate;
|
28 | function isValidLocale(locale) {
|
29 | if (locale) {
|
30 | if (!/[a-z]{2}-[A-Z]{2}/.test(locale)) {
|
31 | console.log('Please use a valid locale: e.g. en-US, de-DE, en-GB');
|
32 | return false;
|
33 | }
|
34 | }
|
35 | return true;
|
36 | }
|
37 | exports.isValidLocale = isValidLocale;
|
38 | function isValidProjectName(projectName) {
|
39 | const reg = /^[0-9a-zA-Z-_]+$/;
|
40 | if (!reg.test(projectName)) {
|
41 | console.log('Please use a valid folder name.');
|
42 | return false;
|
43 | }
|
44 | return true;
|
45 | }
|
46 | exports.isValidProjectName = isValidProjectName;
|
47 | function isValidDeployTarget(target) {
|
48 | if (target) {
|
49 | const availableDeployTargets = deployTargets.getAllAvailable();
|
50 | if (target !== jovo_cli_core_1.TARGET_ALL &&
|
51 | target !== jovo_cli_core_1.TARGET_MODEL &&
|
52 | target !== jovo_cli_core_1.TARGET_ZIP &&
|
53 | target !== jovo_cli_core_1.TARGET_INFO &&
|
54 | !availableDeployTargets.includes(target)) {
|
55 | console.log(`Please use a valid target: (${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('|')})`);
|
56 | return false;
|
57 | }
|
58 | }
|
59 | return true;
|
60 | }
|
61 | exports.isValidDeployTarget = isValidDeployTarget;
|
62 | function isValidEndpoint(endpoint) {
|
63 | if (endpoint) {
|
64 | if (endpoint !== jovo_cli_core_1.ENDPOINT_BSTPROXY &&
|
65 | endpoint !== jovo_cli_core_1.ENDPOINT_JOVOWEBHOOK &&
|
66 | endpoint !== jovo_cli_core_1.ENDPOINT_NONE) {
|
67 | console.log('Please use a valid endpoint: (' + jovo_cli_core_1.ENDPOINT_JOVOWEBHOOK + '|' + jovo_cli_core_1.ENDPOINT_BSTPROXY + ')');
|
68 | return false;
|
69 | }
|
70 | }
|
71 | return true;
|
72 | }
|
73 | exports.isValidEndpoint = isValidEndpoint;
|
74 |
|
\ | No newline at end of file |