@wiztivi/dana-cli 0.0.1 → 0.0.2-beta-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/bin/dana.js +3 -0
  2. package/dana_completion.sh +153 -0
  3. package/dist/commands/add-device.d.ts +2 -0
  4. package/dist/commands/add-device.js +126 -0
  5. package/dist/commands/add-menu.d.ts +7 -0
  6. package/dist/commands/add-menu.js +51 -0
  7. package/dist/commands/add-rail.d.ts +10 -0
  8. package/dist/commands/add-rail.js +48 -0
  9. package/dist/commands/add-screen.d.ts +5 -0
  10. package/dist/commands/add-screen.js +71 -0
  11. package/dist/commands/add-scrollView.d.ts +7 -0
  12. package/dist/commands/add-scrollView.js +37 -0
  13. package/dist/commands/auth/login.d.ts +5 -0
  14. package/dist/commands/auth/login.js +141 -0
  15. package/dist/commands/auth/status.d.ts +11 -0
  16. package/dist/commands/auth/status.js +76 -0
  17. package/dist/commands/commandDefinitions/addDeviceDefinition.d.ts +3 -0
  18. package/dist/commands/commandDefinitions/addDeviceDefinition.js +16 -0
  19. package/dist/commands/commandDefinitions/addMenuDefinition.d.ts +3 -0
  20. package/dist/commands/commandDefinitions/addMenuDefinition.js +21 -0
  21. package/dist/commands/commandDefinitions/addRailDefinition.d.ts +3 -0
  22. package/dist/commands/commandDefinitions/addRailDefinition.js +31 -0
  23. package/dist/commands/commandDefinitions/addScreenDefinition.d.ts +3 -0
  24. package/dist/commands/commandDefinitions/addScreenDefinition.js +18 -0
  25. package/dist/commands/commandDefinitions/addScrollViewDefinition.d.ts +3 -0
  26. package/dist/commands/commandDefinitions/addScrollViewDefinition.js +18 -0
  27. package/dist/commands/commandDefinitions/authDefinition.d.ts +3 -0
  28. package/dist/commands/commandDefinitions/authDefinition.js +23 -0
  29. package/dist/commands/commandDefinitions/completionDefinition.d.ts +3 -0
  30. package/dist/commands/commandDefinitions/completionDefinition.js +17 -0
  31. package/dist/commands/commandDefinitions/createAppDefinition.d.ts +3 -0
  32. package/dist/commands/commandDefinitions/createAppDefinition.js +22 -0
  33. package/dist/commands/completion.d.ts +2 -0
  34. package/dist/commands/completion.js +84 -0
  35. package/dist/commands/createApp.d.ts +6 -0
  36. package/dist/commands/createApp.js +130 -0
  37. package/dist/commands/createComponent.d.ts +3 -0
  38. package/dist/commands/createComponent.js +81 -0
  39. package/dist/commands/help/customHelp.d.ts +3 -0
  40. package/dist/commands/help/customHelp.js +31 -0
  41. package/dist/commands/hooks/authHook.d.ts +1 -0
  42. package/dist/commands/hooks/authHook.js +23 -0
  43. package/dist/configs/ComponentConfig.d.ts +32 -0
  44. package/dist/configs/ComponentConfig.js +178 -0
  45. package/dist/configs/deviceConfig/androidtvConfig.d.ts +37 -0
  46. package/dist/configs/deviceConfig/androidtvConfig.js +186 -0
  47. package/dist/configs/deviceConfig/deviceConfig.d.ts +14 -0
  48. package/dist/configs/deviceConfig/deviceConfig.js +35 -0
  49. package/dist/configs/deviceConfig/tizenConfig.d.ts +31 -0
  50. package/dist/configs/deviceConfig/tizenConfig.js +56 -0
  51. package/dist/configs/deviceConfig/tvosConfig.d.ts +13 -0
  52. package/dist/configs/deviceConfig/tvosConfig.js +32 -0
  53. package/dist/configs/deviceConfig/webosConfig.d.ts +59 -0
  54. package/dist/configs/deviceConfig/webosConfig.js +179 -0
  55. package/dist/const/authentConst.d.ts +3 -0
  56. package/dist/const/authentConst.js +6 -0
  57. package/dist/const/componentConst.d.ts +8 -0
  58. package/dist/const/componentConst.js +22 -0
  59. package/dist/const/createApp/deviceConst.d.ts +23 -0
  60. package/dist/const/createApp/deviceConst.js +73 -0
  61. package/dist/const/createApp/setupConst.d.ts +3 -0
  62. package/dist/const/createApp/setupConst.js +18 -0
  63. package/dist/const/defaultConfig.d.ts +4 -0
  64. package/dist/const/defaultConfig.js +27 -0
  65. package/dist/const/exitCodeConst.d.ts +7 -0
  66. package/dist/const/exitCodeConst.js +10 -0
  67. package/dist/const/navigationConst.d.ts +3 -0
  68. package/dist/const/navigationConst.js +36 -0
  69. package/dist/dana_completion.sh +153 -0
  70. package/dist/helpers/CliHelper.d.ts +13 -0
  71. package/dist/helpers/CliHelper.js +39 -0
  72. package/dist/helpers/CodeArtifactHelper.d.ts +12 -0
  73. package/dist/helpers/CodeArtifactHelper.js +52 -0
  74. package/dist/helpers/ComponentHelper.d.ts +12 -0
  75. package/dist/helpers/ComponentHelper.js +105 -0
  76. package/dist/helpers/CredentialsHelper.d.ts +27 -0
  77. package/dist/helpers/CredentialsHelper.js +22 -0
  78. package/dist/helpers/createApp/CreateFileHelper.d.ts +31 -0
  79. package/dist/helpers/createApp/CreateFileHelper.js +84 -0
  80. package/dist/helpers/createApp/InputValidator.d.ts +5 -0
  81. package/dist/helpers/createApp/InputValidator.js +60 -0
  82. package/dist/helpers/createApp/InstallHelper.d.ts +30 -0
  83. package/dist/helpers/createApp/InstallHelper.js +113 -0
  84. package/dist/helpers/createApp/ScriptHelper.d.ts +116 -0
  85. package/dist/helpers/createApp/ScriptHelper.js +142 -0
  86. package/dist/helpers/createApp/SetupChecker.d.ts +25 -0
  87. package/dist/helpers/createApp/SetupChecker.js +128 -0
  88. package/dist/helpers/createApp/UpdateFileHelper.d.ts +40 -0
  89. package/dist/helpers/createApp/UpdateFileHelper.js +121 -0
  90. package/dist/helpers/createApp/UserInputGetter.d.ts +49 -0
  91. package/dist/helpers/createApp/UserInputGetter.js +144 -0
  92. package/dist/helpers/handlebarsHelper.d.ts +2 -0
  93. package/dist/helpers/handlebarsHelper.js +26 -0
  94. package/dist/helpers/stringHelper.d.ts +3 -0
  95. package/dist/helpers/stringHelper.js +11 -0
  96. package/dist/index.d.ts +2 -0
  97. package/dist/index.js +16 -0
  98. package/dist/program.d.ts +2 -0
  99. package/dist/program.js +42 -0
  100. package/dist/translation/en.json +62 -0
  101. package/dist/translation/translation.d.ts +2 -0
  102. package/dist/translation/translation.js +8 -0
  103. package/dist/types/componentTypes.d.ts +31 -0
  104. package/dist/types/componentTypes.js +2 -0
  105. package/dist/types/createApp/configTypes.d.ts +27 -0
  106. package/dist/types/createApp/configTypes.js +13 -0
  107. package/dist/types/createApp/helperTypes.d.ts +35 -0
  108. package/dist/types/createApp/helperTypes.js +14 -0
  109. package/dist/types/genericTypes.d.ts +17 -0
  110. package/dist/types/genericTypes.js +2 -0
  111. package/package.json +41 -22
  112. package/README.md +0 -5
  113. package/index.js +0 -1
