@wiztivi/dana-cli 0.0.2 → 0.0.6

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 (147) hide show
  1. package/bin/dana.js +1 -1
  2. package/dist/commands/addComponent/addMenu/add-menu.js +45 -0
  3. package/dist/commands/addComponent/addMenu/addMenuDefinition.js +16 -0
  4. package/dist/commands/addComponent/addRail/add-rail.js +42 -0
  5. package/dist/commands/addComponent/addRail/addRailDefinition.js +26 -0
  6. package/dist/commands/addComponent/addScreen/add-screen.js +33 -0
  7. package/dist/commands/addComponent/addScreen/addScreenDefinition.js +13 -0
  8. package/dist/commands/addComponent/addScrollView/add-scrollView.js +31 -0
  9. package/dist/commands/addComponent/addScrollView/addScrollViewDefinition.js +13 -0
  10. package/dist/{configs → commands/addComponent/config}/ComponentConfig.d.ts +2 -2
  11. package/dist/{configs → commands/addComponent/config}/ComponentConfig.js +25 -63
  12. package/dist/commands/addComponent/config/componentTypes.js +1 -0
  13. package/dist/commands/addComponent/const/componentConst.js +19 -0
  14. package/dist/{const → commands/addComponent/const}/defaultConfig.d.ts +1 -1
  15. package/dist/commands/addComponent/const/defaultConfig.js +24 -0
  16. package/dist/{const → commands/addComponent/const}/navigationConst.d.ts +1 -1
  17. package/dist/{const → commands/addComponent/const}/navigationConst.js +7 -13
  18. package/dist/commands/{createComponent.d.ts → addComponent/createComponent.d.ts} +1 -1
  19. package/dist/commands/addComponent/createComponent.js +41 -0
  20. package/dist/{helpers → commands/addComponent/helper}/ComponentHelper.d.ts +2 -1
  21. package/dist/commands/addComponent/helper/ComponentHelper.js +77 -0
  22. package/dist/commands/addDevice/add-device.js +88 -0
  23. package/dist/commands/addDevice/addDeviceDefinition.js +11 -0
  24. package/dist/{configs → commands/addDevice}/deviceConfig/androidtvConfig.d.ts +1 -1
  25. package/dist/commands/addDevice/deviceConfig/androidtvConfig.js +148 -0
  26. package/dist/{types/createApp → commands/addDevice/deviceConfig}/configTypes.js +1 -2
  27. package/dist/{configs → commands/addDevice}/deviceConfig/deviceConfig.js +3 -5
  28. package/dist/{configs → commands/addDevice}/deviceConfig/tizenConfig.d.ts +1 -1
  29. package/dist/{configs → commands/addDevice}/deviceConfig/tizenConfig.js +11 -16
  30. package/dist/commands/addDevice/deviceConfig/tvosConfig.js +27 -0
  31. package/dist/{configs → commands/addDevice}/deviceConfig/webosConfig.d.ts +2 -2
  32. package/dist/{configs → commands/addDevice}/deviceConfig/webosConfig.js +27 -66
  33. package/dist/{helpers/CliHelper.d.ts → commands/addDevice/helper/addDeviceHelper.d.ts} +2 -2
  34. package/dist/{helpers/CliHelper.js → commands/addDevice/helper/addDeviceHelper.js} +8 -13
  35. package/dist/commands/authentication/authDefinition.js +19 -0
  36. package/dist/commands/{hooks → authentication}/authHook.js +5 -9
  37. package/dist/{const → commands/authentication}/authentConst.d.ts +1 -0
  38. package/dist/commands/authentication/authentConst.js +4 -0
  39. package/dist/commands/authentication/commands/login.js +103 -0
  40. package/dist/commands/authentication/commands/status.js +36 -0
  41. package/dist/{helpers → commands/authentication/helper}/CodeArtifactHelper.d.ts +1 -1
  42. package/dist/commands/authentication/helper/CodeArtifactHelper.js +46 -0
  43. package/dist/commands/authentication/helper/CredentialsHelper.js +15 -0
  44. package/dist/commands/commandHelp/customHelp.js +26 -0
  45. package/dist/commands/completion/completion.js +48 -0
  46. package/dist/commands/completion/completionDefinition.js +12 -0
  47. package/dist/commands/createApp/const/setupConst.d.ts +3 -0
  48. package/dist/{const/createApp → commands/createApp/const}/setupConst.js +2 -6
  49. package/dist/commands/createApp/createApp.js +92 -0
  50. package/dist/commands/createApp/createAppDefinition.js +17 -0
  51. package/dist/{helpers/createApp/ScriptHelper.d.ts → commands/createApp/helpers/CreateAppHelper.d.ts} +15 -13
  52. package/dist/commands/createApp/helpers/CreateAppHelper.js +105 -0
  53. package/dist/{helpers/createApp → commands/createApp/helpers}/SetupChecker.d.ts +1 -1
  54. package/dist/commands/createApp/helpers/SetupChecker.js +90 -0
  55. package/dist/common/commonConst.d.ts +1 -0
  56. package/dist/common/commonConst.js +1 -0
  57. package/dist/{const/createApp → common/const}/deviceConst.js +1 -14
  58. package/dist/common/const/exitCodeConst.js +7 -0
  59. package/dist/{helpers/createApp → common/helpers}/CreateFileHelper.d.ts +1 -1
  60. package/dist/common/helpers/CreateFileHelper.js +79 -0
  61. package/dist/{helpers/createApp → common/helpers}/InputValidator.js +8 -16
  62. package/dist/{helpers/createApp → common/helpers}/InstallHelper.d.ts +1 -1
  63. package/dist/{helpers/createApp → common/helpers}/InstallHelper.js +20 -22
  64. package/dist/{helpers/createApp → common/helpers}/UpdateFileHelper.d.ts +1 -1
  65. package/dist/common/helpers/UpdateFileHelper.js +124 -0
  66. package/dist/{helpers/createApp → common/helpers}/UserInputGetter.d.ts +2 -1
  67. package/dist/common/helpers/UserInputGetter.js +115 -0
  68. package/dist/common/helpers/handlebarsHelper.js +21 -0
  69. package/dist/{helpers → common/helpers}/stringHelper.d.ts +1 -1
  70. package/dist/common/helpers/stringHelper.js +6 -0
  71. package/dist/common/translation/translation.js +3 -0
  72. package/dist/{types/createApp → common/types}/helperTypes.d.ts +17 -5
  73. package/dist/{types/createApp → common/types}/helperTypes.js +1 -3
  74. package/dist/index.js +2 -4
  75. package/dist/program.js +30 -35
  76. package/package.json +7 -4
  77. package/dist/commands/add-device.js +0 -126
  78. package/dist/commands/add-menu.js +0 -51
  79. package/dist/commands/add-rail.js +0 -48
  80. package/dist/commands/add-screen.js +0 -71
  81. package/dist/commands/add-scrollView.js +0 -37
  82. package/dist/commands/auth/login.js +0 -141
  83. package/dist/commands/auth/status.js +0 -76
  84. package/dist/commands/commandDefinitions/addDeviceDefinition.js +0 -16
  85. package/dist/commands/commandDefinitions/addMenuDefinition.js +0 -21
  86. package/dist/commands/commandDefinitions/addRailDefinition.js +0 -31
  87. package/dist/commands/commandDefinitions/addScreenDefinition.js +0 -18
  88. package/dist/commands/commandDefinitions/addScrollViewDefinition.js +0 -18
  89. package/dist/commands/commandDefinitions/authDefinition.js +0 -23
  90. package/dist/commands/commandDefinitions/completionDefinition.js +0 -17
  91. package/dist/commands/commandDefinitions/createAppDefinition.js +0 -22
  92. package/dist/commands/completion.js +0 -84
  93. package/dist/commands/createApp.js +0 -130
  94. package/dist/commands/createComponent.js +0 -81
  95. package/dist/commands/help/customHelp.js +0 -31
  96. package/dist/configs/deviceConfig/androidtvConfig.js +0 -186
  97. package/dist/configs/deviceConfig/tvosConfig.js +0 -32
  98. package/dist/const/authentConst.js +0 -6
  99. package/dist/const/componentConst.js +0 -22
  100. package/dist/const/createApp/setupConst.d.ts +0 -3
  101. package/dist/const/defaultConfig.js +0 -27
  102. package/dist/const/exitCodeConst.js +0 -10
  103. package/dist/helpers/CodeArtifactHelper.js +0 -52
  104. package/dist/helpers/ComponentHelper.js +0 -105
  105. package/dist/helpers/CredentialsHelper.js +0 -22
  106. package/dist/helpers/createApp/CreateFileHelper.js +0 -84
  107. package/dist/helpers/createApp/ScriptHelper.js +0 -142
  108. package/dist/helpers/createApp/SetupChecker.js +0 -128
  109. package/dist/helpers/createApp/UpdateFileHelper.js +0 -121
  110. package/dist/helpers/createApp/UserInputGetter.js +0 -145
  111. package/dist/helpers/handlebarsHelper.js +0 -26
  112. package/dist/helpers/stringHelper.js +0 -11
  113. package/dist/translation/translation.js +0 -8
  114. package/dist/types/componentTypes.js +0 -2
  115. package/dist/types/genericTypes.d.ts +0 -17
  116. package/dist/types/genericTypes.js +0 -2
  117. /package/dist/commands/{add-menu.d.ts → addComponent/addMenu/add-menu.d.ts} +0 -0
  118. /package/dist/commands/{commandDefinitions → addComponent/addMenu}/addMenuDefinition.d.ts +0 -0
  119. /package/dist/commands/{add-rail.d.ts → addComponent/addRail/add-rail.d.ts} +0 -0
  120. /package/dist/commands/{commandDefinitions → addComponent/addRail}/addRailDefinition.d.ts +0 -0
  121. /package/dist/commands/{add-screen.d.ts → addComponent/addScreen/add-screen.d.ts} +0 -0
  122. /package/dist/commands/{commandDefinitions → addComponent/addScreen}/addScreenDefinition.d.ts +0 -0
  123. /package/dist/commands/{add-scrollView.d.ts → addComponent/addScrollView/add-scrollView.d.ts} +0 -0
  124. /package/dist/commands/{commandDefinitions → addComponent/addScrollView}/addScrollViewDefinition.d.ts +0 -0
  125. /package/dist/{types → commands/addComponent/config}/componentTypes.d.ts +0 -0
  126. /package/dist/{const → commands/addComponent/const}/componentConst.d.ts +0 -0
  127. /package/dist/commands/{add-device.d.ts → addDevice/add-device.d.ts} +0 -0
  128. /package/dist/commands/{commandDefinitions → addDevice}/addDeviceDefinition.d.ts +0 -0
  129. /package/dist/{types/createApp → commands/addDevice/deviceConfig}/configTypes.d.ts +0 -0
  130. /package/dist/{configs → commands/addDevice}/deviceConfig/deviceConfig.d.ts +0 -0
  131. /package/dist/{configs → commands/addDevice}/deviceConfig/tvosConfig.d.ts +0 -0
  132. /package/dist/commands/{commandDefinitions → authentication}/authDefinition.d.ts +0 -0
  133. /package/dist/commands/{hooks → authentication}/authHook.d.ts +0 -0
  134. /package/dist/commands/{auth → authentication/commands}/login.d.ts +0 -0
  135. /package/dist/commands/{auth → authentication/commands}/status.d.ts +0 -0
  136. /package/dist/{helpers → commands/authentication/helper}/CredentialsHelper.d.ts +0 -0
  137. /package/dist/commands/{help → commandHelp}/customHelp.d.ts +0 -0
  138. /package/dist/commands/{completion.d.ts → completion/completion.d.ts} +0 -0
  139. /package/dist/commands/{commandDefinitions → completion}/completionDefinition.d.ts +0 -0
  140. /package/dist/commands/{createApp.d.ts → createApp/createApp.d.ts} +0 -0
  141. /package/dist/commands/{commandDefinitions → createApp}/createAppDefinition.d.ts +0 -0
  142. /package/dist/{const/createApp → common/const}/deviceConst.d.ts +0 -0
  143. /package/dist/{const → common/const}/exitCodeConst.d.ts +0 -0
  144. /package/dist/{helpers/createApp → common/helpers}/InputValidator.d.ts +0 -0
  145. /package/dist/{helpers → common/helpers}/handlebarsHelper.d.ts +0 -0
  146. /package/dist/{translation → common/translation}/en.json +0 -0
  147. /package/dist/{translation → common/translation}/translation.d.ts +0 -0
