@wiztivi/dana-cli 0.0.1 → 0.0.2

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.
Files changed (113) hide show
  1. package/bin/dana.js +3 -0
  2. package/dana_completion.sh +153 -0
  3. package/dist/commands/add-device.d.ts +2 -0
  4. package/dist/commands/add-device.js +126 -0
  5. package/dist/commands/add-menu.d.ts +7 -0
  6. package/dist/commands/add-menu.js +51 -0
  7. package/dist/commands/add-rail.d.ts +10 -0
  8. package/dist/commands/add-rail.js +48 -0
  9. package/dist/commands/add-screen.d.ts +5 -0
  10. package/dist/commands/add-screen.js +71 -0
  11. package/dist/commands/add-scrollView.d.ts +7 -0
  12. package/dist/commands/add-scrollView.js +37 -0
  13. package/dist/commands/auth/login.d.ts +5 -0
  14. package/dist/commands/auth/login.js +141 -0
  15. package/dist/commands/auth/status.d.ts +11 -0
  16. package/dist/commands/auth/status.js +76 -0
  17. package/dist/commands/commandDefinitions/addDeviceDefinition.d.ts +3 -0
  18. package/dist/commands/commandDefinitions/addDeviceDefinition.js +16 -0
  19. package/dist/commands/commandDefinitions/addMenuDefinition.d.ts +3 -0
  20. package/dist/commands/commandDefinitions/addMenuDefinition.js +21 -0
  21. package/dist/commands/commandDefinitions/addRailDefinition.d.ts +3 -0
  22. package/dist/commands/commandDefinitions/addRailDefinition.js +31 -0
  23. package/dist/commands/commandDefinitions/addScreenDefinition.d.ts +3 -0
  24. package/dist/commands/commandDefinitions/addScreenDefinition.js +18 -0
  25. package/dist/commands/commandDefinitions/addScrollViewDefinition.d.ts +3 -0
  26. package/dist/commands/commandDefinitions/addScrollViewDefinition.js +18 -0
  27. package/dist/commands/commandDefinitions/authDefinition.d.ts +3 -0
  28. package/dist/commands/commandDefinitions/authDefinition.js +23 -0
  29. package/dist/commands/commandDefinitions/completionDefinition.d.ts +3 -0
  30. package/dist/commands/commandDefinitions/completionDefinition.js +17 -0
  31. package/dist/commands/commandDefinitions/createAppDefinition.d.ts +3 -0
  32. package/dist/commands/commandDefinitions/createAppDefinition.js +22 -0
  33. package/dist/commands/completion.d.ts +2 -0
  34. package/dist/commands/completion.js +84 -0
  35. package/dist/commands/createApp.d.ts +6 -0
  36. package/dist/commands/createApp.js +130 -0
  37. package/dist/commands/createComponent.d.ts +3 -0
  38. package/dist/commands/createComponent.js +81 -0
  39. package/dist/commands/help/customHelp.d.ts +3 -0
  40. package/dist/commands/help/customHelp.js +31 -0
  41. package/dist/commands/hooks/authHook.d.ts +1 -0
  42. package/dist/commands/hooks/authHook.js +23 -0
  43. package/dist/configs/ComponentConfig.d.ts +32 -0
  44. package/dist/configs/ComponentConfig.js +178 -0
  45. package/dist/configs/deviceConfig/androidtvConfig.d.ts +37 -0
  46. package/dist/configs/deviceConfig/androidtvConfig.js +186 -0
  47. package/dist/configs/deviceConfig/deviceConfig.d.ts +14 -0
  48. package/dist/configs/deviceConfig/deviceConfig.js +35 -0
  49. package/dist/configs/deviceConfig/tizenConfig.d.ts +31 -0
  50. package/dist/configs/deviceConfig/tizenConfig.js +56 -0
  51. package/dist/configs/deviceConfig/tvosConfig.d.ts +13 -0
  52. package/dist/configs/deviceConfig/tvosConfig.js +32 -0
  53. package/dist/configs/deviceConfig/webosConfig.d.ts +59 -0
  54. package/dist/configs/deviceConfig/webosConfig.js +179 -0
  55. package/dist/const/authentConst.d.ts +3 -0
  56. package/dist/const/authentConst.js +6 -0
  57. package/dist/const/componentConst.d.ts +8 -0
  58. package/dist/const/componentConst.js +22 -0
  59. package/dist/const/createApp/deviceConst.d.ts +23 -0
  60. package/dist/const/createApp/deviceConst.js +73 -0
  61. package/dist/const/createApp/setupConst.d.ts +3 -0
  62. package/dist/const/createApp/setupConst.js +18 -0
  63. package/dist/const/defaultConfig.d.ts +4 -0
  64. package/dist/const/defaultConfig.js +27 -0
  65. package/dist/const/exitCodeConst.d.ts +7 -0
  66. package/dist/const/exitCodeConst.js +10 -0
  67. package/dist/const/navigationConst.d.ts +3 -0
  68. package/dist/const/navigationConst.js +36 -0
  69. package/dist/dana_completion.sh +153 -0
  70. package/dist/helpers/CliHelper.d.ts +13 -0
  71. package/dist/helpers/CliHelper.js +39 -0
  72. package/dist/helpers/CodeArtifactHelper.d.ts +12 -0
  73. package/dist/helpers/CodeArtifactHelper.js +52 -0
  74. package/dist/helpers/ComponentHelper.d.ts +12 -0
  75. package/dist/helpers/ComponentHelper.js +105 -0
  76. package/dist/helpers/CredentialsHelper.d.ts +27 -0
  77. package/dist/helpers/CredentialsHelper.js +22 -0
  78. package/dist/helpers/createApp/CreateFileHelper.d.ts +31 -0
  79. package/dist/helpers/createApp/CreateFileHelper.js +84 -0
  80. package/dist/helpers/createApp/InputValidator.d.ts +5 -0
  81. package/dist/helpers/createApp/InputValidator.js +60 -0
  82. package/dist/helpers/createApp/InstallHelper.d.ts +30 -0
  83. package/dist/helpers/createApp/InstallHelper.js +112 -0
  84. package/dist/helpers/createApp/ScriptHelper.d.ts +116 -0
  85. package/dist/helpers/createApp/ScriptHelper.js +142 -0
  86. package/dist/helpers/createApp/SetupChecker.d.ts +25 -0
  87. package/dist/helpers/createApp/SetupChecker.js +128 -0
  88. package/dist/helpers/createApp/UpdateFileHelper.d.ts +40 -0
  89. package/dist/helpers/createApp/UpdateFileHelper.js +121 -0
  90. package/dist/helpers/createApp/UserInputGetter.d.ts +49 -0
  91. package/dist/helpers/createApp/UserInputGetter.js +145 -0
  92. package/dist/helpers/handlebarsHelper.d.ts +2 -0
  93. package/dist/helpers/handlebarsHelper.js +26 -0
  94. package/dist/helpers/stringHelper.d.ts +3 -0
  95. package/dist/helpers/stringHelper.js +11 -0
  96. package/dist/index.d.ts +2 -0
  97. package/dist/index.js +16 -0
  98. package/dist/program.d.ts +2 -0
  99. package/dist/program.js +42 -0
  100. package/dist/translation/en.json +62 -0
  101. package/dist/translation/translation.d.ts +2 -0
  102. package/dist/translation/translation.js +8 -0
  103. package/dist/types/componentTypes.d.ts +31 -0
  104. package/dist/types/componentTypes.js +2 -0
  105. package/dist/types/createApp/configTypes.d.ts +27 -0
  106. package/dist/types/createApp/configTypes.js +13 -0
  107. package/dist/types/createApp/helperTypes.d.ts +35 -0
  108. package/dist/types/createApp/helperTypes.js +14 -0
  109. package/dist/types/genericTypes.d.ts +17 -0
  110. package/dist/types/genericTypes.js +2 -0
  111. package/package.json +41 -22
  112. package/README.md +0 -5
  113. package/index.js +0 -1
