dana-cli 0.0.0-stage → 0.0.26

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 (288) hide show
  1. package/.github/dependabot.yml +43 -0
  2. package/.github/labeler.yml +30 -0
  3. package/.github/workflows/bump.yml +51 -0
  4. package/.github/workflows/ci-cd.yml +110 -0
  5. package/.github/workflows/dependabot-automerge-call.yml +13 -0
  6. package/.nvmrc +1 -0
  7. package/.prettierignore +4 -0
  8. package/.prettierrc +4 -0
  9. package/CODEOWNERS +5 -0
  10. package/README.md +50 -2
  11. package/bin/bump.js +48 -0
  12. package/eslint.config.mjs +12 -0
  13. package/images/vodScreen1.png +0 -0
  14. package/package.json +53 -5
  15. package/sonar-project.properties +20 -0
  16. package/tools/cli/README.md +51 -0
  17. package/tools/cli/__mocks__/fs/promises.cjs +4 -0
  18. package/tools/cli/bin/dana.js +3 -0
  19. package/tools/cli/dana_completion.sh +156 -0
  20. package/tools/cli/eslint.config.mjs +14 -0
  21. package/tools/cli/package.json +67 -0
  22. package/tools/cli/rollup.config.mjs +26 -0
  23. package/tools/cli/src/commands/addComponent/addMenu/add-menu.ts +65 -0
  24. package/tools/cli/src/commands/addComponent/addMenu/addMenuDefinition.ts +21 -0
  25. package/tools/cli/src/commands/addComponent/addRail/add-rail.ts +59 -0
  26. package/tools/cli/src/commands/addComponent/addRail/addRailDefinition.ts +34 -0
  27. package/tools/cli/src/commands/addComponent/addScreen/add-screen.ts +42 -0
  28. package/tools/cli/src/commands/addComponent/addScreen/addScreenDefinition.ts +17 -0
  29. package/tools/cli/src/commands/addComponent/addScrollView/add-scrollView.ts +48 -0
  30. package/tools/cli/src/commands/addComponent/addScrollView/addScrollViewDefinition.ts +16 -0
  31. package/tools/cli/src/commands/addComponent/config/ComponentConfig.ts +169 -0
  32. package/tools/cli/src/commands/addComponent/config/componentTypes.ts +38 -0
  33. package/tools/cli/src/commands/addComponent/const/componentConst.ts +20 -0
  34. package/tools/cli/src/commands/addComponent/const/defaultConfig.ts +28 -0
  35. package/tools/cli/src/commands/addComponent/const/navigationConst.ts +36 -0
  36. package/tools/cli/src/commands/addComponent/createComponent.ts +45 -0
  37. package/tools/cli/src/commands/addComponent/helper/ComponentHelper.ts +98 -0
  38. package/tools/cli/src/commands/addDevice/add-device.ts +106 -0
  39. package/tools/cli/src/commands/addDevice/addDeviceDefinition.ts +13 -0
  40. package/tools/cli/src/commands/addDevice/deviceConfig/androidtvConfig.ts +142 -0
  41. package/tools/cli/src/commands/addDevice/deviceConfig/configTypes.ts +44 -0
  42. package/tools/cli/src/commands/addDevice/deviceConfig/deviceConfig.ts +38 -0
  43. package/tools/cli/src/commands/addDevice/deviceConfig/titanosConfig.ts +17 -0
  44. package/tools/cli/src/commands/addDevice/deviceConfig/tizenConfig.ts +64 -0
  45. package/tools/cli/src/commands/addDevice/deviceConfig/tvosConfig.ts +50 -0
  46. package/tools/cli/src/commands/addDevice/deviceConfig/vidaaConfig.ts +17 -0
  47. package/tools/cli/src/commands/addDevice/deviceConfig/webosConfig.ts +64 -0
  48. package/tools/cli/src/commands/addDevice/helper/addDeviceHelper.ts +121 -0
  49. package/tools/cli/src/commands/addDianaSkills/add-dianaSkills.ts +55 -0
  50. package/tools/cli/src/commands/addDianaSkills/addDianaSkillsDefinition.ts +13 -0
  51. package/tools/cli/src/commands/addDianaSkills/dianaDependencies.ts +15 -0
  52. package/tools/cli/src/commands/addModule/add-module.ts +46 -0
  53. package/tools/cli/src/commands/addModule/addModuleDefinition.ts +17 -0
  54. package/tools/cli/src/commands/addModule/moduleConst.ts +18 -0
  55. package/tools/cli/src/commands/authentication/AuthenticationManager.ts +255 -0
  56. package/tools/cli/src/commands/authentication/authDefinition.ts +51 -0
  57. package/tools/cli/src/commands/authentication/authHook.ts +50 -0
  58. package/tools/cli/src/commands/authentication/authentConst.ts +6 -0
  59. package/tools/cli/src/commands/authentication/commands/get-packages-token.ts +40 -0
  60. package/tools/cli/src/commands/authentication/commands/login.ts +63 -0
  61. package/tools/cli/src/commands/authentication/commands/logout.ts +26 -0
  62. package/tools/cli/src/commands/authentication/commands/status.ts +47 -0
  63. package/tools/cli/src/commands/authentication/helper/CodeArtifactHelper.ts +66 -0
  64. package/tools/cli/src/commands/authentication/helper/CommandHelper.ts +9 -0
  65. package/tools/cli/src/commands/authentication/helper/CredentialsHelper.ts +176 -0
  66. package/tools/cli/src/commands/authentication/helper/SPM.ts +95 -0
  67. package/tools/cli/src/commands/authentication/tokenHook.ts +30 -0
  68. package/tools/cli/src/commands/commandHelp/customHelp.ts +31 -0
  69. package/tools/cli/src/commands/completion/completion.ts +53 -0
  70. package/tools/cli/src/commands/completion/completionDefinition.ts +16 -0
  71. package/tools/cli/src/commands/createApp/const/createAppTasks.ts +133 -0
  72. package/tools/cli/src/commands/createApp/const/setupConst.ts +16 -0
  73. package/tools/cli/src/commands/createApp/const/templateConst.ts +10 -0
  74. package/tools/cli/src/commands/createApp/createApp.ts +60 -0
  75. package/tools/cli/src/commands/createApp/createAppDefinition.ts +26 -0
  76. package/tools/cli/src/commands/createApp/helpers/CreateAppHelper.ts +167 -0
  77. package/tools/cli/src/commands/createApp/helpers/SetupChecker.ts +98 -0
  78. package/tools/cli/src/commands/hooks/checkDanaProjectHook.ts +30 -0
  79. package/tools/cli/src/commands/zip/zip.ts +26 -0
  80. package/tools/cli/src/commands/zip/zipDefinition.ts +13 -0
  81. package/tools/cli/src/common/commonConst.ts +1 -0
  82. package/tools/cli/src/common/const/deviceConst.ts +110 -0
  83. package/tools/cli/src/common/const/exitCodeConst.ts +12 -0
  84. package/tools/cli/src/common/helpers/CreateArchiveHelper.ts +55 -0
  85. package/tools/cli/src/common/helpers/CreateFileHelper.ts +199 -0
  86. package/tools/cli/src/common/helpers/InputValidator.ts +58 -0
  87. package/tools/cli/src/common/helpers/InstallHelper.ts +202 -0
  88. package/tools/cli/src/common/helpers/UpdateFileHelper.ts +239 -0
  89. package/tools/cli/src/common/helpers/UserInputGetter.ts +145 -0
  90. package/tools/cli/src/common/helpers/handlebarsHelper.ts +31 -0
  91. package/tools/cli/src/common/helpers/stringHelper.ts +25 -0
  92. package/tools/cli/src/common/translation/en.json +87 -0
  93. package/tools/cli/src/common/translation/translation.ts +6 -0
  94. package/tools/cli/src/common/types/helperTypes.ts +79 -0
  95. package/tools/cli/src/index.ts +16 -0
  96. package/tools/cli/src/program.ts +59 -0
  97. package/tools/cli/tests/commands/addComponent/addMenu/add-menu.test.ts +96 -0
  98. package/tools/cli/tests/commands/addComponent/addRail/add-rail.test.ts +57 -0
  99. package/tools/cli/tests/commands/addComponent/addScreen/add-screen.test.ts +55 -0
  100. package/tools/cli/tests/commands/addComponent/addScrollView/add-scrollView.test.ts +89 -0
  101. package/tools/cli/tests/commands/addComponent/config/ComponentConfig.test.ts +261 -0
  102. package/tools/cli/tests/commands/addComponent/createComponent.test.ts +87 -0
  103. package/tools/cli/tests/commands/addComponent/helper/ComponentHelper.test.ts +110 -0
  104. package/tools/cli/tests/commands/addDevice/add-device.test.ts +117 -0
  105. package/tools/cli/tests/commands/addDevice/deviceConfig/androidtvConfig.test.ts +184 -0
  106. package/tools/cli/tests/commands/addDevice/deviceConfig/deviceConfig.test.ts +30 -0
  107. package/tools/cli/tests/commands/addDevice/deviceConfig/titanosConfig.test.ts +20 -0
  108. package/tools/cli/tests/commands/addDevice/deviceConfig/tizenConfig.test.ts +63 -0
  109. package/tools/cli/tests/commands/addDevice/deviceConfig/tvosConfig.test.ts +47 -0
  110. package/tools/cli/tests/commands/addDevice/deviceConfig/vidaaConfig.test.ts +20 -0
  111. package/tools/cli/tests/commands/addDevice/deviceConfig/webosConfig.test.ts +74 -0
  112. package/tools/cli/tests/commands/addDevice/helper/addDeviceHelper.test.ts +144 -0
  113. package/tools/cli/tests/commands/addDianaSkills/add-dianaSkills.test.ts +72 -0
  114. package/tools/cli/tests/commands/addModule/add-module.test.ts +108 -0
  115. package/tools/cli/tests/commands/authentication/AuthenticationManager.test.ts +756 -0
  116. package/tools/cli/tests/commands/authentication/commands/authDefinition.test.ts +53 -0
  117. package/tools/cli/tests/commands/authentication/commands/authHook.test.ts +94 -0
  118. package/tools/cli/tests/commands/authentication/commands/get-packages-token.test.ts +69 -0
  119. package/tools/cli/tests/commands/authentication/commands/login.test.ts +170 -0
  120. package/tools/cli/tests/commands/authentication/commands/logout.test.ts +77 -0
  121. package/tools/cli/tests/commands/authentication/commands/status.test.ts +73 -0
  122. package/tools/cli/tests/commands/authentication/helper/CredentialsHelper.test.ts +352 -0
  123. package/tools/cli/tests/commands/authentication/helper/SPM.test.ts +229 -0
  124. package/tools/cli/tests/commands/cliHelp/customHelp.test.ts +24 -0
  125. package/tools/cli/tests/commands/completion/completion.test.ts +76 -0
  126. package/tools/cli/tests/commands/createApp/const/createAppTasks.test.ts +70 -0
  127. package/tools/cli/tests/commands/createApp/createApp.test.ts +116 -0
  128. package/tools/cli/tests/commands/createApp/helpers/CreateAppHelper.test.ts +197 -0
  129. package/tools/cli/tests/commands/createApp/helpers/SetupChecker.test.ts +152 -0
  130. package/tools/cli/tests/commands/createApp/helpers/fixtures/myApp/scripts/app/ui/screens/SplashScreen.js +70 -0
  131. package/tools/cli/tests/commands/hooks/checkDanaProjectHook.test.ts +55 -0
  132. package/tools/cli/tests/commands/zip/zip.test.ts +51 -0
  133. package/tools/cli/tests/common/helpers/CreateArchiveHelper.test.ts +69 -0
  134. package/tools/cli/tests/common/helpers/CreateFileHelper.test.ts +359 -0
  135. package/tools/cli/tests/common/helpers/InputValidator.test.ts +93 -0
  136. package/tools/cli/tests/common/helpers/InstallHelper.test.ts +262 -0
  137. package/tools/cli/tests/common/helpers/UpdateFileHelper.test.ts +288 -0
  138. package/tools/cli/tests/common/helpers/UserInputGetter.test.ts +182 -0
  139. package/tools/cli/tests/common/helpers/handlebarsHelper.test.ts +87 -0
  140. package/tools/cli/tests/common/helpers/stringHelper.test.ts +35 -0
  141. package/tools/cli/tests/program.test.ts +215 -0
  142. package/tools/cli/tsconfig.json +19 -0
  143. package/tools/cli/tsconfig.test.json +4 -0
  144. package/tools/cli/vitest.config.ts +4 -0
  145. package/tools/templates/app-template/.dana/.gitkeep +0 -0
  146. package/tools/templates/app-template/Gruntfile.js +31 -0
  147. package/tools/templates/app-template/README.md +17 -0
  148. package/tools/templates/app-template/app.config.json +56 -0
  149. package/tools/templates/app-template/editorconfigTemplate.hbs +18 -0
  150. package/tools/templates/app-template/eslintrc.jsonTemplate.hbs +5 -0
  151. package/tools/templates/app-template/gitignoreTemplate.hbs +27 -0
  152. package/tools/templates/app-template/i18n/LocaleStringEnUS.json +7 -0
  153. package/tools/templates/app-template/i18n/README.md +32 -0
  154. package/tools/templates/app-template/images/dana.png +0 -0
  155. package/tools/templates/app-template/images/dana_logo.png +0 -0
  156. package/tools/templates/app-template/images/dana_logo_light.png +0 -0
  157. package/tools/templates/app-template/images/loading.png +0 -0
  158. package/tools/templates/app-template/nvmrcTemplate.hbs +1 -0
  159. package/tools/templates/app-template/package.json +33 -0
  160. package/tools/templates/app-template/profiles/app.config.browser-css.json +16 -0
  161. package/tools/templates/app-template/profiles/app.config.browser-lightning.json +16 -0
  162. package/tools/templates/app-template/scripts/app/README.md +6 -0
  163. package/tools/templates/app-template/scripts/app/TemplateAppRoutes.js.hbs +18 -0
  164. package/tools/templates/app-template/scripts/app/app.js.hbs +17 -0
  165. package/tools/templates/app-template/scripts/app/theme/AppTheme.js +57 -0
  166. package/tools/templates/app-template/scripts/app/ui/screens/AppScreen.js +106 -0
  167. package/tools/templates/app-template/scripts/app/ui/screens/SplashScreen.js +70 -0
  168. package/tools/templates/app-template/scripts/app/ui/views/LoaderView.js +31 -0
  169. package/tools/templates/app-template/styles/fonts/Roboto-Bold.ttf +0 -0
  170. package/tools/templates/app-template/styles/fonts/Roboto-Regular.ttf +0 -0
  171. package/tools/templates/app-template/tests/README.md +70 -0
  172. package/tools/templates/app-template/tests/automation/features/splash.feature +5 -0
  173. package/tools/templates/app-template/tests/automation/init.js +20 -0
  174. package/tools/templates/app-template/tests/automation/steps-definitions/dictionary.js +31 -0
  175. package/tools/templates/app-template/tests/automation/steps-definitions/helpers.js +9 -0
  176. package/tools/templates/app-template/tests/unit/README.md +7 -0
  177. package/tools/templates/app-template/tests/unit/app/TemplateAppRoutes.js.hbs +24 -0
  178. package/tools/templates/assets/fonts/fa-solid-900.ttf +0 -0
  179. package/tools/templates/components/ButtonItemView.js.hbs +69 -0
  180. package/tools/templates/components/ButtonView.js.hbs +65 -0
  181. package/tools/templates/components/ScrollItemView.js.hbs +53 -0
  182. package/tools/templates/components/ScrollView.js.hbs +43 -0
  183. package/tools/templates/components/TileView.js.hbs +55 -0
  184. package/tools/templates/components/screen.js.hbs +74 -0
  185. package/tools/templates/components/settings.js.hbs +74 -0
  186. package/tools/templates/components/vod.js.hbs +104 -0
  187. package/tools/templates/components/wtvMenuListView.js.hbs +38 -0
  188. package/tools/templates/components/wtvRailListView.js.hbs +44 -0
  189. package/tools/templates/index.ts +3 -0
  190. package/tools/templates/mocks/menuMock.json +29 -0
  191. package/tools/templates/mocks/railMock.json +101 -0
  192. package/tools/templates/mocks/scrollViewMock.json +165 -0
  193. package/tools/templates/modules/fip/images/12.png +0 -0
  194. package/tools/templates/modules/fip/images/audioD.png +0 -0
  195. package/tools/templates/modules/fip/package.json +5 -0
  196. package/tools/templates/modules/fip/scripts/FipModule.js +19 -0
  197. package/tools/templates/modules/fip/scripts/FipRoutes.js +19 -0
  198. package/tools/templates/modules/fip/scripts/services/mock/fipMock.json +12 -0
  199. package/tools/templates/modules/fip/scripts/ui/screens/FipScreen.js +169 -0
  200. package/tools/templates/modules/fip/scripts/ui/views/FipContentInfoView.js +77 -0
  201. package/tools/templates/modules/fip/scripts/ui/views/InfoDetailImageView.js +35 -0
  202. package/tools/templates/modules/fip/scripts/ui/views/InfoDetailTextView.js +39 -0
  203. package/tools/templates/modules/fip/scripts/ui/views/InfoListView.js +57 -0
  204. package/tools/templates/modules/fip/scripts/ui/views/PlayButtonView.js +63 -0
  205. package/tools/templates/modules/home/package.json +5 -0
  206. package/tools/templates/modules/home/scripts/HomeModule.js +19 -0
  207. package/tools/templates/modules/home/scripts/HomeRoutes.js +19 -0
  208. package/tools/templates/modules/home/scripts/services/mock/highlightMock.json +40 -0
  209. package/tools/templates/modules/home/scripts/services/mock/homeScrollViewMock.json +170 -0
  210. package/tools/templates/modules/home/scripts/ui/screens/HomeScreen.js +258 -0
  211. package/tools/templates/modules/home/scripts/ui/views/highlight/DotsListItemView.js +37 -0
  212. package/tools/templates/modules/home/scripts/ui/views/highlight/DotsListView.js +22 -0
  213. package/tools/templates/modules/home/scripts/ui/views/highlight/HighlightContentDescriptionView.js +99 -0
  214. package/tools/templates/modules/home/scripts/ui/views/highlight/HighlightPlayButtonView.js +63 -0
  215. package/tools/templates/modules/home/scripts/ui/views/highlight/HighlightRailItemView.js +186 -0
  216. package/tools/templates/modules/home/scripts/ui/views/scrollview/HomeMockTileView.js +67 -0
  217. package/tools/templates/modules/home/scripts/ui/views/scrollview/HomeRailScrollView.js +53 -0
  218. package/tools/templates/modules/home/scripts/ui/views/scrollview/HomeScrollView.js +22 -0
  219. package/tools/templates/modules/menu/images/profile.png +0 -0
  220. package/tools/templates/modules/menu/package.json +5 -0
  221. package/tools/templates/modules/menu/scripts/MenuModule.js +18 -0
  222. package/tools/templates/modules/menu/scripts/MenuRoutes.js +14 -0
  223. package/tools/templates/modules/menu/scripts/services/menuMock.json +24 -0
  224. package/tools/templates/modules/menu/scripts/ui/const/MenuIcons.js +16 -0
  225. package/tools/templates/modules/menu/scripts/ui/views/MenuButtonView.js +101 -0
  226. package/tools/templates/modules/menu/scripts/ui/views/MenuListView.js +60 -0
  227. package/tools/templates/modules/menu/scripts/ui/views/MenuView.js +87 -0
  228. package/tools/templates/modules/menu/scripts/ui/views/ProfileImageView.js +30 -0
  229. package/tools/templates/modules/player/package.json +5 -0
  230. package/tools/templates/modules/player/scripts/PlayerModule.js +19 -0
  231. package/tools/templates/modules/player/scripts/PlayerRoutes.js +19 -0
  232. package/tools/templates/modules/player/scripts/ui/const/PlayerIcons.js +19 -0
  233. package/tools/templates/modules/player/scripts/ui/screens/PlayerScreen.js +361 -0
  234. package/tools/templates/modules/player/scripts/ui/views/PlayerControlButtonView.js +69 -0
  235. package/tools/templates/modules/player/scripts/ui/views/PlayerControlsView.js +173 -0
  236. package/tools/templates/modules/player/scripts/ui/views/ProgressBarView.js +53 -0
  237. package/tools/templates/modules/search/package.json +5 -0
  238. package/tools/templates/modules/search/scripts/SearchModule.js +18 -0
  239. package/tools/templates/modules/search/scripts/SearchRoutes.js +16 -0
  240. package/tools/templates/modules/search/scripts/ui/const/EnglishKeyboardData.js +31 -0
  241. package/tools/templates/modules/search/scripts/ui/const/SearchIcons.js +14 -0
  242. package/tools/templates/modules/search/scripts/ui/const/SearchKeyboardLayout.js +19 -0
  243. package/tools/templates/modules/search/scripts/ui/primitives/SearchTextPrimitive.js +36 -0
  244. package/tools/templates/modules/search/scripts/ui/screens/SearchScreen.js +234 -0
  245. package/tools/templates/modules/search/scripts/ui/services/MockSearchService.js +39 -0
  246. package/tools/templates/modules/search/scripts/ui/services/SearchVirtualKeyboardService.js +33 -0
  247. package/tools/templates/modules/search/scripts/ui/services/mock/searchMock.json +172 -0
  248. package/tools/templates/modules/search/scripts/ui/views/SearchView.js +62 -0
  249. package/tools/templates/modules/search/scripts/ui/views/keyboard/SearchKeyboardRowItemView.js +92 -0
  250. package/tools/templates/modules/search/scripts/ui/views/keyboard/SearchKeyboardRowListView.js +33 -0
  251. package/tools/templates/modules/search/scripts/ui/views/keyboard/SearchKeyboardView.js +63 -0
  252. package/tools/templates/modules/search/scripts/ui/views/rail/SearchScrollRailView.js +53 -0
  253. package/tools/templates/modules/search/scripts/ui/views/rail/SearchScrollView.js +22 -0
  254. package/tools/templates/modules/search/scripts/ui/views/rail/SearchTileView.js +68 -0
  255. package/tools/templates/modules/search/styles/styles/fonts/fa-solid-900.ttf +0 -0
  256. package/tools/templates/modules/settings/package.json +5 -0
  257. package/tools/templates/modules/settings/scripts/SettingsModule.js +19 -0
  258. package/tools/templates/modules/settings/scripts/SettingsRoutes.js +19 -0
  259. package/tools/templates/modules/settings/scripts/ui/screens/SettingsScreen.js +200 -0
  260. package/tools/templates/modules/settings/scripts/ui/views/SettingsListItemView.js +85 -0
  261. package/tools/templates/modules/settings/scripts/ui/views/SettingsListView.js +56 -0
  262. package/tools/templates/modules/vod/package.json +5 -0
  263. package/tools/templates/modules/vod/scripts/VodModule.js +19 -0
  264. package/tools/templates/modules/vod/scripts/VodRoutes.js +19 -0
  265. package/tools/templates/modules/vod/scripts/services/mock/scrollViewMock.json +172 -0
  266. package/tools/templates/modules/vod/scripts/ui/screens/VodScreen.js +204 -0
  267. package/tools/templates/modules/vod/scripts/ui/views/MockTileView.js +69 -0
  268. package/tools/templates/modules/vod/scripts/ui/views/RailScrollItemView.js +53 -0
  269. package/tools/templates/modules/vod/scripts/ui/views/VodScrollView.js +22 -0
  270. package/tools/templates/package.json +14 -0
  271. package/tools/templates/profiles/app.config.androidtv.json +17 -0
  272. package/tools/templates/profiles/app.config.titanos.json +24 -0
  273. package/tools/templates/profiles/app.config.tizen.json +52 -0
  274. package/tools/templates/profiles/app.config.tvos.json +18 -0
  275. package/tools/templates/profiles/app.config.vidaa.json +24 -0
  276. package/tools/templates/profiles/app.config.webos.json +21 -0
  277. package/tools/templates/tutorial/modules/fip/package.json +4 -0
  278. package/tools/templates/tutorial/modules/fip/scripts/FipModule.js +18 -0
  279. package/tools/templates/tutorial/modules/fip/scripts/FipRoutes.js +19 -0
  280. package/tools/templates/tutorial/modules/fip/scripts/ui/screens/FipContentScreen.js +146 -0
  281. package/tools/templates/tutorial/modules/fip/scripts/ui/views/ElevatorView.js +66 -0
  282. package/tools/templates/tutorial/modules/fip/scripts/ui/views/FipContentInfoView.js +90 -0
  283. package/tools/templates/tutorial/modules/fip/scripts/ui/views/PlayButtonView.js +58 -0
  284. package/tools/templates/tutorial/vendors/customBE/package.json +5 -0
  285. package/tools/templates/tutorial/vendors/customBE/scripts/datas/contents.json +749 -0
  286. package/tools/templates/tutorial/vendors/customBE/scripts/services/CustomBEVodService.js +70 -0
  287. package/tsconfig.json +8 -0
  288. package/vitest.config.ts +19 -0
