@wiztivi/dana-cli 0.0.4 → 0.0.7

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 (75) hide show
  1. package/bin/dana.js +1 -1
  2. package/dana_completion.sh +9 -9
  3. package/dist/README.md +46 -0
  4. package/dist/commands/addComponent/addMenu/add-menu.js +20 -25
  5. package/dist/commands/addComponent/addMenu/addMenuDefinition.js +12 -17
  6. package/dist/commands/addComponent/addRail/add-rail.js +17 -22
  7. package/dist/commands/addComponent/addRail/addRailDefinition.js +19 -24
  8. package/dist/commands/addComponent/addScreen/add-screen.js +11 -49
  9. package/dist/commands/addComponent/addScreen/addScreenDefinition.js +9 -14
  10. package/dist/commands/addComponent/addScrollView/add-scrollView.js +17 -22
  11. package/dist/commands/addComponent/addScrollView/addScrollViewDefinition.js +11 -16
  12. package/dist/commands/addComponent/config/ComponentConfig.d.ts +2 -2
  13. package/dist/commands/addComponent/config/ComponentConfig.js +23 -61
  14. package/dist/commands/addComponent/config/componentTypes.js +1 -2
  15. package/dist/commands/addComponent/const/componentConst.js +8 -11
  16. package/dist/commands/addComponent/const/defaultConfig.d.ts +1 -1
  17. package/dist/commands/addComponent/const/defaultConfig.js +7 -10
  18. package/dist/commands/addComponent/const/navigationConst.d.ts +1 -1
  19. package/dist/commands/addComponent/const/navigationConst.js +7 -13
  20. package/dist/commands/addComponent/createComponent.d.ts +1 -1
  21. package/dist/commands/addComponent/createComponent.js +15 -54
  22. package/dist/commands/addComponent/helper/ComponentHelper.d.ts +2 -1
  23. package/dist/commands/addComponent/helper/ComponentHelper.js +22 -50
  24. package/dist/commands/addDevice/add-device.js +38 -73
  25. package/dist/commands/addDevice/addDeviceDefinition.js +9 -14
  26. package/dist/commands/addDevice/deviceConfig/androidtvConfig.d.ts +1 -1
  27. package/dist/commands/addDevice/deviceConfig/androidtvConfig.js +39 -77
  28. package/dist/commands/addDevice/deviceConfig/configTypes.js +1 -2
  29. package/dist/commands/addDevice/deviceConfig/deviceConfig.js +1 -3
  30. package/dist/commands/addDevice/deviceConfig/tizenConfig.d.ts +1 -1
  31. package/dist/commands/addDevice/deviceConfig/tizenConfig.js +10 -15
  32. package/dist/commands/addDevice/deviceConfig/tvosConfig.js +8 -13
  33. package/dist/commands/addDevice/deviceConfig/webosConfig.d.ts +1 -1
  34. package/dist/commands/addDevice/deviceConfig/webosConfig.js +25 -63
  35. package/dist/commands/addDevice/helper/addDeviceHelper.js +7 -12
  36. package/dist/commands/authentication/authDefinition.js +14 -19
  37. package/dist/commands/authentication/authHook.js +5 -9
  38. package/dist/commands/authentication/authentConst.js +4 -7
  39. package/dist/commands/authentication/commands/login.js +29 -67
  40. package/dist/commands/authentication/commands/status.js +12 -52
  41. package/dist/commands/authentication/helper/CodeArtifactHelper.d.ts +1 -1
  42. package/dist/commands/authentication/helper/CodeArtifactHelper.js +14 -20
  43. package/dist/commands/authentication/helper/CredentialsHelper.js +8 -15
  44. package/dist/commands/commandHelp/customHelp.js +6 -11
  45. package/dist/commands/completion/completion.js +15 -51
  46. package/dist/commands/completion/completionDefinition.js +8 -13
  47. package/dist/commands/createApp/const/setupConst.js +1 -5
  48. package/dist/commands/createApp/createApp.js +42 -80
  49. package/dist/commands/createApp/createAppDefinition.js +13 -18
  50. package/dist/commands/createApp/helpers/CreateAppHelper.d.ts +9 -9
  51. package/dist/commands/createApp/helpers/CreateAppHelper.js +20 -58
  52. package/dist/commands/createApp/helpers/SetupChecker.d.ts +1 -1
  53. package/dist/commands/createApp/helpers/SetupChecker.js +14 -52
  54. package/dist/common/commonConst.js +1 -4
  55. package/dist/common/const/deviceConst.js +1 -14
  56. package/dist/common/const/exitCodeConst.js +7 -10
  57. package/dist/common/helpers/CreateFileHelper.d.ts +1 -1
  58. package/dist/common/helpers/CreateFileHelper.js +22 -27
  59. package/dist/common/helpers/InputValidator.js +7 -15
  60. package/dist/common/helpers/InstallHelper.d.ts +1 -1
  61. package/dist/common/helpers/InstallHelper.js +13 -18
  62. package/dist/common/helpers/UpdateFileHelper.d.ts +7 -1
  63. package/dist/common/helpers/UpdateFileHelper.js +46 -43
  64. package/dist/common/helpers/UserInputGetter.d.ts +1 -1
  65. package/dist/common/helpers/UserInputGetter.js +20 -58
  66. package/dist/common/helpers/handlebarsHelper.js +12 -17
  67. package/dist/common/helpers/stringHelper.d.ts +1 -1
  68. package/dist/common/helpers/stringHelper.js +2 -7
  69. package/dist/common/translation/translation.js +3 -8
  70. package/dist/common/types/helperTypes.d.ts +2 -2
  71. package/dist/common/types/helperTypes.js +1 -3
  72. package/dist/dana_completion.sh +9 -9
  73. package/dist/index.js +2 -4
  74. package/dist/program.js +30 -35
  75. package/package.json +9 -4
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");
@@ -11,13 +11,13 @@ dana_commands=(
11
11
  'add-scrollView'
12
12
  'add-screen'
13
13
  'auth'
14
+ 'create-app'
14
15
  )