@@ -0,0 +1,31 @@
1
+ import { Config } from "../../types/createApp/helperTypes";
2
+ declare class CreateFileHelper {
3
+ /**
4
+ * Copy the template
5
+ */
6
+ static readonly copyTemplate: ({ directory }: {
7
+ directory: string;
8
+ }) => Promise<string>;
9
+ /**
10
+ * Copy made for extra tutorial files
11
+ */
12
+ static readonly copyForTutorial: ({ directory }: {
13
+ directory: string;
14
+ }) => Promise<string>;
15
+ /**
16
+ * Copy app.config files for selected devices
17
+ */
18
+ static readonly copyAppConfigFiles: ({ selectedDevices, directory, }: {
19
+ selectedDevices: string[];
20
+ directory: string;
21
+ }) => Promise<string>;
22
+ /**
23
+ * Execute grunt tasks
24
+ */
25
+ static readonly executeGruntTasks: ({ directory, selectedDevices, config, }: {
26
+ selectedDevices: string[];
27
+ directory: string;
28
+ config: Config;
29
+ }) => Promise<string>;
30
+ }
31
+ export default CreateFileHelper;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
+ * All Rights Reserved
5
+ *
6
+ * All information contained herein is proprietary and confidential.
7
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
8
+ * prior written permission is obtained from Wiztivi.
9
+ * No warranty, explicit or implicit, provided.
10
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
+ *
12
+ */
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const fs_1 = __importDefault(require("fs"));
18
+ const path_1 = __importDefault(require("path"));
19
+ const node_child_process_1 = require("node:child_process");
20
+ const deviceConst_1 = require("../../const/createApp/deviceConst");
21
+ const translation_1 = __importDefault(require("../../translation/translation"));
22
+ const CredentialsHelper_1 = require("../CredentialsHelper");
23
+ const CodeArtifactHelper_1 = require("../CodeArtifactHelper");
24
+ const templateModule = "@wiztivi/dana-templates";
25
+ class CreateFileHelper {
26
+ /**
27
+ * Copy the template
28
+ */
29
+ static copyTemplate = function ({ directory }) {
30
+ const templateDir = path_1.default.resolve("node_modules", templateModule, "app-template");
31
+ fs_1.default.mkdirSync(directory, { recursive: true });
32
+ fs_1.default.cpSync(templateDir, directory, { recursive: true });
33
+ return Promise.resolve("Template copied");
34
+ };
35
+ /**
36
+ * Copy made for extra tutorial files
37
+ */
38
+ static copyForTutorial = function ({ directory }) {
39
+ const templateDir = path_1.default.resolve("node_modules", templateModule, "tutorial");
40
+ fs_1.default.cpSync(templateDir, directory, { recursive: true });
41
+ return Promise.resolve("Tutorial files copied");
42
+ };
43
+ /**
44
+ * Copy app.config files for selected devices
45
+ */
46
+ static copyAppConfigFiles = function ({ selectedDevices, directory, }) {
47
+ const templateDir = path_1.default.resolve("node_modules", templateModule, "profiles");
48
+ const allFiles = fs_1.default.readdirSync(templateDir);
49
+ allFiles.forEach((file) => {
50
+ const shouldCopy = selectedDevices.includes(file.split(".")[2]);
51
+ if (shouldCopy) {
52
+ fs_1.default.cpSync(path_1.default.join(templateDir, file), path_1.default.join(directory, "profiles", file));
53
+ }
54
+ });
55
+ return Promise.resolve("Config file(s) copied");
56
+ };
57
+ /**
58
+ * Execute grunt tasks
59
+ */
60
+ static executeGruntTasks = async function ({ directory, selectedDevices, config, }) {
61
+ if (selectedDevices.includes(deviceConst_1.ANDROIDTV)) {
62
+ const credentials = CredentialsHelper_1.CredentialsHelper.get();
63
+ const registryAccount = await (0, CodeArtifactHelper_1.getRepositoryEndpoint)({
64
+ organization: credentials.org,
65
+ credentials: credentials?.aws,
66
+ format: "maven",
67
+ });
68
+ let gruntOptions = `--appUrl="${registryAccount}" `;
69
+ const optionsToAdd = ["appId", "appName", "appVersion", "appVersionCode", "wtvAndroidVersion"];
70
+ for (const option of optionsToAdd) {
71
+ gruntOptions += `--${option}="${config.androidtv?.device[option]}" `;
72
+ }
73
+ try {
74
+ (0, node_child_process_1.execSync)(`cd ${directory} && grunt copyProjectAndroidTv ${gruntOptions.trim()}`);
75
+ }
76
+ catch (e) {
77
+ const message = e instanceof Error ? e.message : translation_1.default["error.common.start.message"];
78
+ return Promise.reject(new Error(message));
79
+ }
80
+ }
81
+ return Promise.resolve("Grunt task(s) done");
82
+ };
83
+ }
84
+ exports.default = CreateFileHelper;
@@ -0,0 +1,5 @@
1
+ export declare const validInputLength: (value: string, errorMessage: string) => string;
2
+ export declare const validAppVersion: (value: string) => string;
3
+ export declare const validAppVersionCode: (value: string | number) => string;
4
+ export declare const validAppId: (value: string) => string;
5
+ export declare const validNumber: (value: string, errorMessage: string) => string;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
+ * All Rights Reserved
5
+ *
6
+ * All information contained herein is proprietary and confidential.
7
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
8
+ * prior written permission is obtained from Wiztivi.
9
+ * No warranty, explicit or implicit, provided.
10
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
+ *
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.validNumber = exports.validAppId = exports.validAppVersionCode = exports.validAppVersion = exports.validInputLength = void 0;
15
+ const semver_ts_1 = require("semver-ts");
16
+ const validInputLength = (value, errorMessage) => {
17
+ if (value?.trim().length) {
18
+ return "";
19
+ }
20
+ return errorMessage;
21
+ };
22
+ exports.validInputLength = validInputLength;
23
+ const validAppVersion = (value) => {
24
+ if (!value) {
25
+ return "App version is required";
26
+ }
27
+ if (!(0, semver_ts_1.valid)((0, semver_ts_1.clean)(value) ?? "")) {
28
+ return "App version format should be x.x.x";
29
+ }
30
+ return "";
31
+ };
32
+ exports.validAppVersion = validAppVersion;
33
+ const validAppVersionCode = (value) => {
34
+ if (!value) {
35
+ return "App version code is required";
36
+ }
37
+ if (!Number.isInteger(+value)) {
38
+ return "App version code has to be an Integer";
39
+ }
40
+ return "";
41
+ };
42
+ exports.validAppVersionCode = validAppVersionCode;
43
+ const validAppId = (value) => {
44
+ const regex = /^[a-zA-Z]\w*(\.[a-zA-Z]\w*)+$/;
45
+ if (!value.length) {
46
+ return `AppId is required !`;
47
+ }
48
+ if (!regex.test(value)) {
49
+ return "AppId should be in the following format: com.example.myapp !";
50
+ }
51
+ return "";
52
+ };
53
+ exports.validAppId = validAppId;
54
+ const validNumber = (value, errorMessage) => {
55
+ if (!parseInt(value, 10)) {
56
+ return errorMessage;
57
+ }
58
+ return "";
59
+ };
60
+ exports.validNumber = validNumber;
@@ -0,0 +1,30 @@
1
+ import { Config } from "../../types/createApp/helperTypes";
2
+ declare class InstallHelper {
3
+ /**
4
+ * Install dependencies with npm
5
+ * @returns {Promise<String>}
6
+ */
7
+ static readonly installDependencies: ({ directory, selectedDevices, config, }: {
8
+ directory: string;
9
+ selectedDevices: string[];
10
+ config: Config;
11
+ }) => Promise<string>;
12
+ private static getDependenciesList;
13
+ private static readonly installSingleDependency;
14
+ /**
15
+ * Get a list of all dependencies needed by the different devices chosen by user
16
+ */
17
+ static readonly getAllDependencies: (selectedDevices: string[], config: Config) => string[];
18
+ /**
19
+ * Install grunt globally
20
+ */
21
+ static readonly installGrunt: () => Promise<string>;
22
+ /**
23
+ * Initialize git repository and do first commit
24
+ * @returns {Promise<String>}
25
+ */
26
+ static readonly initGit: ({ directory }: {
27
+ directory: string;
28
+ }) => Promise<string>;
29
+ }
30
+ export default InstallHelper;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
+ * All Rights Reserved
5
+ *
6
+ * All information contained herein is proprietary and confidential.
7
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
8
+ * prior written permission is obtained from Wiztivi.
9
+ * No warranty, explicit or implicit, provided.
10
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
+ *
12
+ */
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const child_process_1 = require("child_process");
18
+ const deviceConst_1 = require("../../const/createApp/deviceConst");
19
+ const translation_1 = __importDefault(require("../../translation/translation"));
20
+ class InstallHelper {
21
+ /**
22
+ * Install dependencies with npm
23
+ * @returns {Promise<String>}
24
+ */
25
+ static installDependencies = ({ directory, selectedDevices, config, }) => {
26
+ const devDependencies = InstallHelper.getDependenciesList(selectedDevices, config);
27
+ return new Promise((resolve, reject) => {
28
+ (0, child_process_1.exec)(`npm i --prefix ${directory} --silent`, {}, (async () => {
29
+ try {
30
+ for (const depName of devDependencies) {
31
+ await InstallHelper.installSingleDependency(depName, directory);
32
+ }
33
+ resolve("Dependencies updated");
34
+ }
35
+ catch (error) {
36
+ reject(new Error("Dependencies update failed : " +
37
+ (error.message ?? translation_1.default["error.common.start.message"])));
38
+ }
39
+ }));
40
+ });
41
+ };
42
+ static getDependenciesList(selectedDevices, config) {
43
+ let devDependencies = [...deviceConst_1.BASIC_DEPENDENCIES];
44
+ if (selectedDevices.length) {
45
+ devDependencies = devDependencies.concat(this.getAllDependencies(selectedDevices, config));
46
+ }
47
+ return [...new Set(devDependencies)];
48
+ }
49
+ static installSingleDependency = (depName, directory) => {
50
+ return new Promise((resolveInstall, rejectInstall) => {
51
+ (0, child_process_1.exec)(`npm i ${depName} --prefix '${directory}' --save-dev --save-exact`, {}, (error) => {
52
+ if (error != null) {
53
+ rejectInstall(new Error(`FAILURE during ${depName} dependency installation ${error.message}`));
54
+ }
55
+ else {
56
+ resolveInstall();
57
+ }
58
+ });
59
+ });
60
+ };
61
+ /**
62
+ * Get a list of all dependencies needed by the different devices chosen by user
63
+ */
64
+ static getAllDependencies = function (selectedDevices, config) {
65
+ let allDep = [];
66
+ selectedDevices.forEach((el) => {
67
+ allDep = allDep.concat(deviceConst_1.PLATFORM_CONFIG[el].dependencies);
68
+ });
69
+ for (const key in config) {
70
+ if (Object.hasOwn(config, key)) {
71
+ const obj = config[key];
72
+ const renderer = obj.renderers ?? [];
73
+ renderer.forEach((r) => (allDep = allDep.concat(deviceConst_1.PLATFORM_CONFIG[key].renderers?.[r] ?? "")));
74
+ }
75
+ }
76
+ allDep = allDep.filter((el) => !!el);
77
+ return allDep;
78
+ };
79
+ /**
80
+ * Install grunt globally
81
+ */
82
+ static installGrunt = function () {
83
+ return new Promise((resolve) => {
84
+ (0, child_process_1.exec)("npm i -g grunt-cli", {}, () => {
85
+ resolve("Grunt installed");
86
+ });
87
+ });
88
+ };
89
+ /**
90
+ * Initialize git repository and do first commit
91
+ * @returns {Promise<String>}
92
+ */
93
+ static initGit = function ({ directory }) {
94
+ return new Promise((resolve, reject) => {
95
+ try {
96
+ (0, child_process_1.exec)(`cd ${directory} && git init && git add -A && git commit -m "Initial commit from Create DANA App"`, {}, (error) => {
97
+ if (error != null) {
98
+ reject(error);
99
+ }
100
+ else {
101
+ resolve("Git initialised");
102
+ }
103
+ });
104
+ }
105
+ catch (e) {
106
+ const message = e instanceof Error ? e.message : translation_1.default["error.common.start.message"];
107
+ reject(new Error("Git hasn't been initialised" + message));
108
+ }
109
+ });
110
+ };
111
+ }
112
+ exports.default = InstallHelper;
@@ -0,0 +1,116 @@
1
+ import { Task, SelectionArray, Data } from "../../types/createApp/helperTypes";
2
+ declare const ScriptHelper: {
3
+ new (): {};
4
+ /**
5
+ * Manage cancellation with CTRL+C
6
+ */
7
+ readonly handleCancellation: (value: unknown) => void;
8
+ /**
9
+ * Get selected renderers for smartTV
10
+ */
11
+ readonly askHtmlRenderers: (device: string) => Promise<string[]>;
12
+ readonly getDeviceConfig: (device: string) => {
13
+ new (): {};
14
+ readonly appConfig: {};
15
+ getConfig(..._: string[]): Promise<unknown>;
16
+ setConfig(..._: unknown[]): Promise<string>;
17
+ updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
18
+ } | {
19
+ new (): {};
20
+ readonly appConfig: {
21
+ css: {
22
+ "template-webos_css": {
23
+ mixins: string[];
24
+ base: {
25
+ name: string;
26
+ vendors: string[];
27
+ };
28
+ };
29
+ };
30
+ lightning: {
31
+ "template-webos_lightning": {
32
+ mixins: string[];
33
+ base: {
34
+ name: string;
35
+ vendors: string[];
36
+ };
37
+ };
38
+ };
39
+ };
40
+ readonly _askAppId: () => Promise<string>;
41
+ readonly _askVendorName: () => Promise<string>;
42
+ readonly _askAppTitle: () => Promise<string>;
43
+ readonly _getAppIcon: () => Promise<string>;
44
+ readonly _askBackHistory: () => Promise<boolean>;
45
+ readonly getAppConfigProperties: () => Promise<import("../../types/createApp/configTypes").WebosDevice>;
46
+ readonly getConfig: () => Promise<import("../../types/createApp/configTypes").WebosConf>;
47
+ readonly setConfig: ({ directory, config, }: {
48
+ directory: string;
49
+ config: import("../../types/createApp/configTypes").WebosConf;
50
+ }) => Promise<string>;
51
+ updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
52
+ } | {
53
+ new (): {};
54
+ readonly appConfig: {
55
+ css: {
56
+ "template-tizen_css": {
57
+ mixins: string[];
58
+ base: {
59
+ name: string;
60
+ vendors: string[];
61
+ };
62
+ };
63
+ };
64
+ lightning: {
65
+ "template-tizen_lightning": {
66
+ mixins: string[];
67
+ base: {
68
+ name: string;
69
+ vendors: string[];
70
+ };
71
+ };
72
+ };
73
+ };
74
+ readonly getConfig: () => Promise<import("../../types/createApp/configTypes").TizenConf>;
75
+ readonly setConfig: ({ directory, config }: {
76
+ directory: string;
77
+ config: import("../../types/createApp/configTypes").TizenConf;
78
+ }) => Promise<string>;
79
+ updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
80
+ } | {
81
+ new (): {};
82
+ readonly setConfig: ({ directory }: {
83
+ directory: string;
84
+ }) => Promise<string>;
85
+ readonly appConfig: {};
86
+ getConfig(..._: string[]): Promise<unknown>;
87
+ updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
88
+ } | {
89
+ new (): {};
90
+ readonly _getAppIcon: () => Promise<string>;
91
+ readonly _askAppId: () => Promise<string>;
92
+ readonly _askAppName: () => Promise<string>;
93
+ readonly _askAppVersion: () => Promise<string>;
94
+ readonly _askAppVersionCode: () => Promise<number>;
95
+ readonly _getWtvAndroidVersion: () => Promise<string>;
96
+ readonly getConfig: () => Promise<import("../../types/createApp/configTypes").AndroidConfig>;
97
+ readonly setConfig: ({ directory, config, }: {
98
+ directory: string;
99
+ config: import("../../types/createApp/configTypes").AndroidConfig;
100
+ }) => Promise<string>;
101
+ readonly updateProfileJson: (directory: string, config: import("../../types/createApp/configTypes").AndroidConfig) => Promise<string>;
102
+ readonly appConfig: {};
103
+ updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
104
+ };
105
+ readonly promptUnavailableDevices: (unavailableDevices: string[]) => void;
106
+ readonly promptSelectDevices: (devices: SelectionArray, required?: boolean) => Promise<string[]>;
107
+ /**
108
+ * Iterate on a list of tasks
109
+ */
110
+ readonly installation: (tasks: Task[]) => Promise<void>;
111
+ /**
112
+ * Prompt all script commands to launch subscribed devices
113
+ */
114
+ readonly printNpmCommandForUser: (data: Data) => void;
115
+ };
116
+ export default ScriptHelper;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ /*
40
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
41
+ * All Rights Reserved
42
+ *
43
+ * All information contained herein is proprietary and confidential.
44
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
45
+ * prior written permission is obtained from Wiztivi.
46
+ * No warranty, explicit or implicit, provided.
47
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
48
+ *
49
+ */
50
+ const prompts = __importStar(require("@clack/prompts"));
51
+ const deviceConst = __importStar(require("../../const/createApp/deviceConst"));
52
+ const webosConfig_1 = __importDefault(require("../../configs/deviceConfig/webosConfig"));
53
+ const tizenConfig_1 = __importDefault(require("../../configs/deviceConfig/tizenConfig"));
54
+ const tvosConfig_1 = __importDefault(require("../../configs/deviceConfig/tvosConfig"));
55
+ const deviceConfig_1 = __importDefault(require("../../configs/deviceConfig/deviceConfig"));
56
+ const androidtvConfig_1 = __importDefault(require("../../configs/deviceConfig/androidtvConfig"));
57
+ const picocolors_1 = __importDefault(require("picocolors"));
58
+ const translation_1 = __importDefault(require("../../translation/translation"));
59
+ const ScriptHelper = class {
60
+ /**
61
+ * Manage cancellation with CTRL+C
62
+ */
63
+ static handleCancellation = function (value) {
64
+ if (prompts.isCancel(value)) {
65
+ prompts.cancel("Operation cancelled.");
66
+ process.exit(0);
67
+ }
68
+ };
69
+ /**
70
+ * Get selected renderers for smartTV
71
+ */
72
+ static askHtmlRenderers = async (device) => {
73
+ const options = deviceConst.RENDERERS.map((el) => {
74
+ return { value: el, label: el };
75
+ });
76
+ const selection = (await prompts.multiselect({
77
+ message: `${translation_1.default["renderer.selection"]} ${device}`,
78
+ required: true,
79
+ options,
80
+ }));
81
+ this.handleCancellation(selection);
82
+ return selection;
83
+ };
84
+ static getDeviceConfig = (device) => {
85
+ switch (device) {
86
+ case deviceConst.WEBOS:
87
+ return webosConfig_1.default;
88
+ case deviceConst.TIZEN:
89
+ return tizenConfig_1.default;
90
+ case deviceConst.TVOS:
91
+ return tvosConfig_1.default;
92
+ case deviceConst.ANDROIDTV:
93
+ return androidtvConfig_1.default;
94
+ default:
95
+ return deviceConfig_1.default;
96
+ }
97
+ };
98
+ static promptUnavailableDevices = (unavailableDevices) => {
99
+ prompts.log.warn(picocolors_1.default.bold(picocolors_1.default.yellow(translation_1.default["device.unavailable"]) + "\n" + picocolors_1.default.magenta(unavailableDevices.join(", "))));
100
+ };
101
+ static promptSelectDevices = async (devices, required = false) => {
102
+ const selectObject = {
103
+ message: translation_1.default["device.selection"],
104
+ options: devices,
105
+ required,
106
+ };
107
+ const selectedDevices = await prompts.multiselect(selectObject);
108
+ this.handleCancellation(selectedDevices);
109
+ return selectedDevices;
110
+ };
111
+ /**
112
+ * Iterate on a list of tasks
113
+ */
114
+ static installation = async function (tasks) {
115
+ for (const item of tasks) {
116
+ if (item.condition == null || item.condition === true) {
117
+ await item.task();
118
+ }
119
+ }
120
+ };
121
+ /**
122
+ * Prompt all script commands to launch subscribed devices
123
+ */
124
+ static printNpmCommandForUser = function (data) {
125
+ const commandLine = `cd ${data.directory} && npm run`;
126
+ prompts.log.info(picocolors_1.default.bold(`For browser:`));
127
+ prompts.log.message(`${commandLine} start`);
128
+ for (const device of data.selectedDevices) {
129
+ prompts.log.info(picocolors_1.default.bold(`For ${device}: `));
130
+ const deviceConfig = data.config[device];
131
+ if (deviceConfig?.renderers) {
132
+ deviceConfig.renderers.forEach((renderer) => {
133
+ prompts.log.message(`${commandLine} start:${device}_${renderer}`);
134
+ });
135
+ }
136
+ else {
137
+ prompts.log.message(`${commandLine} start:${device}`);
138
+ }
139
+ }
140
+ };
141
+ };
142
+ exports.default = ScriptHelper;
@@ -0,0 +1,25 @@
1
+ import { Task } from "../../types/createApp/helperTypes";
2
+ declare class SetupChecker {
3
+ static readonly checkSetup: () => Promise<void>;
4
+ /**
5
+ * Iterate on a list of setup tasks
6
+ * @param {Array} tasks
7
+ */
8
+ static executeCheck(tasks: Task[]): Promise<void>;
9
+ /**
10
+ * Check if everything is set up correctly for the installation
11
+ * @returns {Promise}
12
+ */
13
+ static validateNodeVersion(): Promise<string>;
14
+ /**
15
+ * Check if git cli is installed
16
+ * @returns {Promise<String>}
17
+ */
18
+ static validateGitInstallation(): Promise<string>;
19
+ /**
20
+ * Check if aws cli is installed
21
+ * @returns {Promise<String>}
22
+ */
23
+ static validateAwsInstallation(): Promise<string>;
24
+ }
25
+ export default SetupChecker;