@wiztivi/dana-cli 0.0.14 → 0.0.16

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 (96) hide show
  1. package/README.md +4 -0
  2. package/bin/dana.js +1 -1
  3. package/dana_completion.sh +2 -0
  4. package/dist/bundle.min.js +2 -0
  5. package/dist/commands/addComponent/config/ComponentConfig.d.ts +1 -1
  6. package/dist/commands/addComponent/const/defaultConfig.d.ts +1 -1
  7. package/dist/commands/addComponent/const/navigationConst.d.ts +1 -1
  8. package/dist/commands/addComponent/createComponent.d.ts +1 -1
  9. package/dist/commands/addComponent/helper/ComponentHelper.d.ts +1 -1
  10. package/dist/commands/addDevice/deviceConfig/configTypes.d.ts +0 -9
  11. package/dist/commands/addDevice/deviceConfig/webosConfig.d.ts +1 -29
  12. package/dist/commands/addModule/add-module.d.ts +2 -0
  13. package/dist/commands/addModule/addModuleDefinition.d.ts +3 -0
  14. package/dist/commands/addModule/moduleConst.d.ts +10 -0
  15. package/dist/commands/authentication/AuthenticationManager.d.ts +9 -10
  16. package/dist/commands/authentication/helper/CodeArtifactHelper.d.ts +1 -1
  17. package/dist/commands/authentication/helper/CredentialsHelper.d.ts +7 -0
  18. package/dist/commands/authentication/helper/SPM.d.ts +17 -0
  19. package/dist/commands/createApp/const/createAppTasks.d.ts +3 -0
  20. package/dist/commands/createApp/const/templateConst.d.ts +9 -0
  21. package/dist/commands/createApp/createApp.d.ts +4 -3
  22. package/dist/commands/createApp/helpers/CreateAppHelper.d.ts +10 -13
  23. package/dist/commands/createApp/helpers/SetupChecker.d.ts +1 -1
  24. package/dist/commands/hooks/checkDanaProjectHook.d.ts +2 -0
  25. package/dist/commands/package/package.d.ts +2 -0
  26. package/dist/commands/package/packageDefinition.d.ts +3 -0
  27. package/dist/common/const/exitCodeConst.d.ts +4 -0
  28. package/dist/common/helpers/CreateArchiveHelper.d.ts +1 -0
  29. package/dist/common/helpers/CreateFileHelper.d.ts +7 -1
  30. package/dist/common/helpers/InputValidator.d.ts +1 -1
  31. package/dist/common/helpers/InstallHelper.d.ts +1 -1
  32. package/dist/common/helpers/UpdateFileHelper.d.ts +10 -1
  33. package/dist/common/helpers/UserInputGetter.d.ts +1 -1
  34. package/dist/common/helpers/stringHelper.d.ts +1 -1
  35. package/dist/common/types/helperTypes.d.ts +3 -3
  36. package/package.json +24 -13
  37. package/dist/commands/addComponent/addMenu/add-menu.js +0 -45
  38. package/dist/commands/addComponent/addMenu/addMenuDefinition.js +0 -16
  39. package/dist/commands/addComponent/addRail/add-rail.js +0 -42
  40. package/dist/commands/addComponent/addRail/addRailDefinition.js +0 -26
  41. package/dist/commands/addComponent/addScreen/add-screen.js +0 -33
  42. package/dist/commands/addComponent/addScreen/addScreenDefinition.js +0 -13
  43. package/dist/commands/addComponent/addScrollView/add-scrollView.js +0 -31
  44. package/dist/commands/addComponent/addScrollView/addScrollViewDefinition.js +0 -13
  45. package/dist/commands/addComponent/config/ComponentConfig.js +0 -140
  46. package/dist/commands/addComponent/config/componentTypes.js +0 -1
  47. package/dist/commands/addComponent/const/componentConst.js +0 -19
  48. package/dist/commands/addComponent/const/defaultConfig.js +0 -24
  49. package/dist/commands/addComponent/const/navigationConst.js +0 -30
  50. package/dist/commands/addComponent/createComponent.js +0 -41
  51. package/dist/commands/addComponent/helper/ComponentHelper.js +0 -77
  52. package/dist/commands/addDevice/add-device.js +0 -90
  53. package/dist/commands/addDevice/addDeviceDefinition.js +0 -11
  54. package/dist/commands/addDevice/deviceConfig/androidtvConfig.js +0 -116
  55. package/dist/commands/addDevice/deviceConfig/configTypes.js +0 -12
  56. package/dist/commands/addDevice/deviceConfig/deviceConfig.js +0 -33
  57. package/dist/commands/addDevice/deviceConfig/titanosConfig.js +0 -14
  58. package/dist/commands/addDevice/deviceConfig/tizenConfig.js +0 -51
  59. package/dist/commands/addDevice/deviceConfig/tvosConfig.js +0 -45
  60. package/dist/commands/addDevice/deviceConfig/vidaaConfig.js +0 -14
  61. package/dist/commands/addDevice/deviceConfig/webosConfig.js +0 -140
  62. package/dist/commands/addDevice/helper/addDeviceHelper.js +0 -88
  63. package/dist/commands/authentication/AuthenticationManager.js +0 -167
  64. package/dist/commands/authentication/authDefinition.js +0 -35
  65. package/dist/commands/authentication/authHook.js +0 -32
  66. package/dist/commands/authentication/authentConst.js +0 -6
  67. package/dist/commands/authentication/commands/get-packages-token.js +0 -30
  68. package/dist/commands/authentication/commands/login.js +0 -28
  69. package/dist/commands/authentication/commands/logout.js +0 -20
  70. package/dist/commands/authentication/commands/status.js +0 -36
  71. package/dist/commands/authentication/helper/CodeArtifactHelper.js +0 -46
  72. package/dist/commands/authentication/helper/CommandHelper.js +0 -8
  73. package/dist/commands/authentication/helper/CredentialsHelper.js +0 -80
  74. package/dist/commands/commandHelp/customHelp.js +0 -26
  75. package/dist/commands/completion/completion.js +0 -48
  76. package/dist/commands/completion/completionDefinition.js +0 -12
  77. package/dist/commands/createApp/const/setupConst.js +0 -14
  78. package/dist/commands/createApp/createApp.js +0 -92
  79. package/dist/commands/createApp/createAppDefinition.js +0 -17
  80. package/dist/commands/createApp/helpers/CreateAppHelper.js +0 -114
  81. package/dist/commands/createApp/helpers/SetupChecker.js +0 -90
  82. package/dist/common/commonConst.js +0 -1
  83. package/dist/common/const/deviceConst.js +0 -71
  84. package/dist/common/const/exitCodeConst.js +0 -8
  85. package/dist/common/helpers/CreateFileHelper.js +0 -95
  86. package/dist/common/helpers/InputValidator.js +0 -52
  87. package/dist/common/helpers/InstallHelper.js +0 -145
  88. package/dist/common/helpers/UpdateFileHelper.js +0 -140
  89. package/dist/common/helpers/UserInputGetter.js +0 -118
  90. package/dist/common/helpers/handlebarsHelper.js +0 -21
  91. package/dist/common/helpers/stringHelper.js +0 -18
  92. package/dist/common/translation/en.json +0 -68
  93. package/dist/common/translation/translation.js +0 -3
  94. package/dist/common/types/helperTypes.js +0 -12
  95. package/dist/index.js +0 -14
  96. package/dist/program.js +0 -37