15
16
 
16
17
  # Shared subcommand declarations
17
18
  login_sub="login"
18
19
  logout_sub="logout"
19
20
  status_sub="status"
20
-
21
21
  # Shared option declarations
22
22
  direction_opts="-d --direction"
23
23
  navigation_opts="-n --navigation"
@@ -26,12 +26,13 @@ margin_opts="-m --itemMargin"
26
26
  custom_opts="-cm --custom"
27
27
  item_view_opts="-i --itemView"
28
28
  org_opts="-o --org"
29
+ device_opts="-d --device"
30
+ tutorial_opts="-t, --tutorial"
29
31
 
30
32
  # Shared option values
31
33
  direction_values="h v"
32
34
  navigation_values="fixed lmr lr paginated"
33
35
  org_values="preprod"
34
-
35
36
  # Detect shell and load appropriate completion
36
37
  if [ -n "$BASH_VERSION" ]; then
37
38
  # Bash completion
@@ -40,7 +41,6 @@ if [ -n "$BASH_VERSION" ]; then
40
41
  local cur prev opts
41
42
  cur="${COMP_WORDS[COMP_CWORD]}"
42
43
  prev="${COMP_WORDS[COMP_CWORD-1]}"
43
-
44
44
  # Complete option values
45
45
  case "$prev" in
46
46
  -d|--direction)
@@ -56,13 +56,11 @@ if [ -n "$BASH_VERSION" ]; then
56
56
  return 0
57
57
  ;;
58
58
  esac
59
-
60
59
  # If we're completing the first argument (command)
61
60
  if [[ $COMP_CWORD -eq 1 ]]; then
62
61
  COMPREPLY=($(compgen -W "${dana_commands[*]}" -- "$cur"))
63
62
  return 0
64
63
  fi
65
-
66
64
  # If we're completing options for specific commands
67
65
  local cmd="${COMP_WORDS[1]}"
68
66
  case "$cmd" in
@@ -86,14 +84,16 @@ if [ -n "$BASH_VERSION" ]; then
86
84
  fi
87
85
  COMPREPLY=($(compgen -W "$opts" -- "$cur"))
88
86
  ;;
87
+ create-app)
88
+ opts="$device_opts $tutorial_opts"
89
+ COMPREPLY=($(compgen -W "$opts" -- "$cur"))
90
+ ;;
89
91
  *)
90
92
  COMPREPLY=()