@@ -0,0 +1,199 @@
1
+ /*
2
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
3
+ * All Rights Reserved
4
+ *
5
+ * All information contained herein is proprietary and confidential.
6
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
7
+ * prior written permission is obtained from Wiztivi.
8
+ * No warranty, explicit or implicit, provided.
9
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
10
+ *
11
+ */
12
+
13
+ import { access, cp, mkdir, readdir, readFile, writeFile, copyFile } from "node:fs/promises";
14
+ import { dirname, join, resolve, sep } from "node:path";
15
+ import { spawnSync } from "node:child_process";
16
+ import { ANDROIDTV, TVOS } from "@/common/const/deviceConst.js";
17
+ import { Config, JsonType } from "@/common/types/helperTypes.js";
18
+ import { CredentialsHelper } from "@/commands/authentication/helper/CredentialsHelper.js";
19
+ import { getRepositoryEndpoint } from "@/commands/authentication/helper/CodeArtifactHelper.js";
20
+ import ComponentHelper from "@/commands/addComponent/helper/ComponentHelper.js";
21
+ import { ICON_FONT } from "@/commands/createApp/const/templateConst.js";
22
+ import { AppTheme } from "@/common/helpers/UpdateFileHelper.js";
23
+ import { createRequire } from "node:module";
24
+
25
+ class CreateFileHelper {
26
+ /**
27
+ * Copy the template
28
+ */
29
+ static readonly copyTemplate = async function ({ directory }: { directory: string }): Promise<string> {
30
+ const templateDir: string = resolve(dirname(ComponentHelper.getTemplatePath()), "app-template");
31
+ await mkdir(directory, { recursive: true });
32
+ await cp(templateDir, directory, { recursive: true });
33
+ return "Template copied";
34
+ };
35
+
36
+ /**
37
+ * Copy made for extra tutorial files
38
+ */
39
+ static readonly copyForTutorial = async function ({ directory }: { directory: string }): Promise<string> {
40
+ const templateDir: string = resolve(dirname(ComponentHelper.getTemplatePath()), "tutorial");
41
+ await cp(templateDir, directory, { recursive: true });
42
+ return "Tutorial files copied";
43
+ };
44
+
45
+ /**
46
+ * Copy made for templated app
47
+ */
48
+ static readonly copyForTemplatedApp = async function (
49
+ { directory }: { directory: string },
50
+ {
51
+ availableModules,
52
+ templateDir,
53
+ shouldAddIconFont,
54
+ }: { availableModules: string[]; templateDir: string; shouldAddIconFont: boolean },
55
+ ): Promise<string> {
56
+ const excludedDirectories = ["images"];
57
+
58
+ for (const module of availableModules) {
59
+ await cp(join(templateDir, module), join(directory, "modules", module), {
60
+ recursive: true,
61
+ filter: (src) => {
62
+ const dirName = src.replace(join(templateDir, module), "").split(sep)[1];
63
+ return !excludedDirectories.includes(dirName);
64
+ },
65
+ });
66
+ //copy assets such as images to corresponding folders
67
+ for (const dir of excludedDirectories) {
68
+ try {
69
+ await access(join(templateDir, module, dir));
70
+ await cp(join(templateDir, module, dir), join(directory, dir), { recursive: true });
71
+ } catch {
72
+ // Directory doesn't exist, skip
73
+ }
74
+ }
75
+ //copy fonts
76
+ if (shouldAddIconFont) {
77
+ await CreateFileHelper.copyFontFile(directory);
78
+ }
79
+ }
80
+ return "Modules files copied";
81
+ };
82
+
83
+ /**
84
+ * Copy icon font file and update app.config file
85
+ * @param directory
86
+ */
87
+ static readonly copyFontFile = async function (directory: string): Promise<void> {
88
+ const fontDir = resolve(dirname(ComponentHelper.getTemplatePath()), "assets", "fonts");
89
+ await cp(
90
+ join(fontDir, ICON_FONT.family + ".ttf"),
91
+ join(directory, "styles", "fonts", ICON_FONT.family + ".ttf"),
92
+ );
93
+
94
+ const filePath: string = join(directory, "app.config.json");
95
+ const rawJson = (await readFile(filePath)).toString();
96
+ const jsonData = JSON.parse(rawJson) as JsonType;
97
+ const defaultObj = jsonData.default as Record<string, unknown>;
98
+
99
+ const jsonTheme = defaultObj.AppTheme as AppTheme;
100
+ jsonTheme.fonts.MockIcons = ICON_FONT;
101
+
102
+ await writeFile(filePath, JSON.stringify(jsonData, null, 4));
103
+ };
104
+
105
+ /**
106
+ * Copy app.config files for selected devices
107
+ */
108
+ static readonly copyAppConfigFiles = async function ({
109
+ selectedDevices,
110
+ directory,
111
+ }: {
112
+ selectedDevices: string[];
113
+ directory: string;
114
+ }): Promise<string> {
115
+ const templateDir: string = resolve(dirname(ComponentHelper.getTemplatePath()), "profiles");
116
+ const allFiles: string[] = await readdir(templateDir);
117
+ for (const file of allFiles) {
118
+ const shouldCopy: boolean = selectedDevices.includes(file.split(".")[2]);
119
+ if (shouldCopy) {
120
+ await cp(join(templateDir, file), join(directory, "profiles", file));
121
+ }
122
+ }
123
+ return "Config file(s) copied";
124
+ };
125
+
126
+ /*
127
+ Copy skills file for AI from node_modules.
128
+ */
129
+
130
+ static readonly copySkillsFiles = async function ({ directory }: { directory: string }): Promise<string> {
131
+ const projectRequire = createRequire(resolve(directory, "package.json"));
132
+ const skillsPath = projectRequire.resolve("@dana/ai-skills/package.json");
133
+ const dianaPath = dirname(skillsPath);
134
+ const docFinalPath = join(directory, "docs");
135
+ const skillsFinalPath = join(directory, ".agents", "skills");
136
+
137
+ await Promise.all([
138
+ cp(join(dianaPath, "agents", "docs"), docFinalPath, { recursive: true, force: true }),
139
+ cp(join(dianaPath, "skills"), skillsFinalPath, { recursive: true, force: true }),
140
+ copyFile(join(dianaPath, "agents", "AGENTS.md"), join(directory, "AGENTS.md")),
141
+ ]);
142
+
143
+ return "Diana AI skill file(s) copied";
144
+ };
145
+
146
+ private static runGruntCommand(args: string[], directory: string): Promise<string> {
147
+ const gruntAndroid = spawnSync("grunt", args, { shell: true, cwd: directory });
148
+ if (gruntAndroid.status === 0) {
149
+ return Promise.resolve("Grunt task(s) done");
150
+ } else {
151
+ throw new Error("Grunt task(s) failed");
152
+ }
153
+ }
154
+
155
+ /**
156
+ * Execute grunt tasks
157
+ */
158
+ static readonly executeGruntTasks = async function ({
159
+ directory,
160
+ selectedDevices,
161
+ config,
162
+ }: {
163
+ selectedDevices: string[];
164
+ directory: string;
165
+ config: Config;
166
+ }) {
167
+ if (selectedDevices.includes(ANDROIDTV)) {
168
+ const credentials = await CredentialsHelper.get();
169
+ const registryAccount = await getRepositoryEndpoint({
170
+ organization: credentials.org,
171
+ credentials: credentials?.aws,
172
+ format: "maven",
173
+ });
174
+ const args = ["copyProjectAndroidTv", `--appUrl=${registryAccount}`, `--organization=${credentials.org}`];
175
+ const optionsToAdd: string[] = ["appId", "appName", "appVersion", "appVersionCode", "wtvAndroidtvVersion"];
176
+ for (const option of optionsToAdd) {
177
+ args.push(`--${option}=${config.androidtv?.device[option]}`);
178
+ }
179
+
180
+ try {
181
+ await CreateFileHelper.runGruntCommand(args, directory);
182
+ } catch (error) {
183
+ throw new Error(`Failed to execute grunt tasks: ${(error as Error).message}`);
184
+ }
185
+ }
186
+ if (selectedDevices.includes(TVOS)) {
187
+ try {
188
+ const args = ["copyProjectTvos", `--jscVersion=${config.tvos?.jscVersion}`];
189
+ await CreateFileHelper.runGruntCommand(args, directory);
190
+ } catch (error) {
191
+ throw new Error(`Failed to execute grunt tasks: ${(error as Error).message}`);
192
+ }
193
+ }
194
+
195
+ return "Grunt task(s) done";
196
+ };
197
+ }
198
+
199
+ export default CreateFileHelper;
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
3
+ * All Rights Reserved
4
+ *
5
+ * All information contained herein is proprietary and confidential.
6
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
7
+ * prior written permission is obtained from Wiztivi.
8
+ * No warranty, explicit or implicit, provided.
9
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
10
+ *
11
+ */
12
+
13
+ import { clean, valid } from "semver-ts";
14
+
15
+ export const validInputLength = (errorMessage: string, value?: string): string => {
16
+ if (value?.trim().length) {
17
+ return "";
18
+ }
19
+ return errorMessage;
20
+ };
21
+
22
+ export const validAppVersion = (value: string): string => {
23
+ if (!value) {
24
+ return "App version is required";
25
+ }
26
+ if (!valid(clean(value) ?? "")) {
27
+ return "App version format should be x.x.x";
28
+ }
29
+ return "";
30
+ };
31
+
32
+ export const validAppVersionCode = (value: string | number): string => {
33
+ if (!value) {
34
+ return "App version code is required";
35
+ }
36
+ if (!Number.isInteger(+value)) {
37
+ return "App version code has to be an Integer";
38
+ }
39
+ return "";
40
+ };
41
+
42
+ export const validAppId = (value?: string): string => {
43
+ const regex = /^[a-zA-Z]\w*(\.[a-zA-Z]\w*)+$/;
44
+ if (!value?.length) {
45
+ return `AppId is required !`;
46
+ }
47
+ if (!regex.test(value)) {
48
+ return "AppId should be in the following format: com.example.myapp !";
49
+ }
50
+ return "";
51
+ };
52
+
53
+ export const validNumber = (value: string, errorMessage: string) => {
54
+ if (!Number.parseInt(value, 10)) {
55
+ return errorMessage;
56
+ }
57
+ return "";
58
+ };
@@ -0,0 +1,202 @@
1
+ /*
2
+ * Copyright (c) 2014-2025 Wiztivi - contact@wiztivi.com
3
+ * All Rights Reserved
4
+ *
5
+ * All information contained herein is proprietary and confidential.
6
+ * Dissemination of this information or reproduction of this file or material, via any medium is strictly forbidden unless
7
+ * prior written permission is obtained from Wiztivi.
8
+ * No warranty, explicit or implicit, provided.
9
+ * This software MAY NOT be used, modified or rewritten without prior written permission from Wiztivi.
10
+ *
11
+ */
12
+
13
+ import { exec, execSync, spawn } from "node:child_process";
14
+ import { BASIC_DEPENDENCIES, PLATFORM_CONFIG } from "@/common/const/deviceConst.js";
15
+ import { Config, DeviceConf } from "@/common/types/helperTypes.js";
16
+ import translation from "@/common/translation/translation.js";
17
+ import path from "node:path";
18
+ import { readFile, writeFile } from "node:fs/promises";
19
+ import { DIANA_DEP } from "@/commands/addDianaSkills/dianaDependencies.js";
20
+ interface PackageJson {
21
+ devDependencies: Record<string, string>;
22
+ }
23
+
24
+ class InstallHelper {
25
+ /**
26
+ * Install dependencies with npm
27
+ * @returns {Promise<String>}
28
+ */
29
+ static readonly installDependencies = (
30
+ {
31
+ directory,
32
+ allowBeta,
33
+ }: {
34
+ directory: string;
35
+ allowBeta: boolean;
36
+ },
37
+ devDependencies: string[],
38
+ ): Promise<string> => {
39
+ return new Promise((resolve, reject) => {
40
+ const npmInstall = spawn("npm", ["i", "--silent"], { shell: true, cwd: directory });
41
+ npmInstall.on("close", (code: number) => {
42
+ if (code === 0) {
43
+ InstallHelper.installSingleDependency(devDependencies, directory, allowBeta)
44
+ .then(async () => {
45
+ await InstallHelper.updateSemver(directory);
46
+ resolve("Dependencies updated");
47
+ })
48
+ .catch((error) => {
49
+ reject(
50
+ new Error(
51
+ "Dependencies update failed : " +
52
+ ((error as Error).message ?? translation["error.common.start.message"]),
53
+ ),
54
+ );
55
+ });
56
+ } else {
57
+ reject(new Error("FAILURE during dependencies installation"));
58
+ }
59
+ });
60
+ npmInstall.on("error", (data) => {
61
+ reject(new Error(`FAILURE during dependency installation : ${data}`));
62
+ });
63
+ });
64
+ };
65
+
66
+ public static getDependenciesList(selectedDevices: string[], config: Config, skills: boolean): string[] {
67
+ let devDependencies = [...BASIC_DEPENDENCIES];
68
+ if (selectedDevices.length) {
69
+ devDependencies = devDependencies.concat(this.getAllDependencies(selectedDevices, config));
70
+ }
71
+ if (skills) {
72
+ devDependencies = devDependencies.concat(DIANA_DEP);
73
+ }
74
+ return [...new Set(devDependencies)];
75
+ }
76
+
77
+ private static readonly installSingleDependency = (
78
+ depName: string[],
79
+ directory: string,
80
+ allowBeta: boolean,
81
+ ): Promise<void> => {
82
+ return new Promise<void>((resolveInstall, rejectInstall) => {
83
+ if (allowBeta) {
84
+ depName = InstallHelper.getDependenceVersion(depName);
85
+ }
86
+
87
+ const npmInstall = spawn("npm", ["i", ...depName, "--save-dev", "--save-exact"], {
88
+ cwd: directory,
89
+ shell: true,
90
+ });
91
+ npmInstall.on("close", (code: number) => {
92
+ if (code === 0) {
93
+ resolveInstall();
94
+ } else {
95
+ rejectInstall(new Error(`FAILURE during dependency installation`));
96
+ }
97
+ });
98
+ npmInstall.on("error", (error: Error) => {
99
+ rejectInstall(new Error(`FAILURE during dependency installation : ${error.message}`));
100
+ });
101
+ });
102
+ };
103
+
104
+ private static readonly updateSemver = async (directory: string) => {
105
+ const filePath: string = path.join(directory, "package.json");
106
+ const rawData = (await readFile(filePath)).toString();
107
+ const packageJson = JSON.parse(rawData) as PackageJson;
108
+ packageJson.devDependencies = Object.entries(packageJson.devDependencies).reduce((acc, [key, value]) => {
109
+ acc[key] =
110
+ key.includes("@dana") || key.includes("@wiztivi") ? value.replace(/(\d+\.\d+\.)\d$/, "$1x") : value;
111
+ return acc;
112
+ }, {});
113
+ await writeFile(filePath, JSON.stringify(packageJson, null, 4));
114
+ };
115
+
116
+ /**
117
+ * Get a list of all dependencies needed by the different devices chosen by user
118
+ */
119
+ static readonly getAllDependencies = function (selectedDevices: string[], config: Config): string[] {
120
+ let allDep: string[] = [];
121
+ for (const el of selectedDevices) {
122
+ allDep = allDep.concat(PLATFORM_CONFIG[el].dependencies);
123
+ }
124
+ for (const key in config) {
125
+ if (Object.hasOwn(config, key)) {
126
+ const obj = config[key] as DeviceConf;
127
+ const renderer = obj.renderers ?? [];
128
+ for (const r of renderer) {
129
+ allDep = allDep.concat(PLATFORM_CONFIG[key].renderers?.[r] ?? "");
130
+ }
131
+ }
132
+ }
133
+ allDep = allDep.filter((el) => !!el);
134
+ return allDep;
135
+ };
136
+
137
+ /**
138
+ * Install grunt globally
139
+ */
140
+ static readonly installGrunt = function (): Promise<string> {
141
+ return new Promise((resolve) => {
142
+ exec("npm i -g grunt-cli", {}, () => {
143
+ resolve("Grunt installed");
144
+ });
145
+ });
146
+ };
147
+
148
+ private static runGitCommand(args: string[], directory: string): Promise<void> {
149
+ return new Promise((resolve, reject) => {
150
+ const gitProcess = spawn("git", args, { cwd: directory });
151
+ gitProcess.on("close", (code: number) => {
152
+ if (code === 0) {
153
+ resolve();
154
+ } else {
155
+ reject(new Error(`Git ${args[0]} failed`));
156
+ }
157
+ });
158
+ gitProcess.on("error", (error: Error) => {
159
+ reject(new Error(`Git ${args[0]} failed: ${error.message}`));
160
+ });
161
+ });
162
+ }
163
+
164
+ /**
165
+ * Initialize git repository and do first commit
166
+ * @returns {Promise<String>}
167
+ */
168
+ static readonly initGit = async function ({ directory }: { directory: string }): Promise<string> {
169
+ try {
170
+ await InstallHelper.runGitCommand(["init"], directory);
171
+ await InstallHelper.runGitCommand(["add", "."], directory);
172
+ await InstallHelper.runGitCommand(["commit", "-m", "Initial commit from Create DANA App"], directory);
173
+ return "Git initialized";
174
+ } catch (e) {
175
+ throw new Error("Git hasn't been initialised: " + (e as Error).message);
176
+ }
177
+ };
178
+
179
+ static getDependenceVersion(depName: string[]) {
180
+ const finalPackage: string[] = [];
181
+ depName.forEach((dep) => {
182
+ if (dep.includes("@dana") || dep.includes("@wiztivi")) {
183
+ try {
184
+ const versionList = execSync(`npm view ${dep} dist-tags --json`, { encoding: "utf-8" });
185
+ const versionListObj = JSON.parse(versionList) as Record<string, string>;
186
+ if (Object.keys(versionListObj).includes("beta")) {
187
+ finalPackage.push(`${dep}@beta`);
188
+ } else {
189
+ finalPackage.push(`${dep}@latest`);
190
+ }
191
+ } catch {
192
+ finalPackage.push(dep);
193
+ }
194
+ } else {
195
+ finalPackage.push(dep);
196
+ }
197
+ });
198
+
199
+ return finalPackage;
200
+ }
201
+ }
202
+ export default InstallHelper;