@@ -1,77 +0,0 @@
1
- /*
2
- * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
3
- * All Rights Reserved
4
- *
5
- * All information contained herein is proprietary and confidential.
6
- * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
7
- * prior written permission is obtained from Wiztivi.
8
- * No warranty, explicit or implicit, provided.
9
- * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
10
- *
11
- */
12
- import * as prompts from "@clack/prompts";
13
- import { createRequire } from "node:module";
14
- import { RAIL, MENU, TILE_VIEW, SCREEN, SCROLL_VIEW, SCROLL_ITEM, VOD_SCREEN, BUTTON_ITEM_VIEW, } from "../const/componentConst.js";
15
- import { capitalizeFirstLetter } from "../../../common/helpers/stringHelper.js";
16
- import { CANCEL } from "../../../common/const/exitCodeConst.js";
17
- import { TEMPLATE_MODULE } from "../../../common/commonConst.js";
18
- import { fileURLToPath } from "node:url";
19
- const ComponentHelper = class {
20
- static selectionFactory = async (name, options, message) => {
21
- options = options.map((el) => {
22
- return { value: el.value, label: el.label };
23
- });
24
- const result = (await prompts.select({
25
- message,
26
- options,
27
- }));
28
- ComponentHelper.handleCancellation(name);
29
- return result;
30
- };
31
- static checkOption = (option, optionList, title) => {
32
- if (!option) {
33
- return "";
34
- }
35
- const found = optionList.find((o) => o.command === option);
36
- if (found) {
37
- return found.value;
38
- }
39
- prompts.log.info(`"${option}" does not match any ${title} option. Please select one below:`);
40
- return "";
41
- };
42
- static normalizeFileName = (type, name) => {
43
- const uppercaseName = capitalizeFirstLetter(name);
44
- switch (type) {
45
- case RAIL:
46
- case MENU:
47
- return `${uppercaseName}ListView.js`;
48
- case TILE_VIEW:
49
- return `${uppercaseName}ListItemView.js`;
50
- case SCROLL_VIEW:
51
- return `${uppercaseName}ScrollView.js`;
52
- case SCROLL_ITEM:
53
- return `${uppercaseName}ScrollItemView.js`;
54
- case SCREEN:
55
- case VOD_SCREEN:
56
- return `${uppercaseName}Screen.js`;
57
- case BUTTON_ITEM_VIEW:
58
- return `${uppercaseName}View.js`;
59
- default:
60
- return `${uppercaseName}.js`;
61
- }
62
- };
63
- /**
64
- * Manage cancellation with CTRL+C
65
- */
66
- static handleCancellation = function (value) {
67
- if (prompts.isCancel(value)) {
68
- prompts.cancel("Operation cancelled.");
69
- process.exit(CANCEL);
70
- }
71
- };
72
- static getTemplatePath = function () {
73
- const require = createRequire(fileURLToPath(import.meta.url));
74
- return require.resolve(TEMPLATE_MODULE);
75
- };
76
- };
77
- export default ComponentHelper;
@@ -1,90 +0,0 @@
1
- /*
2
- * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
3
- * All Rights Reserved
4
- *
5
- * All information contained herein is proprietary and confidential.
6
- * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
7
- * prior written permission is obtained from Wiztivi.
8
- * No warranty, explicit or implicit, provided.
9
- * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
10
- *
11
- */
12
- import UserInputGetter from "../../common/helpers/UserInputGetter.js";
13
- import UpdateFileHelper from "../../common/helpers/UpdateFileHelper.js";
14
- import InstallHelper from "../../common/helpers/InstallHelper.js";
15
- import CreateAppHelper from "../createApp/helpers/CreateAppHelper.js";
16
- import CreateFileHelper from "../../common/helpers/CreateFileHelper.js";
17
- import AddDeviceHelper from "./helper/addDeviceHelper.js";
18
- import * as prompts from "@clack/prompts";
19
- import path from "node:path";
20
- import colors from "picocolors";
21
- import { DEVICE_ERROR } from "../../common/const/exitCodeConst.js";
22
- import process from "node:process";
23
- import translation from "../../common/translation/translation.js";
24
- import { CredentialsHelper } from "../authentication/helper/CredentialsHelper.js";
25
- const addDevice = async () => {
26
- prompts.intro(`Add device(s) to ${path.basename(process.cwd())} !`);
27
- const spinner = prompts.spinner();
28
- const data = {};
29
- try {
30
- data.directory = "./";
31
- data.awsProfile = CredentialsHelper.get().org;
32
- const { availableDevices, unavailableDevices } = await UserInputGetter.getAvailableDevices();
33
- const installedDevices = AddDeviceHelper.getInstalledDevices(data.directory);
34
- const filteredAvailableDevices = availableDevices.filter((el) => !installedDevices.includes(el.value));
35
- if (unavailableDevices.length) {
36
- CreateAppHelper.promptUnavailableDevices(unavailableDevices);
37
- }
38
- if (filteredAvailableDevices.length) {
39
- data.selectedDevices = await CreateAppHelper.promptSelectDevices(filteredAvailableDevices);
40
- }
41
- if (!data.selectedDevices?.length) {
42
- prompts.outro(translation["command.device.no_selection"]);
43
- return;
44
- }
45
- data.config = await UserInputGetter.getDevicesConfig(data);
46
- }
47
- catch (e) {
48
- const message = e instanceof Error ? e.message : e;
49
- prompts.outro(colors.red(`An issue occurred :` + message));
50
- process.exit(DEVICE_ERROR);
51
- }
52
- try {
53
- spinner.start(translation["task.installation.start"]);
54
- await CreateAppHelper.installation([
55
- {
56
- title: "Update package.json",
57
- task: async () => UpdateFileHelper.updatePackageJson(data),
58
- },
59
- {
60
- title: "Copy app.config files",
61
- task: async () => CreateFileHelper.copyAppConfigFiles(data),
62
- },
63
- {
64
- title: "Update app.config.json",
65
- task: async () => UpdateFileHelper.updateAppConfigFile(data),
66
- },
67
- {
68
- title: "Install dependencies with npm",
69
- task: async () => InstallHelper.installDependencies(data),
70
- },
71
- {
72
- title: "Execute grunt tasks",
73
- task: async () => CreateFileHelper.executeGruntTasks(data),
74
- },
75
- {
76
- title: "Execute devices config",
77
- task: async () => UpdateFileHelper.setDevicesConfig(data),
78
- },
79
- ], spinner);
80
- }
81
- catch (e) {
82
- spinner.stop();
83
- const message = e instanceof Error ? e.message : e;
84
- prompts.outro(colors.red(`${translation["error.common.start.message"]} ${message}`));
85
- process.exit(DEVICE_ERROR);
86
- }
87
- spinner.stop(translation["task.installation.end"]);
88
- prompts.outro("Everything is ready ! Don't forget to commit your change.");
89
- };
90
- export default addDevice;
@@ -1,11 +0,0 @@
1
- import { Command } from "commander";
2
- import addDevice from "./add-device.js";
3
- import translation from "../../common/translation/translation.js";
4
- import { authHook } from "../authentication/authHook.js";
5
- const addDeviceDefinition = () => {
6
- return new Command("add-device")
7
- .description(translation["command.device.description"])
8
- .hook("preAction", authHook)
9
- .action(addDevice);
10
- };
11
- export default addDeviceDefinition;
@@ -1,116 +0,0 @@
1
- /*
2
- * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
3
- * All Rights Reserved
4
- *
5
- * All information contained herein is proprietary and confidential.
6
- * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
7
- * prior written permission is obtained from Wiztivi.
8
- * No warranty, explicit or implicit, provided.
9
- * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
10
- *
11
- */
12
- import fs from "node:fs";
13
- import path from "node:path";
14
- import DeviceConfig from "./deviceConfig.js";
15
- import ComponentHelper from "../../addComponent/helper/ComponentHelper.js";
16
- import * as prompts from "@clack/prompts";
17
- import colors from "picocolors";
18
- import { clean } from "semver-ts";
19
- import { validAppId, validAppVersion, validAppVersionCode, validInputLength, } from "../../../common/helpers/InputValidator.js";
20
- import addDeviceHelper from "../helper/addDeviceHelper.js";
21
- const AndroidtvConfig = class extends DeviceConfig {
22
- /**
23
- * Ask the appId
24
- */
25
- static _askAppId = async () => {
26
- const appId = (await prompts.text({
27
- message: "What is the appId ?",
28
- placeholder: "com.yourname.ui",
29
- validate: (value) => validAppId(value),
30
- }));
31
- ComponentHelper.handleCancellation(appId);
32
- return appId;
33
- };
34
- /**
35
- * Ask the appName
36
- */
37
- static _askAppName = async () => {
38
- const errorMessage = "App name is required !";
39
- const appName = (await prompts.text({
40
- message: "What is the appName ?",
41
- placeholder: "Dana",
42
- validate: (value) => validInputLength(value, errorMessage),
43
- }));
44
- ComponentHelper.handleCancellation(appName);
45
- return appName;
46
- };
47
- /**
48
- * Ask the appVersion
49
- */
50
- static _askAppVersion = async () => {
51
- const appVersion = (await prompts.text({
52
- message: "What is the app version ?",
53
- placeholder: "1.0.0",
54
- initialValue: "1.0.0",
55
- validate: (value) => validAppVersion(value),
56
- }));
57
- ComponentHelper.handleCancellation(appVersion);
58
- return clean(appVersion) ?? "";
59
- };
60
- /**
61
- * Ask the appVersion code
62
- */
63
- static _askAppVersionCode = async () => {
64
- const appVersionCode = (await prompts.text({
65
- message: "What is the app version code ?",
66
- placeholder: "1000",
67
- initialValue: "1000",
68
- validate: (value) => validAppVersionCode(value),
69
- }));
70
- ComponentHelper.handleCancellation(appVersionCode);
71
- return Number(appVersionCode);
72
- };
73
- /**
74
- * Call aws to get latest android version
75
- */
76
- static _getWtvAndroidVersion = async () => {
77
- const requestParams = {
78
- packageName: "v8-runtime",
79
- repository: "internal-android-repository",
80
- format: "maven",
81
- namespace: "com.dana.androidtv",
82
- };
83
- return await addDeviceHelper.getLatestPackageVersion(requestParams);
84
- };
85
- static getConfig = async () => {
86
- prompts.log.info(colors.bold("Let's configure Android !"));
87
- const config = {
88
- device: await prompts.group({
89
- appId: () => this._askAppId(),
90
- appName: () => this._askAppName(),
91
- appVersion: () => this._askAppVersion(),
92
- appVersionCode: () => this._askAppVersionCode(),
93
- icon: () => addDeviceHelper.getAppIcon(),
94
- wtvAndroidVersion: () => this._getWtvAndroidVersion(),
95
- }, {
96
- onCancel: () => {
97
- prompts.cancel("Android configuration cancelled.");
98
- process.exit(0);
99
- },
100
- }),
101
- };
102
- return config;
103
- };
104
- static setConfig = async ({ directory, config, }) => {
105
- await this.updateProfileJson(directory, config);
106
- return "Android config done";
107
- };
108
- static updateProfileJson = (directory, config) => {
109
- const filePath = path.join(directory, "profiles", "app.config.androidtv.json");
110
- const jsonData = JSON.parse(fs.readFileSync(filePath).toString());
111
- jsonData["base-android"].device = { ...jsonData["base-android"].device, ...config.device };
112
- fs.writeFileSync(filePath, JSON.stringify(jsonData, null, 4));
113
- return Promise.resolve("Profile.json updated");
114
- };
115
- };
116
- export default AndroidtvConfig;
@@ -1,12 +0,0 @@
1
- /*
2
- * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
3
- * All Rights Reserved
4
- *
5
- * All information contained herein is proprietary and confidential.
6
- * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
7
- * prior written permission is obtained from Wiztivi.
8
- * No warranty, explicit or implicit, provided.
9
- * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
10
- *
11
- */
12
- export {};
@@ -1,33 +0,0 @@
1
- /*
2
- * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
3
- * All Rights Reserved
4
- *
5
- * All information contained herein is proprietary and confidential.
6
- * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
7
- * prior written permission is obtained from Wiztivi.
8
- * No warranty, explicit or implicit, provided.
9
- * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
10
- *
11
- */
12
- /**
13
- * A generic class for device configuration
14
- */
15
- const DeviceConfig = class {
16
- static appConfig = {};
17
- static getConfig(..._) {
18
- return Promise.resolve({});
19
- }
20
- static setConfig(..._) {
21
- return Promise.resolve("Device configuration done");
22
- }
23
- /**
24
- * Add renderers configuration to json
25
- */
26
- static updateProfileJsonWithRenderers(jsonData, renderers) {
27
- for (const renderer of renderers) {
28
- jsonData = { ...jsonData, ...this.appConfig[renderer] };
29
- }
30
- return jsonData;
31
- }
32
- };
33
- export default DeviceConfig;
@@ -1,14 +0,0 @@
1
- import DeviceConfig from "./deviceConfig.js";
2
- import { LIGHTNING, CSS } from "../../../common/const/deviceConst.js";
3
- const TitanosConfig = class extends DeviceConfig {
4
- // eslint-disable-next-line @typescript-eslint/require-await
5
- static getConfig = async () => {
6
- return {
7
- renderers: [LIGHTNING, CSS],
8
- };
9
- };
10
- static setConfig = () => {
11
- return Promise.resolve("TitanOS configuration done");
12
- };
13
- };
14
- export default TitanosConfig;
@@ -1,51 +0,0 @@
1
- /*
2
- * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
3
- * All Rights Reserved
4
- *
5
- * All information contained herein is proprietary and confidential.
6
- * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
7
- * prior written permission is obtained from Wiztivi.
8
- * No warranty, explicit or implicit, provided.
9
- * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
10
- *
11
- */
12
- import fs from "node:fs";
13
- import path from "node:path";
14
- import DeviceConfig from "./deviceConfig.js";
15
- import { LIGHTNING } from "../../../common/const/deviceConst.js";
16
- const TizenConfig = class extends DeviceConfig {
17
- static appConfig = {
18
- css: {
19
- "template-tizen_css": {
20
- mixins: ["default", "tizen"],
21
- base: {
22
- name: "Tizen",
23
- vendors: ["@dana/renderer-css"],
24
- },
25
- },
26
- },
27
- lightning: {
28
- "template-tizen_lightning": {
29
- mixins: ["default", "tizen"],
30
- base: {
31
- name: "Tizen",
32
- vendors: ["@dana/renderer-lightning-html5"],
33
- },
34
- },
35
- },
36
- };
37
- // eslint-disable-next-line @typescript-eslint/require-await
38
- static getConfig = async () => {
39
- return {
40
- renderers: [LIGHTNING],
41
- };
42
- };
43
- static setConfig = ({ directory, config }) => {
44
- const filePath = path.join(directory, "profiles", "app.config.tizen.json");
45
- let jsonData = JSON.parse(fs.readFileSync(filePath).toString());
46
- jsonData = this.updateProfileJsonWithRenderers(jsonData, config.renderers);
47
- fs.writeFileSync(filePath, JSON.stringify(jsonData, null, 4));
48
- return Promise.resolve("Tizen configuration done");
49
- };
50
- };
51
- export default TizenConfig;
@@ -1,45 +0,0 @@
1
- /*
2
- * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
3
- * All Rights Reserved
4
- *
5
- * All information contained herein is proprietary and confidential.
6
- * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
7
- * prior written permission is obtained from Wiztivi.
8
- * No warranty, explicit or implicit, provided.
9
- * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
10
- *
11
- */
12
- import fs from "node:fs";
13
- import DeviceConfig from "./deviceConfig.js";
14
- import path from "node:path";
15
- import addDeviceHelper from "../helper/addDeviceHelper.js";
16
- const TvosConfig = class extends DeviceConfig {
17
- /**
18
- * Set config for TVOS
19
- */
20
- static setConfig = async ({ directory }) => {
21
- const update = `\n# For TVOS\napp_tvos/build \napp_tvos/libs`;
22
- const filePath = path.join(directory, ".gitignore");
23
- const data = fs.readFileSync(filePath, { encoding: "utf8" });
24
- fs.writeFileSync(filePath, data + update);
25
- return Promise.resolve(".gitignore updated");
26
- };
27
- static getConfig = async () => {
28
- return {
29
- jscVersion: await TvosConfig.getJscVersion(),
30
- };
31
- };
32
- /**
33
- * Call aws to get latest jsc version
34
- */
35
- static getJscVersion = async () => {
36
- const requestParams = {
37
- packageName: "jscmodule",
38
- repository: "internal-apple-repository",
39
- format: "swift",
40
- namespace: "dana",
41
- };
42
- return await addDeviceHelper.getLatestPackageVersion(requestParams);
43
- };
44
- };
45
- export default TvosConfig;
@@ -1,14 +0,0 @@
1
- import DeviceConfig from "./deviceConfig.js";
2
- import { LIGHTNING, CSS } from "../../../common/const/deviceConst.js";
3
- const VidaaConfig = class extends DeviceConfig {
4
- // eslint-disable-next-line @typescript-eslint/require-await
5
- static getConfig = async () => {
6
- return {
7
- renderers: [LIGHTNING, CSS],
8
- };
9
- };
10
- static setConfig = () => {
11
- return Promise.resolve("Vidaa configuration done");
12
- };
13
- };
14
- export default VidaaConfig;
@@ -1,140 +0,0 @@
1
- /*
2
- * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
3
- * All Rights Reserved
4
- *
5
- * All information contained herein is proprietary and confidential.
6
- * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
7
- * prior written permission is obtained from Wiztivi.
8
- * No warranty, explicit or implicit, provided.
9
- * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
10
- *
11
- */
12
- import * as prompts from "@clack/prompts";
13
- import ComponentHelper from "../../addComponent/helper/ComponentHelper.js";
14
- import fs from "node:fs";
15
- import path from "node:path";
16
- import DeviceConfig from "./deviceConfig.js";
17
- import colors from "picocolors";
18
- import { DEFAULT_IMAGE_URL } from "../../createApp/const/setupConst.js";
19
- import { validInputLength } from "../../../common/helpers/InputValidator.js";
20
- import { CSS } from "../../../common/const/deviceConst.js";
21
- const WebosConfig = class extends DeviceConfig {
22
- static appConfig = {
23
- css: {
24
- "template-webos_css": {
25
- mixins: ["default", "webos"],
26
- base: {
27
- name: "Webos",
28
- vendors: ["@dana/vendor-components", "@dana/vendor-shaka", "@dana/vendor-webos-css"],
29
- },
30
- },
31
- },
32
- lightning: {
33
- "template-webos_lightning": {
34
- mixins: ["default", "webos"],
35
- base: {
36
- name: "Webos",
37
- vendors: ["@dana/vendor-components", "@dana/vendor-shaka", "@dana/vendor-webos-lightning"],
38
- },
39
- },
40
- },
41
- };
42
- /**
43
- * Ask the appId
44
- */
45
- static _askAppId = async () => {
46
- const errorMessage = "AppId is required !";
47
- const appId = (await prompts.text({
48
- message: "What is the appId ?",
49
- placeholder: "com.yourname.ui",
50
- validate: (value) => validInputLength(value, errorMessage),
51
- }));
52
- ComponentHelper.handleCancellation(appId);
53
- return appId;
54
- };
55
- /**
56
- * Ask the vendor name
57
- */
58
- static _askVendorName = async () => {
59
- const errorMessage = "VendorName is required !";
60
- const vendor = (await prompts.text({
61
- message: "What is the vendor name?",
62
- placeholder: "Wiztivi",
63
- initialValue: "Wiztivi",
64
- validate: (value) => validInputLength(value, errorMessage),
65
- }));
66
- ComponentHelper.handleCancellation(vendor);
67
- return vendor;
68
- };
69
- /**
70
- * Ask the app title
71
- * @returns {Promise<String>}
72
- */
73
- static _askAppTitle = async () => {
74
- const errorMessage = "App title is required !";
75
- const appTitle = (await prompts.text({
76
- message: "What is app name (to be displayed on store and webOS devices)?",
77
- placeholder: "My app",
78
- initialValue: "Dana UI",
79
- validate: (value) => validInputLength(value, errorMessage),
80
- }));
81
- ComponentHelper.handleCancellation(appTitle);
82
- return appTitle;
83
- };
84
- /**
85
- * Get the app icon url
86
- * @returns {String}
87
- */
88
- static _getAppIcon = () => {
89
- return Promise.resolve(DEFAULT_IMAGE_URL);
90
- };
91
- /**
92
- * Ask back handling
93
- * @returns {Promise<boolean>}
94
- */
95
- static _askBackHistory = async () => {
96
- const backHistory = (await prompts.confirm({
97
- message: "Does your app handle the back button manually ?",
98
- }));
99
- ComponentHelper.handleCancellation(backHistory);
100
- return backHistory;
101
- };
102
- /**
103
- * Asks for mandatory app.config properties
104
- * @returns {Promise<Object>}
105
- */
106
- static getAppConfigProperties = async () => {
107
- const data = (await prompts.group({
108
- appId: () => this._askAppId(),
109
- appVendor: () => this._askVendorName(),
110
- appTitle: () => this._askAppTitle(),
111
- icon: () => this._getAppIcon(),
112
- largeIcon: () => this._getAppIcon(),
113
- disableBackHistoryAPI: () => this._askBackHistory(),
114
- }, {
115
- onCancel: () => {
116
- prompts.cancel("Webos configuration cancelled.");
117
- process.exit(0);
118
- },
119
- }));
120
- ComponentHelper.handleCancellation(data);
121
- return data;
122
- };
123
- static getConfig = async () => {
124
- prompts.log.info(colors.bold("Let's configure LG"));
125
- return {
126
- renderers: [CSS],
127
- device: await this.getAppConfigProperties(),
128
- };
129
- };
130
- static setConfig = ({ directory, config }) => {
131
- const filePath = path.join(directory, "profiles", "app.config.webos.json");
132
- let jsonData = JSON.parse(fs.readFileSync(filePath).toString());
133
- jsonData.webos ??= { device: {} };
134
- jsonData.webos.device = { ...jsonData.webos?.device, ...config.device };
135
- jsonData = this.updateProfileJsonWithRenderers(jsonData, config.renderers);
136
- fs.writeFileSync(filePath, JSON.stringify(jsonData, null, 4));
137
- return Promise.resolve("Webos configuration done");
138
- };
139
- };
140
- export default WebosConfig;