package/bin/dana.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require("../dist/index");
3
+ import("../dist/index.js");
@@ -0,0 +1,45 @@
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 { BUTTON_ITEM_VIEW } from "../const/componentConst.js";
13
+ import createComponent from "../createComponent.js";
14
+ import process from "node:process";
15
+ import path from "node:path";
16
+ import { cpSync } from "node:fs";
17
+ import ComponentConfig from "../config/ComponentConfig.js";
18
+ import { MENU_DEFAULT_CONFIG } from "../const/defaultConfig.js";
19
+ import ComponentHelper from "../helper/ComponentHelper.js";
20
+ const addMenu = async (name, options) => {
21
+ const data = { ...options };
22
+ if (name) {
23
+ data.name = name;
24
+ }
25
+ const menuConfig = {
26
+ ...data,
27
+ ...(await ComponentConfig.menuConfig(data)),
28
+ };
29
+ const componentList = [menuConfig];
30
+ if (!data.custom) {
31
+ componentList.push({ type: BUTTON_ITEM_VIEW, name: data.itemView ?? MENU_DEFAULT_CONFIG.itemView });
32
+ }
33
+ createComponent(componentList);
34
+ if (!data.custom) {
35
+ const currentDirectory = process.cwd();
36
+ const modulePath = ComponentHelper.getTemplatePath();
37
+ const mockPath = path.join(path.dirname(modulePath), "mocks", "menuMock.json");
38
+ const iconPath = path.join(path.dirname(modulePath), "icons");
39
+ const mockFinalPath = path.resolve(currentDirectory, "menuMock.json");
40
+ const iconFinalPath = path.resolve(currentDirectory, "./images/icons");
41
+ cpSync(mockPath, mockFinalPath);
42
+ cpSync(iconPath, iconFinalPath, { recursive: true });
43
+ }
44
+ };
45
+ export default addMenu;
@@ -0,0 +1,16 @@
1
+ import { Command } from "commander";
2
+ import addMenu from "./add-menu.js";
3
+ import translation from "../../../common/translation/translation.js";
4
+ const addMenuDefinition = () => {
5
+ const command = new Command("add-menu");
6
+ command
7
+ .description(translation["command.menu.description"])
8
+ .argument("[name]", translation["command.component.name"])
9
+ .option("-cm, --custom", translation["command.component.customization"])
10
+ .option("-i, --itemView <itemView>", translation["command.menu.option.itemView"])
11
+ .option("-m, --itemMargin <itemMargin>", translation["command.menu.option.itemMargin"])
12
+ .option("-d, --direction <direction>", translation["command.rail.option.direction"])
13
+ .action(addMenu);
14
+ return command;
15
+ };
16
+ export default addMenuDefinition;
@@ -0,0 +1,42 @@
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 { TILE_VIEW } from "../const/componentConst.js";
13
+ import createComponent from "../createComponent.js";
14
+ import process from "node:process";
15
+ import path from "node:path";
16
+ import { cpSync } from "node:fs";
17
+ import ComponentConfig from "../config/ComponentConfig.js";
18
+ import { RAIL_DEFAULT_CONFIG } from "../const/defaultConfig.js";
19
+ import ComponentHelper from "../helper/ComponentHelper.js";
20
+ const addRail = async (name, options) => {
21
+ const data = { ...options };
22
+ if (name) {
23
+ data.name = name;
24
+ }
25
+ const railConfig = {
26
+ ...data,
27
+ ...(await ComponentConfig.railConfig(data)),
28
+ };
29
+ const componentList = [railConfig];
30
+ if (!data.custom) {
31
+ componentList.push({ type: TILE_VIEW, name: data.itemView ?? RAIL_DEFAULT_CONFIG.itemView });
32
+ }
33
+ createComponent(componentList);
34
+ if (!data.custom) {
35
+ const currentDirectory = process.cwd();
36
+ const modulePath = ComponentHelper.getTemplatePath();
37
+ const mockPath = path.join(path.dirname(modulePath), "mocks", "railMock.json");
38
+ const finalPath = path.resolve(currentDirectory, "railMock.json");
39
+ cpSync(mockPath, finalPath);
40
+ }
41
+ };
42
+ export default addRail;
@@ -0,0 +1,26 @@
1
+ import { Command } from "commander";
2
+ import addRail from "./add-rail.js";
3
+ import { NAVIGATION_TYPES, DIRECTION_TYPES } from "../const/navigationConst.js";
4
+ import translation from "../../../common/translation/translation.js";
5
+ import { optionsListString } from "../../../common/helpers/stringHelper.js";
6
+ const addRailDefinition = () => {
7
+ const command = new Command("add-rail");
8
+ command
9
+ .description(translation["command.rail.description"])
10
+ .argument("[name]", translation["command.component.name"])
11
+ .option("-cm, --custom", translation["command.component.customization"])
12
+ .option("-n, --navigation <navigation>", translation["command.rail.option.navigation"])
13
+ .option("-d, --direction <direction>", translation["command.rail.option.direction"])
14
+ .option("-c, --cyclic", translation["command.rail.option.cyclic"])
15
+ .option("-i, --itemView <itemView>", translation["command.menu.option.itemView"])
16
+ .addHelpText("after", `
17
+ ${translation["help.option.title"]}
18
+ -navigation: ${optionsListString(NAVIGATION_TYPES)}
19
+ -direction: ${optionsListString(DIRECTION_TYPES)}
20
+
21
+ More about rail feature, ${translation["help.option.check"]} https://doc.dana-framework.com/docs/vendorcomponents/recycling-listview
22
+ `)
23
+ .action(addRail);
24
+ return command;
25
+ };
26
+ export default addRailDefinition;
@@ -0,0 +1,33 @@
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 { SCREEN, VOD_SCREEN } from "../const/componentConst.js";
13
+ import createComponent from "../createComponent.js";
14
+ import addMenu from "../addMenu/add-menu.js";
15
+ import addScrollView from "../addScrollView/add-scrollView.js";
16
+ import * as prompts from "@clack/prompts";
17
+ const addScreen = async (name, options) => {
18
+ try {
19
+ const data = {
20
+ name: name ?? "Mock",
21
+ type: options?.screenType ?? SCREEN,
22
+ };
23
+ if (options?.screenType === VOD_SCREEN) {
24
+ await addMenu(VOD_SCREEN, {});
25
+ await addScrollView(VOD_SCREEN, {});
26
+ }
27
+ createComponent([data]);
28
+ }
29
+ catch (e) {
30
+ prompts.log.info(`Error creating screen: ${e.message}`);
31
+ }
32
+ };
33
+ export default addScreen;
@@ -0,0 +1,13 @@
1
+ import { Command } from "commander";
2
+ import translation from "../../../common/translation/translation.js";
3
+ import addScreen from "./add-screen.js";
4
+ const addScreenDefinition = () => {
5
+ const command = new Command("add-screen");
6
+ command
7
+ .description(translation["command.screen.description"])
8
+ .argument("[name]", translation["command.component.name"])
9
+ .option("-s, --screenType [screenType]", translation["command.screen.option.type"])
10
+ .action(addScreen);
11
+ return command;
12
+ };
13
+ export default addScreenDefinition;
@@ -0,0 +1,31 @@
1
+ import { SCROLL_ITEM, TILE_VIEW } from "../const/componentConst.js";
2
+ import createComponent from "../createComponent.js";
3
+ import process from "node:process";
4
+ import path from "node:path";
5
+ import { cpSync } from "node:fs";
6
+ import { SCROLLVIEW_DEFAULT_CONFIG } from "../const/defaultConfig.js";
7
+ import ComponentConfig from "../config/ComponentConfig.js";
8
+ import ComponentHelper from "../helper/ComponentHelper.js";
9
+ const addScrollView = async (name, options) => {
10
+ const data = { ...options };
11
+ if (name) {
12
+ data.name = name;
13
+ }
14
+ const scrollViewConfig = {
15
+ ...data,
16
+ ...(await ComponentConfig.scrollViewConfig(data)),
17
+ };
18
+ const componentList = [scrollViewConfig];
19
+ if (!data.custom) {
20
+ componentList.push({ type: SCROLL_ITEM, name: data.itemView ?? SCROLLVIEW_DEFAULT_CONFIG.itemView }, { type: TILE_VIEW, name: "mockTile" });
21
+ }
22
+ createComponent(componentList);
23
+ if (!data.custom) {
24
+ const currentDirectory = process.cwd();
25
+ const modulePath = ComponentHelper.getTemplatePath();
26
+ const mockPath = path.join(path.dirname(modulePath), "mocks", "scrollViewMock.json");
27
+ const finalPath = path.resolve(currentDirectory, "scrollViewMock.json");
28
+ cpSync(mockPath, finalPath);
29
+ }
30
+ };
31
+ export default addScrollView;
@@ -0,0 +1,13 @@
1
+ import { Command } from "commander";
2
+ import addScrollView from "./add-scrollView.js";
3
+ import translation from "../../../common/translation/translation.js";
4
+ const addScrollViewDefinition = () => {
5
+ return new Command("add-scrollView")
6
+ .description(translation["command.scrollView.description"])
7
+ .argument("[name]", translation["command.component.name"])
8
+ .option("-cm, --custom", translation["command.component.customization"])
9
+ .option("-i, --itemView <itemView>", translation["command.menu.option.itemView"])
10
+ .option("-m, --itemMargin <itemMargin>", translation["command.menu.option.itemMargin"])
11
+ .action(addScrollView);
12
+ };
13
+ export default addScrollViewDefinition;
@@ -1,5 +1,5 @@
1
- import { RailConfig, MenuConfig, ScreenConfig, ScrollViewConfig } from "../types/componentTypes";
2
- import { ConfigOptions, OptionList } from "../types/genericTypes";
1
+ import { RailConfig, MenuConfig, ScreenConfig, ScrollViewConfig } from "./componentTypes.js";
2
+ import { ConfigOptions, OptionList } from "../../../common/types/helperTypes.js";
3
3
  interface AskComponentParam {
4
4
  componentOption: string;
5
5
  optionList: OptionList;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
3
  * All Rights Reserved
@@ -10,50 +9,13 @@
10
9
  * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
10
  *
12
11
  */
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || (function () {
30
- var ownKeys = function(o) {
31
- ownKeys = Object.getOwnPropertyNames || function (o) {
32
- var ar = [];
33
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
- return ar;
35
- };
36
- return ownKeys(o);
37
- };
38
- return function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
45
- })();
46
- var __importDefault = (this && this.__importDefault) || function (mod) {
47
- return (mod && mod.__esModule) ? mod : { "default": mod };
48
- };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- const prompts = __importStar(require("@clack/prompts"));
51
- const ComponentHelper_1 = __importDefault(require("../helpers/ComponentHelper"));
52
- const navigationConst_1 = require("../const/navigationConst");
53
- const exitCodeConst_1 = require("../const/exitCodeConst");
54
- const InputValidator_1 = require("../helpers/createApp/InputValidator");
55
- const defaultConfig_1 = require("../const/defaultConfig");
56
- const stringHelper_1 = require("../helpers/stringHelper");
12
+ import * as prompts from "@clack/prompts";
13
+ import ComponentHelper from "../helper/ComponentHelper.js";
14
+ import { DIRECTION_TYPES, NAVIGATION_TYPES } from "../const/navigationConst.js";
15
+ import { CANCEL } from "../../../common/const/exitCodeConst.js";
16
+ import { validInputLength, validNumber } from "../../../common/helpers/InputValidator.js";
17
+ import { RAIL_DEFAULT_CONFIG, MENU_DEFAULT_CONFIG, SCROLLVIEW_DEFAULT_CONFIG } from "../const/defaultConfig.js";
18
+ import { capitalizeFirstLetter } from "../../../common/helpers/stringHelper.js";
57
19
  const ComponentConfig = class {
58
20
  /**
59
21
  * Get component or element name from user
@@ -64,23 +26,23 @@ const ComponentConfig = class {
64
26
  name = (await prompts.text({
65
27
  message: `${componentType} name`,
66
28
  placeholder: "Placeholder Name",
67
- validate: (value) => (0, InputValidator_1.validInputLength)(value, errorMessage),
29
+ validate: (value) => validInputLength(value, errorMessage),
68
30
  }));
69
- ComponentHelper_1.default.handleCancellation(name);
31
+ ComponentHelper.handleCancellation(name);
70
32
  }
71
33
  return name.trim();
72
34
  };
73
35
  static askNumber = async (valueType, numberValue) => {
74
36
  const errorMessage = `${valueType} should be a number`;
75
37
  const basicMessage = `Enter a value for ${valueType}`;
76
- const message = numberValue && isNaN(numberValue) ? `${numberValue} is not a number. ${basicMessage}` : basicMessage;
77
- if (!numberValue || isNaN(numberValue)) {
38
+ const message = numberValue && Number.isNaN(numberValue) ? `${numberValue} is not a number. ${basicMessage}` : basicMessage;
39
+ if (!numberValue || Number.isNaN(numberValue)) {
78
40
  const numberValue = (await prompts.text({
79
41
  message,
80
42
  placeholder: "00",
81
- validate: (value) => (0, InputValidator_1.validNumber)(value, errorMessage),
43
+ validate: (value) => validNumber(value, errorMessage),
82
44
  }));
83
- ComponentHelper_1.default.handleCancellation(numberValue);
45
+ ComponentHelper.handleCancellation(numberValue);
84
46
  return +numberValue;
85
47
  }
86
48
  return numberValue;
@@ -94,10 +56,10 @@ const ComponentConfig = class {
94
56
  */
95
57
  static askComponentOption = async (dataOption) => {
96
58
  const { componentOption, optionList, optionType } = dataOption;
97
- let finalOption = ComponentHelper_1.default.checkOption(componentOption, optionList, optionType);
59
+ let finalOption = ComponentHelper.checkOption(componentOption, optionList, optionType);
98
60
  if (!finalOption) {
99
- const selectionMessage = `${(0, stringHelper_1.capitalizeFirstLetter)(optionType)} option`;
100
- finalOption = await ComponentHelper_1.default.selectionFactory(optionType, optionList, selectionMessage);
61
+ const selectionMessage = `${capitalizeFirstLetter(optionType)} option`;
62
+ finalOption = await ComponentHelper.selectionFactory(optionType, optionList, selectionMessage);
101
63
  }
102
64
  return finalOption;
103
65
  };
@@ -106,31 +68,31 @@ const ComponentConfig = class {
106
68
  const cyclic = (await prompts.confirm({
107
69
  message: "Cyclic list ?",
108
70
  }));
109
- ComponentHelper_1.default.handleCancellation(cyclic);
71
+ ComponentHelper.handleCancellation(cyclic);
110
72
  return cyclic;
111
73
  }
112
74
  return data.cyclic;
113
75
  };
114
76
  static handlePromptCancel = () => {
115
77
  prompts.cancel("Operation cancelled.");
116
- process.exit(exitCodeConst_1.CANCEL);
78
+ process.exit(CANCEL);
117
79
  };
118
80
  static getDefaultConfig = (data, defaultConfig) => {
119
81
  return { ...defaultConfig, ...data, addMock: !data.custom };
120
82
  };
121
83
  static railConfig = async (data) => {
122
- const config = ComponentConfig.getDefaultConfig(data, defaultConfig_1.RAIL_DEFAULT_CONFIG);
84
+ const config = ComponentConfig.getDefaultConfig(data, RAIL_DEFAULT_CONFIG);
123
85
  if (data.custom) {
124
86
  const customConfig = await prompts.group({
125
87
  name: async () => await this.askName("rail", data.name),
126
88
  navigation: async () => await this.askComponentOption({
127
89
  componentOption: data.navigation,
128
- optionList: navigationConst_1.NAVIGATION_TYPES,
90
+ optionList: NAVIGATION_TYPES,
129
91
  optionType: "navigation",
130
92
  }),
131
93
  direction: async () => await this.askComponentOption({
132
94
  componentOption: data.direction,
133
- optionList: navigationConst_1.DIRECTION_TYPES,
95
+ optionList: DIRECTION_TYPES,
134
96
  optionType: "direction",
135
97
  }),
136
98
  isCyclic: async () => await this.askCyclic(data),
@@ -141,7 +103,7 @@ const ComponentConfig = class {
141
103
  return config;
142
104
  };
143
105
  static menuConfig = async (data) => {
144
- const config = ComponentConfig.getDefaultConfig(data, defaultConfig_1.MENU_DEFAULT_CONFIG);
106
+ const config = ComponentConfig.getDefaultConfig(data, MENU_DEFAULT_CONFIG);
145
107
  if (data.custom) {
146
108
  const customConfig = await prompts.group({
147
109
  name: async () => await this.askName("menu", data.name),
@@ -149,7 +111,7 @@ const ComponentConfig = class {
149
111
  itemMargin: async () => await this.askNumber("item margin", data.itemMargin),
150
112
  direction: async () => await this.askComponentOption({
151
113
  componentOption: data.direction,
152
- optionList: navigationConst_1.DIRECTION_TYPES,
114
+ optionList: DIRECTION_TYPES,
153
115
  optionType: "direction",
154
116
  }),
155
117
  }, { onCancel: () => ComponentConfig.handlePromptCancel() });
@@ -158,7 +120,7 @@ const ComponentConfig = class {
158
120
  return config;
159
121
  };
160
122
  static scrollViewConfig = async (data) => {
161
- const config = ComponentConfig.getDefaultConfig(data, defaultConfig_1.SCROLLVIEW_DEFAULT_CONFIG);
123
+ const config = ComponentConfig.getDefaultConfig(data, SCROLLVIEW_DEFAULT_CONFIG);
162
124
  if (data.custom) {
163
125
  const customConfig = await prompts.group({
164
126
  name: async () => await this.askName("scrollView", data.name),
@@ -175,4 +137,4 @@ const ComponentConfig = class {
175
137
  };
176
138
  };
177
139
  };
178
- exports.default = ComponentConfig;
140
+ export default ComponentConfig;
@@ -0,0 +1,19 @@
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 const MENU = "wtvMenuListView";
13
+ export const RAIL = "wtvRailListView";
14
+ export const TILE_VIEW = "tileView";
15
+ export const SCROLL_VIEW = "scrollView";
16
+ export const SCROLL_ITEM = "scrollItemView";
17
+ export const BUTTON_ITEM_VIEW = "ButtonItemView";
18
+ export const SCREEN = "screen";
19
+ export const VOD_SCREEN = "vod";
@@ -1,4 +1,4 @@
1
- import { MenuConfig, RailConfig, ScrollViewConfig } from "../types/componentTypes";
1
+ import { MenuConfig, RailConfig, ScrollViewConfig } from "../config/componentTypes.js";
2
2
  export declare const RAIL_DEFAULT_CONFIG: RailConfig;
3
3
  export declare const MENU_DEFAULT_CONFIG: MenuConfig;
4
4
  export declare const SCROLLVIEW_DEFAULT_CONFIG: ScrollViewConfig;
@@ -0,0 +1,24 @@
1
+ import { MENU, SCROLL_VIEW, RAIL } from "./componentConst.js";
2
+ export const RAIL_DEFAULT_CONFIG = {
3
+ navigation: "FixedNavigationType",
4
+ isCyclic: false,
5
+ direction: "horizontal",
6
+ name: "mockRail",
7
+ itemView: "mockTile",
8
+ type: RAIL,
9
+ addMock: true,
10
+ };
11
+ export const MENU_DEFAULT_CONFIG = {
12
+ name: "mockMenu",
13
+ itemMargin: 20,
14
+ itemView: "ButtonItem",
15
+ direction: "horizontal",
16
+ addMock: true,
17
+ type: MENU,
18
+ };
19
+ export const SCROLLVIEW_DEFAULT_CONFIG = {
20
+ name: "mock",
21
+ itemMargin: 550,
22
+ itemView: "Rail",
23
+ type: SCROLL_VIEW,
24
+ };
@@ -1,3 +1,3 @@
1
- import { OptionList } from "../types/genericTypes";
1
+ import { OptionList } from "../../../common/types/helperTypes.js";
2
2
  export declare const NAVIGATION_TYPES: OptionList;
3
3
  export declare const DIRECTION_TYPES: OptionList;
@@ -1,36 +1,30 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DIRECTION_TYPES = exports.NAVIGATION_TYPES = void 0;
7
- const picocolors_1 = __importDefault(require("picocolors"));
8
- exports.NAVIGATION_TYPES = [
1
+ import colors from "picocolors";
2
+ export const NAVIGATION_TYPES = [
9
3
  {
10
4
  value: "MFixedNavigationType",
11
- label: picocolors_1.default.bold("Fixed. ") + "Focus is fixed on the left side of the list.",
5
+ label: colors.bold("Fixed. ") + "Focus is fixed on the left side of the list.",
12
6
  command: "fixed",
13
7
  },
14
8
  {
15
9
  value: "MLMRNavigationType",
16
- label: picocolors_1.default.bold("Left-Middle-Right. ") +
10
+ label: colors.bold("Left-Middle-Right. ") +
17
11
  "Focus starts on the left side, then moves and stays to the middle, then goes to the right side when the list ends",
18
12
  command: "lmr",
19
13
  },
20
14
  {
21
15
  value: "MLRNavigationType",
22
- label: picocolors_1.default.bold("Left-Right. ") +
16
+ label: colors.bold("Left-Right. ") +
23
17
  " Focus moves in the chosen direction to the edge of the list. Then the list scrolls to show the next items.",
24
18
  command: "lr",
25
19
  },
26
20
  {
27
21
  value: "MPaginateNavigationType",
28
- label: picocolors_1.default.bold("Paginated. ") +
22
+ label: colors.bold("Paginated. ") +
29
23
  " Focus moves to the end of the visible items. Then, all items are replaced by new ones.",
30
24
  command: "paginated",
31
25
  },
32
26
  ];
33
- exports.DIRECTION_TYPES = [
27
+ export const DIRECTION_TYPES = [
34
28
  { value: `HORIZONTAL`, label: "HORIZONTAL", command: "h" },
35
29
  { value: `VERTICAL`, label: "VERTICAL", command: "v" },
36
30
  ];
@@ -1,3 +1,3 @@
1
- import { ConfigOptions } from "../types/genericTypes";
1
+ import { ConfigOptions } from "../../common/types/helperTypes.js";
2
2
  declare const createComponent: (componentList: ConfigOptions[]) => void;
3
3
  export default createComponent;
@@ -0,0 +1,41 @@
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 ComponentHelper from "./helper/ComponentHelper.js";
13
+ import path from "node:path";
14
+ import { writeFileSync } from "node:fs";
15
+ import { templateGenerator } from "../../common/helpers/handlebarsHelper.js";
16
+ import * as prompts from "@clack/prompts";
17
+ import { COMPONENT_ERROR } from "../../common/const/exitCodeConst.js";
18
+ import translation from "../../common/translation/translation.js";
19
+ const createSingleComponent = (data, currentDirectory, modulePath) => {
20
+ try {
21
+ const templatePath = path.join(path.dirname(modulePath), "components", `${data.type}.js.hbs`);
22
+ const output = templateGenerator(templatePath, data);
23
+ const finalPath = path.resolve(currentDirectory, ComponentHelper.normalizeFileName(data.type, data.name));
24
+ writeFileSync(finalPath, output, { encoding: "utf-8" });
25
+ prompts.log.success(`${data.name} ${translation["component.creation.success"]}`);
26
+ }
27
+ catch (e) {
28
+ const simpleMessage = `Failed to create component ${data.name}`;
29
+ const message = e instanceof Error ? `${simpleMessage}: ${e.message}` : simpleMessage;
30
+ prompts.log.error(message);
31
+ process.exit(COMPONENT_ERROR);
32
+ }
33
+ };
34
+ const createComponent = (componentList) => {
35
+ const currentDirectory = process.cwd();
36
+ const modulePath = ComponentHelper.getTemplatePath();
37
+ for (const data of componentList) {
38
+ createSingleComponent(data, currentDirectory, modulePath);
39
+ }
40
+ };
41
+ export default createComponent;
@@ -1,4 +1,4 @@
1
- import { OptionList, SelectionArray } from "../types/genericTypes";
1
+ import { OptionList, SelectionArray } from "../../../common/types/helperTypes.js";
2
2
  declare const ComponentHelper: {
3
3
  new (): {};
4
4
  readonly selectionFactory: (name: string, options: SelectionArray, message: string) => Promise<string>;
@@ -8,5 +8,6 @@ declare const ComponentHelper: {
8
8
  * Manage cancellation with CTRL+C
9
9
  */
10
10
  readonly handleCancellation: (value: unknown) => void;
11
+ readonly getTemplatePath: () => string;
11
12
  };
12
13
  export default ComponentHelper;