@@ -0,0 +1,23 @@
1
+ declare const TVOS = "tvos";
2
+ declare const TIZEN = "tizen";
3
+ declare const WEBOS = "webos";
4
+ declare const ANDROIDTV = "androidtv";
5
+ declare const CSS = "css";
6
+ declare const LIGHTNING = "lightning";
7
+ declare const BASIC_DEPENDENCIES: string[];
8
+ /**
9
+ * @property {String} label - user-friendly displayed name
10
+ * @property {String} package - package name used to check if user is subscribed (vendor or engine)
11
+ * @property {array<string>} dependencies - Dependencies to be added to BASIC_DEP
12
+ */
13
+ interface PlatformConfig {
14
+ label: string;
15
+ package: string;
16
+ dependencies: string[];
17
+ renderers?: Record<string, string[]>;
18
+ }
19
+ declare const BASIC_SETUP: Record<string, PlatformConfig>;
20
+ declare const EXTENDED_SETUP: Record<string, PlatformConfig>;
21
+ declare const PLATFORM_CONFIG: Record<string, PlatformConfig>;
22
+ declare const RENDERERS: string[];
23
+ export { TVOS, TIZEN, WEBOS, ANDROIDTV, BASIC_DEPENDENCIES, PLATFORM_CONFIG, RENDERERS, BASIC_SETUP, EXTENDED_SETUP, LIGHTNING, CSS, };
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CSS = exports.LIGHTNING = exports.EXTENDED_SETUP = exports.BASIC_SETUP = exports.RENDERERS = exports.PLATFORM_CONFIG = exports.BASIC_DEPENDENCIES = exports.ANDROIDTV = exports.WEBOS = exports.TIZEN = exports.TVOS = void 0;
4
+ /*
5
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
6
+ * All Rights Reserved
7
+ *
8
+ * All information contained herein is proprietary and confidential.
9
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
10
+ * prior written permission is obtained from Wiztivi.
11
+ * No warranty, explicit or implicit, provided.
12
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
13
+ *
14
+ */
15
+ const TVOS = "tvos";
16
+ exports.TVOS = TVOS;
17
+ const TIZEN = "tizen";
18
+ exports.TIZEN = TIZEN;
19
+ const WEBOS = "webos";
20
+ exports.WEBOS = WEBOS;
21
+ const ANDROIDTV = "androidtv";
22
+ exports.ANDROIDTV = ANDROIDTV;
23
+ const CSS = "css";
24
+ exports.CSS = CSS;
25
+ const LIGHTNING = "lightning";
26
+ exports.LIGHTNING = LIGHTNING;
27
+ const BASIC_DEPENDENCIES = [
28
+ "@dana/renderer-css",
29
+ "@dana/renderer-lightning-html5",
30
+ "@dana/tools-grunt",
31
+ "@dana/vendor-test",
32
+ "@dana/engine-nodejs",
33
+ "@dana/vendor-components",
34
+ "@wiztivi/dana-templates",
35
+ ];
36
+ exports.BASIC_DEPENDENCIES = BASIC_DEPENDENCIES;
37
+ //Devices included by default in subscription
38
+ const BASIC_SETUP = {
39
+ [TIZEN]: {
40
+ label: "Samsung",
41
+ package: "@dana/vendor-tizen",
42
+ dependencies: ["@dana/vendor-tizen", "@dana/vendor-shaka"],
43
+ },
44
+ };
45
+ exports.BASIC_SETUP = BASIC_SETUP;
46
+ //Devices that need a subscription to be added in project
47
+ const EXTENDED_SETUP = {
48
+ [TVOS]: {
49
+ label: "TV OS",
50
+ package: "@dana/engine-tvos",
51
+ dependencies: ["@dana/engine-tvos", "@dana/renderer-tvos", "@dana/tools-apple-grunt"],
52
+ },
53
+ [WEBOS]: {
54
+ label: "LG",
55
+ package: "@dana/vendor-webos",
56
+ dependencies: [
57
+ "@dana/vendor-webos",
58
+ "@dana/vendor-shaka",
59
+ "@dana/tools-smarttv-grunt",
60
+ "@dana/vendor-webos-css",
61
+ ],
62
+ },
63
+ [ANDROIDTV]: {
64
+ label: "Android",
65
+ package: "@dana/engine-android",
66
+ dependencies: ["@dana/engine-android", "@dana/renderer-android", "@dana/tools-android-grunt"],
67
+ },
68
+ };
69
+ exports.EXTENDED_SETUP = EXTENDED_SETUP;
70
+ const PLATFORM_CONFIG = { ...BASIC_SETUP, ...EXTENDED_SETUP };
71
+ exports.PLATFORM_CONFIG = PLATFORM_CONFIG;
72
+ const RENDERERS = [CSS, LIGHTNING];
73
+ exports.RENDERERS = RENDERERS;
@@ -0,0 +1,3 @@
1
+ declare const REGISTRY_KEY = "@dana:registry=https://dana-733912940672.d.codeartifact.eu-central-1.amazonaws.com/npm/";
2
+ declare const DEFAULT_IMAGE_URL = "images/1080p/components/logo/dana.png";
3
+ export { REGISTRY_KEY, DEFAULT_IMAGE_URL };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
+ * All Rights Reserved
5
+ *
6
+ * All information contained herein is proprietary and confidential.
7
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
8
+ * prior written permission is obtained from Wiztivi.
9
+ * No warranty, explicit or implicit, provided.
10
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
+ *
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.DEFAULT_IMAGE_URL = exports.REGISTRY_KEY = void 0;
15
+ const REGISTRY_KEY = "@dana:registry=https://dana-733912940672.d.codeartifact.eu-central-1.amazonaws.com/npm/";
16
+ exports.REGISTRY_KEY = REGISTRY_KEY;
17
+ const DEFAULT_IMAGE_URL = "images/1080p/components/logo/dana.png";
18
+ exports.DEFAULT_IMAGE_URL = DEFAULT_IMAGE_URL;
@@ -0,0 +1,4 @@
1
+ import { MenuConfig, RailConfig, ScrollViewConfig } from "../types/componentTypes";
2
+ export declare const RAIL_DEFAULT_CONFIG: RailConfig;
3
+ export declare const MENU_DEFAULT_CONFIG: MenuConfig;
4
+ export declare const SCROLLVIEW_DEFAULT_CONFIG: ScrollViewConfig;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SCROLLVIEW_DEFAULT_CONFIG = exports.MENU_DEFAULT_CONFIG = exports.RAIL_DEFAULT_CONFIG = void 0;
4
+ const componentConst_1 = require("./componentConst");
5
+ exports.RAIL_DEFAULT_CONFIG = {
6
+ navigation: "FixedNavigationType",
7
+ isCyclic: false,
8
+ direction: "horizontal",
9
+ name: "mockRail",
10
+ itemView: "mockTile",
11
+ type: componentConst_1.RAIL,
12
+ addMock: true,
13
+ };
14
+ exports.MENU_DEFAULT_CONFIG = {
15
+ name: "mockMenu",
16
+ itemMargin: 20,
17
+ itemView: "ButtonItem",
18
+ direction: "horizontal",
19
+ addMock: true,
20
+ type: componentConst_1.MENU,
21
+ };
22
+ exports.SCROLLVIEW_DEFAULT_CONFIG = {
23
+ name: "mock",
24
+ itemMargin: 550,
25
+ itemView: "Rail",
26
+ type: componentConst_1.SCROLL_VIEW,
27
+ };
@@ -0,0 +1,7 @@
1
+ export declare const APP_CREATION_ERROR = 1;
2
+ export declare const COMPONENT_ERROR = 3;
3
+ export declare const CANCEL = 4;
4
+ export declare const DEVICE_ERROR = 5;
5
+ export declare const LOGIN_ERROR = 6;
6
+ export declare const COMMAND_ERROR = 7;
7
+ export declare const SETUP_ERROR = 8;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SETUP_ERROR = exports.COMMAND_ERROR = exports.LOGIN_ERROR = exports.DEVICE_ERROR = exports.CANCEL = exports.COMPONENT_ERROR = exports.APP_CREATION_ERROR = void 0;
4
+ exports.APP_CREATION_ERROR = 1;
5
+ exports.COMPONENT_ERROR = 3;
6
+ exports.CANCEL = 4;
7
+ exports.DEVICE_ERROR = 5;
8
+ exports.LOGIN_ERROR = 6;
9
+ exports.COMMAND_ERROR = 7;
10
+ exports.SETUP_ERROR = 8;
@@ -0,0 +1,3 @@
1
+ import { OptionList } from "../types/genericTypes";
2
+ export declare const NAVIGATION_TYPES: OptionList;
3
+ export declare const DIRECTION_TYPES: OptionList;
@@ -0,0 +1,36 @@
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 = [
9
+ {
10
+ value: "MFixedNavigationType",
11
+ label: picocolors_1.default.bold("Fixed. ") + "Focus is fixed on the left side of the list.",
12
+ command: "fixed",
13
+ },
14
+ {
15
+ value: "MLMRNavigationType",
16
+ label: picocolors_1.default.bold("Left-Middle-Right. ") +
17
+ "Focus starts on the left side, then moves and stays to the middle, then goes to the right side when the list ends",
18
+ command: "lmr",
19
+ },
20
+ {
21
+ value: "MLRNavigationType",
22
+ label: picocolors_1.default.bold("Left-Right. ") +
23
+ " Focus moves in the chosen direction to the edge of the list. Then the list scrolls to show the next items.",
24
+ command: "lr",
25
+ },
26
+ {
27
+ value: "MPaginateNavigationType",
28
+ label: picocolors_1.default.bold("Paginated. ") +
29
+ " Focus moves to the end of the visible items. Then, all items are replaced by new ones.",
30
+ command: "paginated",
31
+ },
32
+ ];
33
+ exports.DIRECTION_TYPES = [
34
+ { value: `HORIZONTAL`, label: "HORIZONTAL", command: "h" },
35
+ { value: `VERTICAL`, label: "VERTICAL", command: "v" },
36
+ ];
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/env sh
2
+
3
+ # Unified completion script for dana CLI
4
+ # Detects shell and loads appropriate completion
5
+
6
+ # Shared command list
7
+ dana_commands=(
8
+ 'add-device'
9
+ 'add-menu'
10
+ 'add-rail'
11
+ 'add-scrollView'
12
+ 'add-screen'
13
+ 'auth'
14
+ )
15
+
16
+ # Shared subcommand declarations
17
+ login_sub="login"
18
+ logout_sub="logout"
19
+ status_sub="status"
20
+
21
+ # Shared option declarations
22
+ direction_opts="-d --direction"
23
+ navigation_opts="-n --navigation"
24
+ cyclic_opts="-c --cyclic"
25
+ margin_opts="-m --itemMargin"
26
+ custom_opts="-cm --custom"
27
+ item_view_opts="-i --itemView"
28
+ org_opts="-o --org"
29
+
30
+ # Shared option values
31
+ direction_values="h v"
32
+ navigation_values="fixed lmr lr paginated"
33
+ org_values="preprod"
34
+
35
+ # Detect shell and load appropriate completion
36
+ if [ -n "$BASH_VERSION" ]; then
37
+ # Bash completion
38
+ _dana()
39
+ {
40
+ local cur prev opts
41
+ cur="${COMP_WORDS[COMP_CWORD]}"
42
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
43
+
44
+ # Complete option values
45
+ case "$prev" in
46
+ -d|--direction)
47
+ COMPREPLY=($(compgen -W "$direction_values" -- "$cur"))
48
+ return 0
49
+ ;;
50
+ -n|--navigation)
51
+ COMPREPLY=($(compgen -W "$navigation_values" -- "$cur"))
52
+ return 0
53
+ ;;
54
+ -o|--org)
55
+ COMPREPLY=($(compgen -W "$org_values" -- "$cur"))
56
+ return 0
57
+ ;;
58
+ esac
59
+
60
+ # If we're completing the first argument (command)
61
+ if [[ $COMP_CWORD -eq 1 ]]; then
62
+ COMPREPLY=($(compgen -W "${dana_commands[*]}" -- "$cur"))
63
+ return 0
64
+ fi
65
+
66
+ # If we're completing options for specific commands
67
+ local cmd="${COMP_WORDS[1]}"
68
+ case "$cmd" in
69
+ add-rail)
70
+ opts="$navigation_opts $cyclic_opts $direction_opts $custom_opts $item_view_opts"
71
+ COMPREPLY=($(compgen -W "$opts" -- "$cur"))
72
+ ;;
73
+ add-menu)
74
+ opts="$direction_opts $margin_opts $custom_opts $item_view_opts"
75
+ COMPREPLY=($(compgen -W "$opts" -- "$cur"))
76
+ ;;
77
+ add-scrollView)
78
+ opts="$custom_opts $item_view_opts $margin_opts"
79
+ COMPREPLY=($(compgen -W "$opts" -- "$cur"))
80
+ ;;
81
+ auth)
82
+ if [[ $COMP_CWORD -eq 2 ]]; then
83
+ opts="$login_sub $logout_sub $status_sub"
84
+ else
85
+ opts="$org_opts"
86
+ fi
87
+ COMPREPLY=($(compgen -W "$opts" -- "$cur"))
88
+ ;;
89
+ *)
90
+ COMPREPLY=()
91
+ ;;
92
+ esac
93
+ }
94
+
95
+ complete -F _dana dana
96
+
97
+ elif [ -n "$ZSH_VERSION" ]; then
98
+ # Zsh completion
99
+ _dana() {
100
+ # Main commands
101
+ if (( CURRENT == 2 )); then
102
+ local -a commands
103
+ commands=(${dana_commands[@]})
104
+ compadd -a commands
105
+ return
106
+ fi
107
+
108
+ # Complete option values
109
+ local prev=${words[CURRENT-1]}
110
+ case "$prev" in
111
+ -d|--direction)
112
+ compadd -- ${=direction_values}
113
+ return
114
+ ;;
115
+ -n|--navigation)
116
+ compadd -- ${=navigation_values}
117
+ return
118
+ ;;
119
+ -o|--org)
120
+ compadd -- ${=org_values}
121
+ return
122
+ ;;
123
+ login|logout|status)
124
+ compadd -- ${=org_opts}
125
+ return
126
+ ;;
127
+ esac
128
+
129
+ # Complete options for commands
130
+ local cmd=${words[2]}
131
+ case "$cmd" in
132
+ add-rail)
133
+ compadd -- ${=navigation_opts} ${=cyclic_opts} ${=direction_opts} ${=custom_opts} ${=item_view_opts}
134
+ ;;
135
+ add-menu)
136
+ compadd -- ${=direction_opts} ${=margin_opts} ${=custom_opts} ${=item_view_opts}
137
+ ;;
138
+ add-scrollView)
139
+ compadd -- ${=custom_opts} ${=item_view_opts} ${=margin_opts}
140
+ ;;
141
+ auth)
142
+ if (( CURRENT == 3 )); then
143
+ compadd -- ${=login_sub} ${=logout_sub} ${=status_sub}
144
+ else
145
+ compadd -- ${=org_opts}
146
+ fi
147
+ ;;
148
+ esac
149
+ }
150
+
151
+ # Register the completion
152
+ compdef _dana dana
153
+ fi
@@ -0,0 +1,13 @@
1
+ declare const CliHelper: {
2
+ new (): {};
3
+ /**
4
+ * clean on error
5
+ */
6
+ readonly cleanOnError: () => string;
7
+ /**
8
+ * Get installed devices from script list in package.json
9
+ * We use script so we can get renderers for smartTv
10
+ */
11
+ readonly getInstalledDevices: (directory: string) => string[];
12
+ };
13
+ export default CliHelper;
@@ -0,0 +1,39 @@
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 node_child_process_1 = require("node:child_process");
7
+ const fs_1 = require("fs");
8
+ const path_1 = __importDefault(require("path"));
9
+ const CliHelper = class {
10
+ /**
11
+ * clean on error
12
+ */
13
+ static cleanOnError = () => {
14
+ try {
15
+ (0, node_child_process_1.execSync)(`git clean -d -f && git reset --hard head`);
16
+ }
17
+ catch {
18
+ throw new Error("Files deletion failed. Delete changes manually.");
19
+ }
20
+ return "Changes successfully deleted.";
21
+ };
22
+ /**
23
+ * Get installed devices from script list in package.json
24
+ * We use script so we can get renderers for smartTv
25
+ */
26
+ static getInstalledDevices = (directory) => {
27
+ const filepath = path_1.default.join(directory, "package.json");
28
+ const jsonData = JSON.parse((0, fs_1.readFileSync)(filepath).toString());
29
+ const installedDevices = [];
30
+ for (const t of Object.keys(jsonData.scripts)) {
31
+ if (t.includes("start:")) {
32
+ const device = t.split(":")[1];
33
+ installedDevices.push(device);
34
+ }
35
+ }
36
+ return installedDevices;
37
+ };
38
+ };
39
+ exports.default = CliHelper;
@@ -0,0 +1,12 @@
1
+ import { CodeartifactClient } from "@aws-sdk/client-codeartifact";
2
+ import { AwsCredentials } from "./CredentialsHelper";
3
+ interface GetRepositoryEndpointOptions {
4
+ organization: string;
5
+ credentials?: AwsCredentials;
6
+ client?: CodeartifactClient;
7
+ format: "npm" | "maven";
8
+ }
9
+ export declare const getRepositoryEndpoint: ({ organization, credentials, client, format, }: GetRepositoryEndpointOptions) => Promise<string>;
10
+ export declare const createCodeArtifactClient: (credentials: AwsCredentials) => CodeartifactClient;
11
+ export declare const formatRepositoryString: (org: string) => string;
12
+ export {};
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
+ * All Rights Reserved
5
+ *
6
+ * All information contained herein is proprietary and confidential.
7
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
8
+ * prior written permission is obtained from Wiztivi.
9
+ * No warranty, explicit or implicit, provided.
10
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
+ *
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.formatRepositoryString = exports.createCodeArtifactClient = exports.getRepositoryEndpoint = void 0;
15
+ const client_codeartifact_1 = require("@aws-sdk/client-codeartifact");
16
+ const CredentialsHelper_1 = require("./CredentialsHelper");
17
+ const authentConst_1 = require("../const/authentConst");
18
+ const getRepositoryEndpoint = async ({ organization, credentials, client, format = "npm", }) => {
19
+ const actualCredentials = credentials ?? CredentialsHelper_1.CredentialsHelper.get()?.aws;
20
+ if (!actualCredentials) {
21
+ throw Error("No valid credentials available.");
22
+ }
23
+ const actualClient = client ?? (0, exports.createCodeArtifactClient)(actualCredentials);
24
+ const repository = (0, exports.formatRepositoryString)(organization);
25
+ const endpointCommand = new client_codeartifact_1.GetRepositoryEndpointCommand({
26
+ domain: authentConst_1.DOMAIN,
27
+ domainOwner: authentConst_1.DOMAIN_OWNER,
28
+ repository,
29
+ format,
30
+ });
31
+ const { repositoryEndpoint } = await actualClient.send(endpointCommand);
32
+ if (!repositoryEndpoint) {
33
+ throw new Error("Repository endpoint not found");
34
+ }
35
+ return repositoryEndpoint;
36
+ };
37
+ exports.getRepositoryEndpoint = getRepositoryEndpoint;
38
+ const createCodeArtifactClient = (credentials) => {
39
+ return new client_codeartifact_1.CodeartifactClient({
40
+ region: authentConst_1.REGION,
41
+ credentials: {
42
+ accessKeyId: credentials.accessKeyId,
43
+ secretAccessKey: credentials.secretAccessKey,
44
+ sessionToken: credentials.sessionToken,
45
+ },
46
+ });
47
+ };
48
+ exports.createCodeArtifactClient = createCodeArtifactClient;
49
+ const formatRepositoryString = (org) => {
50
+ return `dana-${org}-repository`;
51
+ };
52
+ exports.formatRepositoryString = formatRepositoryString;
@@ -0,0 +1,12 @@
1
+ import { OptionList, SelectionArray } from "../types/genericTypes";
2
+ declare const ComponentHelper: {
3
+ new (): {};
4
+ readonly selectionFactory: (name: string, options: SelectionArray, message: string) => Promise<string>;
5
+ readonly checkOption: (option: string, optionList: OptionList, title: string) => string;
6
+ readonly normalizeFileName: (type: string, name: string) => string;
7
+ /**
8
+ * Manage cancellation with CTRL+C
9
+ */
10
+ readonly handleCancellation: (value: unknown) => void;
11
+ };
12
+ export default ComponentHelper;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
4
+ * All Rights Reserved
5
+ *
6
+ * All information contained herein is proprietary and confidential.
7
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
8
+ * prior written permission is obtained from Wiztivi.
9
+ * No warranty, explicit or implicit, provided.
10
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
11
+ *
12
+ */
13
+ var __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
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ const prompts = __importStar(require("@clack/prompts"));
48
+ const componentConst_1 = require("../const/componentConst");
49
+ const stringHelper_1 = require("./stringHelper");
50
+ const exitCodeConst_1 = require("../const/exitCodeConst");
51
+ const ComponentHelper = class {
52
+ static selectionFactory = async (name, options, message) => {
53
+ options = options.map((el) => {
54
+ return { value: el.value, label: el.label };
55
+ });
56
+ const result = (await prompts.select({
57
+ message,
58
+ options,
59
+ }));
60
+ ComponentHelper.handleCancellation(name);
61
+ return result;
62
+ };
63
+ static checkOption = (option, optionList, title) => {
64
+ if (!option) {
65
+ return "";
66
+ }
67
+ const found = optionList.find((o) => o.command === option);
68
+ if (found) {
69
+ return found.value;
70
+ }
71
+ prompts.log.info(`"${option}" does not match any ${title} option. Please select one below:`);
72
+ return "";
73
+ };
74
+ static normalizeFileName = (type, name) => {
75
+ const uppercaseName = (0, stringHelper_1.capitalizeFirstLetter)(name);
76
+ switch (type) {
77
+ case componentConst_1.RAIL:
78
+ case componentConst_1.MENU:
79
+ return `${uppercaseName}ListView.js`;
80
+ case componentConst_1.TILE_VIEW:
81
+ return `${uppercaseName}ListItemView.js`;
82
+ case componentConst_1.SCROLL_VIEW:
83
+ return `${uppercaseName}ScrollView.js`;
84
+ case componentConst_1.SCROLL_ITEM:
85
+ return `${uppercaseName}ScrollItemView.js`;
86
+ case componentConst_1.SCREEN:
87
+ case componentConst_1.VOD_SCREEN:
88
+ return `${uppercaseName}Screen.js`;
89
+ case componentConst_1.BUTTON_ITEM_VIEW:
90
+ return `${uppercaseName}View.js`;
91
+ default:
92
+ return `${uppercaseName}.js`;
93
+ }
94
+ };
95
+ /**
96
+ * Manage cancellation with CTRL+C
97
+ */
98
+ static handleCancellation = function (value) {
99
+ if (prompts.isCancel(value)) {
100
+ prompts.cancel("Operation cancelled.");
101
+ process.exit(exitCodeConst_1.CANCEL);
102
+ }
103
+ };
104
+ };
105
+ exports.default = ComponentHelper;
@@ -0,0 +1,27 @@
1
+ export interface AwsCredentials {
2
+ identityId: string;
3
+ accessKeyId: string;
4
+ secretAccessKey: string;
5
+ sessionToken: string;
6
+ expiration: string;
7
+ }
8
+ export interface DanaToken {
9
+ id_token: string;
10
+ access_token: string;
11
+ refresh_token?: string;
12
+ expires_in: number;
13
+ token_type: string;
14
+ }
15
+ export declare class CredentialsHelper {
16
+ static readonly filePath: string;
17
+ static store(credentials: {
18
+ aws: AwsCredentials;
19
+ dana: DanaToken;
20
+ org: string;
21
+ }): void;
22
+ static get(): {
23
+ aws: AwsCredentials;
24
+ dana: DanaToken;
25
+ org: string;
26
+ } | null;
27
+ }
@@ -0,0 +1,22 @@
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.CredentialsHelper = void 0;
7
+ const node_fs_1 = require("node:fs");
8
+ const node_os_1 = require("node:os");
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ class CredentialsHelper {
11
+ static filePath = node_path_1.default.join((0, node_os_1.homedir)(), ".dana.json");
12
+ static store(credentials) {
13
+ (0, node_fs_1.writeFileSync)(this.filePath, JSON.stringify(credentials, null, 4));
14
+ }
15
+ static get() {
16
+ if (!(0, node_fs_1.existsSync)(this.filePath)) {
17
+ return null;
18
+ }
19
+ return JSON.parse((0, node_fs_1.readFileSync)(this.filePath).toString());
20
+ }
21
+ }
22
+ exports.CredentialsHelper = CredentialsHelper;