91
93
  ;;
92
94
  esac
93
95
  }
94
-
95
96
  complete -F _dana dana
96
-
97
97
  elif [ -n "$ZSH_VERSION" ]; then
98
98
  # Zsh completion
99
99
  _dana() {
@@ -104,7 +104,6 @@ elif [ -n "$ZSH_VERSION" ]; then
104
104
  compadd -a commands
105
105
  return
106
106
  fi
107
-
108
107
  # Complete option values
109
108
  local prev=${words[CURRENT-1]}
110
109
  case "$prev" in
@@ -125,7 +124,6 @@ elif [ -n "$ZSH_VERSION" ]; then
125
124
  return
126
125
  ;;
127
126
  esac
128
-
129
127
  # Complete options for commands
130
128
  local cmd=${words[2]}
131
129
  case "$cmd" in
@@ -145,6 +143,8 @@ elif [ -n "$ZSH_VERSION" ]; then
145
143
  compadd -- ${=org_opts}
146
144
  fi
147
145
  ;;
146
+ create-app)
147
+ compadd -- ${device_opts} $={tutorial_opts}
148
148
  esac
149
149
  }
150
150
 
package/dist/README.md ADDED
@@ -0,0 +1,46 @@
1
+ ![Dana Logo](tools/templates/app-template/images/dana.png)
2
+
3
+ # Dana-cli
4
+
5
+ Dana is a JavaScript framework built for TV apps.
6
+ It aims at enabling the creation of natively performant TV applications on all currently available TV platforms.
7
+ Code once, deploy across all major platforms (Samsung Tizen, LG WebOS, Android TV, AppleTV, Xbox...) using a single codebase.
8
+
9
+ This cli is a companion tool made to help you boostrap an application with Dana.
10
+
11
+ ## Requirements
12
+
13
+ To be able to use the dana-cli, you will need:
14
+
15
+ - Node > 20,
16
+ - an account on [Dana Cloud Service](https://app.public.dana-framework.com/)
17
+
18
+ ## Getting started
19
+
20
+ First you'll need to use your account to authenticate to Dana Cloud Service platform:
21
+
22
+ ```bash
23
+ npx @wiztivi/dana-cli auth login
24
+ ```
25
+
26
+ This should open a browser and ask for your account credentials.
27
+
28
+ Then you can create a simple template of your application by running the following command:
29
+
30
+ ```bash
31
+ npx @wiztivi/dana-cli create-app <project-name>
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ Use the CLI to:
37
+
38
+ - create a new app project
39
+ - add device(s) easily to deploy your project on more platforms: `npx @wiztivi/dana-cli add-device`,
40
+ - add built-in components to your project: eg `npx @wiztivi/dana-cli add-menu`
41
+
42
+ To get all available options and more information:`npx @wiztivi/dana-cli help`
43
+
44
+ ## Screenshots
45
+
46
+ ![VOD Screen 1](images/vodScreen1.png)
@@ -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,18 +9,14 @@
10
9
  * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
10
  *
12
11
  */
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 componentConst_1 = require("../const/componentConst");
18
- const createComponent_1 = __importDefault(require("../createComponent"));
19
- const node_process_1 = __importDefault(require("node:process"));
20
- const node_path_1 = __importDefault(require("node:path"));
21
- const node_fs_1 = require("node:fs");
22
- const ComponentConfig_1 = __importDefault(require("../config/ComponentConfig"));
23
- const defaultConfig_1 = require("../const/defaultConfig");
24
- const commonConst_1 = require("../../../common/commonConst");
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";
25
20
  const addMenu = async (name, options) => {
26
21
  const data = { ...options };
27
22
  if (name) {
@@ -29,22 +24,22 @@ const addMenu = async (name, options) => {
29
24
  }
30
25
  const menuConfig = {
31
26
  ...data,
32
- ...(await ComponentConfig_1.default.menuConfig(data)),
27
+ ...(await ComponentConfig.menuConfig(data)),
33
28
  };
34
29
  const componentList = [menuConfig];
35
30
  if (!data.custom) {
36
- componentList.push({ type: componentConst_1.BUTTON_ITEM_VIEW, name: data.itemView ?? defaultConfig_1.MENU_DEFAULT_CONFIG.itemView });
31
+ componentList.push({ type: BUTTON_ITEM_VIEW, name: data.itemView ?? MENU_DEFAULT_CONFIG.itemView });
37
32
  }
38
- (0, createComponent_1.default)(componentList);
33
+ createComponent(componentList);
39
34
  if (!data.custom) {
40
- const currentDirectory = node_process_1.default.cwd();
41
- const modulePath = require.resolve(commonConst_1.TEMPLATE_MODULE);
42
- const mockPath = node_path_1.default.join(node_path_1.default.dirname(modulePath), "mocks", "menuMock.json");
43
- const iconPath = node_path_1.default.join(node_path_1.default.dirname(modulePath), "icons");
44
- const mockFinalPath = node_path_1.default.resolve(currentDirectory, "menuMock.json");
45
- const iconFinalPath = node_path_1.default.resolve(currentDirectory, "./images/icons");
46
- (0, node_fs_1.cpSync)(mockPath, mockFinalPath);
47
- (0, node_fs_1.cpSync)(iconPath, iconFinalPath, { recursive: true });
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 });
48
43
  }
49
44
  };
50
- exports.default = addMenu;
45
+ export default addMenu;
@@ -1,21 +1,16 @@
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
- const commander_1 = require("commander");
7
- const add_menu_1 = __importDefault(require("./add-menu"));
8
- const translation_1 = __importDefault(require("../../../common/translation/translation"));
1
+ import { Command } from "commander";
2
+ import addMenu from "./add-menu.js";
3
+ import translation from "../../../common/translation/translation.js";
9
4
  const addMenuDefinition = () => {
10
- const command = new commander_1.Command("add-menu");
5
+ const command = new Command("add-menu");
11
6
  command
12
- .description(translation_1.default["command.menu.description"])
13
- .argument("[name]", translation_1.default["command.component.name"])
14
- .option("-cm, --custom", translation_1.default["command.component.customization"])
15
- .option("-i, --itemView <itemView>", translation_1.default["command.menu.option.itemView"])
16
- .option("-m, --itemMargin <itemMargin>", translation_1.default["command.menu.option.itemMargin"])
17
- .option("-d, --direction <direction>", translation_1.default["command.rail.option.direction"])
18
- .action(add_menu_1.default);
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);
19
14
  return command;
20
15
  };
21
- exports.default = addMenuDefinition;
16
+ export default addMenuDefinition;
@@ -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,18 +9,14 @@
10
9
  * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
10
  *
12
11
  */
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 componentConst_1 = require("../const/componentConst");
18
- const createComponent_1 = __importDefault(require("../createComponent"));
19
- const node_process_1 = __importDefault(require("node:process"));
20
- const node_path_1 = __importDefault(require("node:path"));
21
- const node_fs_1 = require("node:fs");
22
- const ComponentConfig_1 = __importDefault(require("../config/ComponentConfig"));
23
- const defaultConfig_1 = require("../const/defaultConfig");
24
- const commonConst_1 = require("../../../common/commonConst");
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";
25
20
  const addRail = async (name, options) => {
26
21
  const data = { ...options };
27
22
  if (name) {
@@ -29,19 +24,19 @@ const addRail = async (name, options) => {
29
24
  }
30
25
  const railConfig = {
31
26
  ...data,
32
- ...(await ComponentConfig_1.default.railConfig(data)),
27
+ ...(await ComponentConfig.railConfig(data)),
33
28
  };
34
29
  const componentList = [railConfig];
35
30
  if (!data.custom) {
36
- componentList.push({ type: componentConst_1.TILE_VIEW, name: data.itemView ?? defaultConfig_1.RAIL_DEFAULT_CONFIG.itemView });
31
+ componentList.push({ type: TILE_VIEW, name: data.itemView ?? RAIL_DEFAULT_CONFIG.itemView });
37
32
  }
38
- (0, createComponent_1.default)(componentList);
33
+ createComponent(componentList);
39
34
  if (!data.custom) {
40
- const currentDirectory = node_process_1.default.cwd();
41
- const modulePath = require.resolve(commonConst_1.TEMPLATE_MODULE);
42
- const mockPath = node_path_1.default.join(node_path_1.default.dirname(modulePath), "mocks", "railMock.json");
43
- const finalPath = node_path_1.default.resolve(currentDirectory, "railMock.json");
44
- (0, node_fs_1.cpSync)(mockPath, finalPath);
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);
45
40
  }
46
41
  };
47
- exports.default = addRail;
42
+ export default addRail;
@@ -1,31 +1,26 @@
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
- const commander_1 = require("commander");
7
- const add_rail_1 = __importDefault(require("./add-rail"));
8
- const navigationConst_1 = require("../const/navigationConst");
9
- const translation_1 = __importDefault(require("../../../common/translation/translation"));
10
- const stringHelper_1 = require("../../../common/helpers/stringHelper");
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";
11
6
  const addRailDefinition = () => {
12
- const command = new commander_1.Command("add-rail");
7
+ const command = new Command("add-rail");
13
8
  command
14
- .description(translation_1.default["command.rail.description"])
15
- .argument("[name]", translation_1.default["command.component.name"])
16
- .option("-cm, --custom", translation_1.default["command.component.customization"])
17
- .option("-n, --navigation <navigation>", translation_1.default["command.rail.option.navigation"])
18
- .option("-d, --direction <direction>", translation_1.default["command.rail.option.direction"])
19
- .option("-c, --cyclic", translation_1.default["command.rail.option.cyclic"])
20
- .option("-i, --itemView <itemView>", translation_1.default["command.menu.option.itemView"])
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"])
21
16
  .addHelpText("after", `
22
- ${translation_1.default["help.option.title"]}
23
- -navigation: ${(0, stringHelper_1.optionsListString)(navigationConst_1.NAVIGATION_TYPES)}
24
- -direction: ${(0, stringHelper_1.optionsListString)(navigationConst_1.DIRECTION_TYPES)}
17
+ ${translation["help.option.title"]}
18
+ -navigation: ${optionsListString(NAVIGATION_TYPES)}
19
+ -direction: ${optionsListString(DIRECTION_TYPES)}
25
20
 
26
- More about rail feature, ${translation_1.default["help.option.check"]} https://doc.dana-framework.com/docs/vendorcomponents/recycling-listview
21
+ More about rail feature, ${translation["help.option.check"]} https://doc.dana-framework.com/docs/vendorcomponents/recycling-listview
27
22
  `)
28
- .action(add_rail_1.default);
23
+ .action(addRail);
29
24
  return command;
30
25
  };
31
- exports.default = addRailDefinition;
26
+ export default addRailDefinition;
@@ -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,62 +9,25 @@
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 componentConst_1 = require("../const/componentConst");
51
- const createComponent_1 = __importDefault(require("../createComponent"));
52
- const add_menu_1 = __importDefault(require("../addMenu/add-menu"));
53
- const add_scrollView_1 = __importDefault(require("../addScrollView/add-scrollView"));
54
- const prompts = __importStar(require("@clack/prompts"));
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";
55
17
  const addScreen = async (name, options) => {
56
18
  try {
57
19
  const data = {
58
20
  name: name ?? "Mock",
59
- type: options?.screenType ?? componentConst_1.SCREEN,
21
+ type: options?.screenType ?? SCREEN,
60
22
  };
61
- if (options?.screenType === componentConst_1.VOD_SCREEN) {
62
- await (0, add_menu_1.default)(componentConst_1.VOD_SCREEN, {});
63
- await (0, add_scrollView_1.default)(componentConst_1.VOD_SCREEN, {});
23
+ if (options?.screenType === VOD_SCREEN) {
24
+ await addMenu(VOD_SCREEN, {});
25
+ await addScrollView(VOD_SCREEN, {});
64
26
  }
65
- (0, createComponent_1.default)([data]);
27
+ createComponent([data]);
66
28
  }
67
29
  catch (e) {
68
30
  prompts.log.info(`Error creating screen: ${e.message}`);
69
31
  }
70
32
  };
71
- exports.default = addScreen;
33
+ export default addScreen;
@@ -1,18 +1,13 @@
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
- const commander_1 = require("commander");
7
- const translation_1 = __importDefault(require("../../../common/translation/translation"));
8
- const add_screen_1 = __importDefault(require("./add-screen"));
1
+ import { Command } from "commander";
2
+ import translation from "../../../common/translation/translation.js";
3
+ import addScreen from "./add-screen.js";
9
4
  const addScreenDefinition = () => {
10
- const command = new commander_1.Command("add-screen");
5
+ const command = new Command("add-screen");
11
6
  command
12
- .description(translation_1.default["command.screen.description"])
13
- .argument("[name]", translation_1.default["command.component.name"])
14
- .option("-s, --screenType [screenType]", translation_1.default["command.screen.option.type"])
15
- .action(add_screen_1.default);
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);
16
11
  return command;
17
12
  };
18
- exports.default = addScreenDefinition;
13
+ export default addScreenDefinition;
@@ -1,16 +1,11 @@
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
- const componentConst_1 = require("../const/componentConst");
7
- const createComponent_1 = __importDefault(require("../createComponent"));
8
- const node_process_1 = __importDefault(require("node:process"));
9
- const node_path_1 = __importDefault(require("node:path"));
10
- const node_fs_1 = require("node:fs");
11
- const defaultConfig_1 = require("../const/defaultConfig");
12
- const ComponentConfig_1 = __importDefault(require("../config/ComponentConfig"));
13
- const commonConst_1 = require("../../../common/commonConst");
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";
14
9
  const addScrollView = async (name, options) => {
15
10
  const data = { ...options };
16
11
  if (name) {
@@ -18,19 +13,19 @@ const addScrollView = async (name, options) => {
18
13
  }
19
14
  const scrollViewConfig = {
20
15
  ...data,
21
- ...(await ComponentConfig_1.default.scrollViewConfig(data)),
16
+ ...(await ComponentConfig.scrollViewConfig(data)),
22
17
  };
23
18
  const componentList = [scrollViewConfig];
24
19
  if (!data.custom) {
25
- componentList.push({ type: componentConst_1.SCROLL_ITEM, name: data.itemView ?? defaultConfig_1.SCROLLVIEW_DEFAULT_CONFIG.itemView }, { type: componentConst_1.TILE_VIEW, name: "mockTile" });
20
+ componentList.push({ type: SCROLL_ITEM, name: data.itemView ?? SCROLLVIEW_DEFAULT_CONFIG.itemView }, { type: TILE_VIEW, name: "mockTile" });
26
21
  }
27
- (0, createComponent_1.default)(componentList);
22
+ createComponent(componentList);
28
23
  if (!data.custom) {
29
- const currentDirectory = node_process_1.default.cwd();
30
- const modulePath = require.resolve(commonConst_1.TEMPLATE_MODULE);
31
- const mockPath = node_path_1.default.join(node_path_1.default.dirname(modulePath), "mocks", "scrollViewMock.json");
32
- const finalPath = node_path_1.default.resolve(currentDirectory, "scrollViewMock.json");
33
- (0, node_fs_1.cpSync)(mockPath, finalPath);
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);
34
29
  }
35
30
  };
36
- exports.default = addScrollView;
31
+ export default addScrollView;
@@ -1,18 +1,13 @@
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
- const commander_1 = require("commander");
7
- const add_scrollView_1 = __importDefault(require("./add-scrollView"));
8
- const translation_1 = __importDefault(require("../../../common/translation/translation"));
1
+ import { Command } from "commander";
2
+ import addScrollView from "./add-scrollView.js";
3
+ import translation from "../../../common/translation/translation.js";
9
4
  const addScrollViewDefinition = () => {
10
- return new commander_1.Command("add-scrollView")
11
- .description(translation_1.default["command.scrollView.description"])
12
- .argument("[name]", translation_1.default["command.component.name"])
13
- .option("-cm, --custom", translation_1.default["command.component.customization"])
14
- .option("-i, --itemView <itemView>", translation_1.default["command.menu.option.itemView"])
15
- .option("-m, --itemMargin <itemMargin>", translation_1.default["command.menu.option.itemMargin"])
16
- .action(add_scrollView_1.default);
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);
17
12
  };
18
- exports.default = addScrollViewDefinition;
13
+ export default addScrollViewDefinition;
@@ -1,5 +1,5 @@
1
- import { RailConfig, MenuConfig, ScreenConfig, ScrollViewConfig } from "./componentTypes";
2
- import { ConfigOptions, OptionList } from "../../../common/types/helperTypes";
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;