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,352 @@
1
+ import {
2
+ AwsCredentials,
3
+ CredentialsHelper,
4
+ CURRENT_DANA_JSON_VERSION,
5
+ DanaToken,
6
+ } from "@/commands/authentication/helper/CredentialsHelper.js";
7
+ import { expect, vi, afterEach } from "vitest";
8
+ import { vol } from "memfs";
9
+ import { access, readFile } from "node:fs/promises";
10
+ import { homedir } from "node:os";
11
+
12
+ vi.mock("node:fs/promises");
13
+ vi.mock("node:os", () => {
14
+ return {
15
+ homedir: vi.fn().mockReturnValue("/home/user"),
16
+ };
17
+ });
18
+ afterEach(() => {
19
+ vi.resetAllMocks();
20
+ vol.reset();
21
+ });
22
+
23
+ describe("CredentialsHelper", () => {
24
+ const setupMockFileSystem = (config?: string) => {
25
+ const fileSystem: Record<string, string | null> = {
26
+ [homedir()]: null,
27
+ };
28
+ if (config) {
29
+ fileSystem[CredentialsHelper.filePath] = config;
30
+ }
31
+ vol.fromJSON(fileSystem);
32
+ };
33
+
34
+ describe("store", () => {
35
+ it("should return true if credentials are valid", async () => {
36
+ const credentials = {
37
+ aws: "aws",
38
+ dana: "dana",
39
+ org: "ORG",
40
+ } as unknown as { aws: AwsCredentials; dana: DanaToken; org: string };
41
+
42
+ setupMockFileSystem(JSON.stringify(credentials, null, 4));
43
+
44
+ const isRemote = false;
45
+ const port = undefined;
46
+
47
+ await CredentialsHelper.store(credentials, isRemote, port);
48
+
49
+ const expectedJsonData = JSON.stringify(
50
+ {
51
+ lastUsedOrg: "ORG",
52
+ credentials: { ORG: { aws: "aws", dana: "dana" } },
53
+ isRemote: false,
54
+ version: 2,
55
+ },
56
+ null,
57
+ 4,
58
+ );
59
+ const copiedMock = await readFile(CredentialsHelper.filePath, "utf-8");
60
+ expect(copiedMock).toBe(expectedJsonData);
61
+ });
62
+
63
+ it("should write config if credentials are valid and if user use remote mode & port", async () => {
64
+ const credentials = {
65
+ aws: "aws",
66
+ dana: "dana",
67
+ org: "ORG",
68
+ } as unknown as { aws: AwsCredentials; dana: DanaToken; org: string };
69
+
70
+ vol.fromJSON({
71
+ [homedir()]: null,
72
+ [CredentialsHelper.filePath]: JSON.stringify(credentials),
73
+ });
74
+ const isRemote = true;
75
+ const port = 9002;
76
+
77
+ await CredentialsHelper.store(credentials, isRemote, port);
78
+
79
+ const expectedJsonData = JSON.stringify(
80
+ {
81
+ lastUsedOrg: "ORG",
82
+ credentials: { ORG: { aws: "aws", dana: "dana" } },
83
+ isRemote: true,
84
+ version: 2,
85
+ port: 9002,
86
+ },
87
+ null,
88
+ 4,
89
+ );
90
+
91
+ const copiedMock = await readFile(CredentialsHelper.filePath, "utf-8");
92
+ expect(copiedMock).toBe(expectedJsonData);
93
+ });
94
+ });
95
+
96
+ describe("delete", () => {
97
+ it("should do nothing if file doesn't exists", async () => {
98
+ setupMockFileSystem();
99
+
100
+ await CredentialsHelper.delete("org");
101
+ return expect(access(CredentialsHelper.filePath)).rejects.toThrow();
102
+ });
103
+
104
+ it("should remove organization entry (one entry)", async () => {
105
+ const credentials = JSON.stringify({
106
+ version: CURRENT_DANA_JSON_VERSION,
107
+ lastUsedOrg: "org",
108
+ credentials: {
109
+ org: {},
110
+ },
111
+ });
112
+
113
+ setupMockFileSystem(credentials);
114
+
115
+ await CredentialsHelper.delete("org");
116
+ const expectedJsonData = JSON.stringify(
117
+ {
118
+ version: CURRENT_DANA_JSON_VERSION,
119
+ lastUsedOrg: "org",
120
+ credentials: {},
121
+ },
122
+ null,
123
+ 4,
124
+ );
125
+
126
+ const copiedMock = await readFile(CredentialsHelper.filePath, "utf-8");
127
+ expect(copiedMock).toBe(expectedJsonData);
128
+ });
129
+ it("should remove organization entry (multiple entries)", async () => {
130
+ const credentials = JSON.stringify({
131
+ version: CURRENT_DANA_JSON_VERSION,
132
+ lastUsedOrg: "org",
133
+ credentials: {
134
+ org: {},
135
+ public: {},
136
+ },
137
+ });
138
+
139
+ setupMockFileSystem(credentials);
140
+
141
+ await CredentialsHelper.delete("org");
142
+
143
+ const expected = JSON.stringify(
144
+ {
145
+ version: CURRENT_DANA_JSON_VERSION,
146
+ lastUsedOrg: "org",
147
+ credentials: {
148
+ public: {},
149
+ },
150
+ },
151
+ null,
152
+ 4,
153
+ );
154
+ const copiedMock = await readFile(CredentialsHelper.filePath, "utf-8");
155
+ expect(copiedMock).toBe(expected);
156
+ });
157
+ });
158
+
159
+ describe("get", () => {
160
+ it("should return credentials if file exists", async () => {
161
+ const config = JSON.stringify({
162
+ version: CURRENT_DANA_JSON_VERSION,
163
+ lastUsedOrg: "DEFAULT_ORG",
164
+ credentials: {
165
+ DEFAULT_ORG: {
166
+ aws: "aws",
167
+ dana: "dana",
168
+ codeArtifact: "codeartifact",
169
+ },
170
+ },
171
+ });
172
+
173
+ setupMockFileSystem(config);
174
+
175
+ await CredentialsHelper.get();
176
+
177
+ const copiedMock = await readFile(CredentialsHelper.filePath, "utf-8");
178
+ expect(copiedMock).toBe(config);
179
+ });
180
+
181
+ it("should return credentials if file exists with port and remote mode if defined", async () => {
182
+ const config = JSON.stringify({
183
+ version: CURRENT_DANA_JSON_VERSION,
184
+ credentials: {
185
+ DEFAULT_ORG: {
186
+ aws: "aws",
187
+ dana: "dana",
188
+ },
189
+ },
190
+ isRemote: true,
191
+ port: 9002,
192
+ lastUsedOrg: "DEFAULT_ORG",
193
+ });
194
+ setupMockFileSystem(config);
195
+
196
+ await CredentialsHelper.get();
197
+
198
+ const copiedMock = await readFile(CredentialsHelper.filePath, "utf-8");
199
+ expect(copiedMock).toBe(config);
200
+ });
201
+
202
+ it("should return no credentials if file not exists", async () => {
203
+ setupMockFileSystem();
204
+
205
+ const result = await CredentialsHelper.get();
206
+
207
+ expect(result).toStrictEqual({ org: "public", isRemote: false });
208
+ });
209
+ });
210
+
211
+ describe("getConfig", () => {
212
+ it("should get config from current version", async () => {
213
+ const config = JSON.stringify({
214
+ version: CURRENT_DANA_JSON_VERSION,
215
+ lastUsedOrg: "org",
216
+ credentials: {
217
+ org: {
218
+ dana: {},
219
+ aws: {},
220
+ },
221
+ },
222
+ });
223
+ setupMockFileSystem(config);
224
+
225
+ await CredentialsHelper.getConfig();
226
+
227
+ const copiedMock = await readFile(CredentialsHelper.filePath, "utf-8");
228
+ expect(copiedMock).toBe(config);
229
+ });
230
+ it("should get config from version 1", async () => {
231
+ const config = JSON.stringify({
232
+ version: 1,
233
+ org: "org",
234
+ dana: {},
235
+ aws: {},
236
+ });
237
+
238
+ vol.fromJSON({
239
+ [homedir()]: null,
240
+ [CredentialsHelper.filePath]: config,
241
+ });
242
+
243
+ await CredentialsHelper.getConfig();
244
+ const expected = JSON.stringify(
245
+ {
246
+ lastUsedOrg: "org",
247
+ credentials: {
248
+ org: {
249
+ dana: {},
250
+ aws: {},
251
+ },
252
+ },
253
+ isRemote: false,
254
+ version: CURRENT_DANA_JSON_VERSION,
255
+ },
256
+ null,
257
+ 4,
258
+ );
259
+ const copiedMock = await readFile(CredentialsHelper.filePath, "utf-8");
260
+ expect(copiedMock).toBe(expected);
261
+ });
262
+
263
+ it("should get config from not defined version", async () => {
264
+ const config = JSON.stringify({
265
+ org: "org",
266
+ dana: {},
267
+ aws: {},
268
+ });
269
+
270
+ setupMockFileSystem(config);
271
+
272
+ await CredentialsHelper.getConfig();
273
+ const expected = JSON.stringify(
274
+ {
275
+ lastUsedOrg: "org",
276
+ credentials: {
277
+ org: {
278
+ dana: {},
279
+ aws: {},
280
+ },
281
+ },
282
+ isRemote: false,
283
+ version: CURRENT_DANA_JSON_VERSION,
284
+ },
285
+ null,
286
+ 4,
287
+ );
288
+ const copiedMock = await readFile(CredentialsHelper.filePath, "utf-8");
289
+ expect(copiedMock).toBe(expected);
290
+ });
291
+ });
292
+
293
+ describe("updateCodeArtifactToken", () => {
294
+ const commonConfig = { version: CURRENT_DANA_JSON_VERSION, lastUsedOrg: "prod", isRemote: false };
295
+ it("should update credentials", async () => {
296
+ const config = JSON.stringify({
297
+ ...commonConfig,
298
+ credentials: {
299
+ prod: {
300
+ dana: {},
301
+ aws: {},
302
+ },
303
+ },
304
+ });
305
+
306
+ const npmToken = {
307
+ token: "token",
308
+ expiration: new Date("2022-01-01T00:00:00.000Z"),
309
+ };
310
+ setupMockFileSystem(config);
311
+ const expected = JSON.stringify(
312
+ {
313
+ ...commonConfig,
314
+ credentials: {
315
+ prod: {
316
+ dana: {},
317
+ aws: {},
318
+ codeArtifact: {
319
+ token: "token",
320
+ expiration: new Date("2022-01-01T00:00:00.000Z"),
321
+ },
322
+ },
323
+ },
324
+ },
325
+ null,
326
+ 4,
327
+ );
328
+
329
+ await CredentialsHelper.updateCodeArtifactToken("prod", npmToken);
330
+ const copiedMock = await readFile(CredentialsHelper.filePath, "utf-8");
331
+
332
+ expect(copiedMock).toBe(expected);
333
+ });
334
+ it("should not update credentials if not existing", async () => {
335
+ const config = JSON.stringify({
336
+ ...commonConfig,
337
+ });
338
+
339
+ const npmToken = {
340
+ token: "token",
341
+ expiration: new Date("2022-01-01T00:00:00.000Z"),
342
+ };
343
+
344
+ setupMockFileSystem(config);
345
+
346
+ await CredentialsHelper.updateCodeArtifactToken("prod", npmToken);
347
+ const copiedMock = await readFile(CredentialsHelper.filePath, "utf-8");
348
+
349
+ expect(copiedMock).toBe(config);
350
+ });
351
+ });
352
+ });
@@ -0,0 +1,229 @@
1
+ import { afterEach, describe, expect } from "vitest";
2
+ import { readFile } from "node:fs/promises";
3
+ import { vol } from "memfs";
4
+ import {
5
+ ensureSPMDirectoriesExists,
6
+ updateSPMRegistries,
7
+ updateSPMToken,
8
+ } from "@/commands/authentication/helper/SPM.js";
9
+ import { spawnSync } from "node:child_process";
10
+ import path from "node:path";
11
+
12
+ process.env.HOME = "/HOME";
13
+ vi.mock("node:fs/promises");
14
+ vi.mock("node:child_process", () => {
15
+ return {
16
+ execSync: vi.fn(),
17
+ spawnSync: vi.fn(),
18
+ };
19
+ });
20
+
21
+ beforeEach(() => {
22
+ vi.mocked(spawnSync).mockReturnValue({
23
+ output: ["output"],
24
+ pid: 0,
25
+ signal: null,
26
+ stderr: "stderr",
27
+ stdout: "stdout",
28
+ status: 0,
29
+ });
30
+ });
31
+
32
+ afterEach(() => {
33
+ vi.resetAllMocks();
34
+ vol.reset();
35
+ });
36
+
37
+ describe("SPM", () => {
38
+ describe("ensureSPMDirectoriesExists", () => {
39
+ it("should create swiftpm directories (don't exist)", async () => {
40
+ vol.fromJSON({});
41
+
42
+ await ensureSPMDirectoriesExists();
43
+
44
+ const libraryFileMock = await readFile(
45
+ path.join(process.env.HOME!, ".swiftpm", "configuration", "registries.json"),
46
+ "utf-8",
47
+ );
48
+ expect(JSON.parse(libraryFileMock)).toMatchObject({
49
+ authentication: {},
50
+ registries: {},
51
+ version: 1,
52
+ });
53
+ });
54
+
55
+ it("should create swiftpm directories (already exist)", async () => {
56
+ vol.fromJSON({
57
+ ["/HOME/Library/org.swift.swiftpm"]: null,
58
+ ["/HOME/.swiftpm"]: null,
59
+ });
60
+
61
+ await ensureSPMDirectoriesExists();
62
+ const libraryFileMock = await readFile(
63
+ path.join(process.env.HOME!, ".swiftpm", "configuration", "registries.json"),
64
+ "utf-8",
65
+ );
66
+ expect(JSON.parse(libraryFileMock)).toMatchObject({
67
+ authentication: {},
68
+ registries: {},
69
+ version: 1,
70
+ });
71
+ });
72
+ });
73
+ describe("updateSPMRegistries", () => {
74
+ it("should update registries.json keys", async () => {
75
+ const mockData = JSON.stringify({
76
+ authentication: {},
77
+ registries: {},
78
+ version: 1,
79
+ });
80
+ vol.fromJSON({
81
+ ["filePath"]: mockData,
82
+ });
83
+
84
+ await updateSPMRegistries("filePath", "registry", "https://url");
85
+ const expected = JSON.stringify(
86
+ {
87
+ authentication: {
88
+ url: {
89
+ loginAPIPath: path.join(path.sep, "login"),
90
+ type: "token",
91
+ },
92
+ },
93
+ registries: {
94
+ registry: {
95
+ supportsAvailability: false,
96
+ url: "https://url",
97
+ },
98
+ },
99
+ version: 1,
100
+ },
101
+ null,
102
+ 2,
103
+ );
104
+ const updatedMock = await readFile("filePath", "utf-8");
105
+ expect(updatedMock).toBe(expected);
106
+ });
107
+
108
+ it("should update registries.json keys (don't touch other keys)", async () => {
109
+ const mockData = JSON.stringify(
110
+ {
111
+ authentication: {
112
+ "other.com": {
113
+ loginAPIPath: path.join("/login"),
114
+ type: "token",
115
+ },
116
+ },
117
+ registries: {
118
+ other: {
119
+ supportsAvailability: false,
120
+ url: "https://other.com",
121
+ },
122
+ },
123
+ version: 1,
124
+ },
125
+ null,
126
+ 2,
127
+ );
128
+ vol.fromJSON({
129
+ ["filePath"]: mockData,
130
+ });
131
+ await updateSPMRegistries("filePath", "registry", "https://url");
132
+
133
+ const expected = JSON.stringify(
134
+ {
135
+ authentication: {
136
+ "other.com": {
137
+ loginAPIPath: path.join("/login"),
138
+ type: "token",
139
+ },
140
+ url: {
141
+ loginAPIPath: path.join("/login"),
142
+ type: "token",
143
+ },
144
+ },
145
+ registries: {
146
+ other: {
147
+ supportsAvailability: false,
148
+ url: "https://other.com",
149
+ },
150
+ registry: {
151
+ supportsAvailability: false,
152
+ url: "https://url",
153
+ },
154
+ },
155
+ version: 1,
156
+ },
157
+ null,
158
+ 2,
159
+ );
160
+ const updatedMock = await readFile("filePath", "utf-8");
161
+ expect(updatedMock).toBe(expected);
162
+ });
163
+ });
164
+ describe("updateSPMToken", () => {
165
+ it("should update keychain token", () => {
166
+ updateSPMToken("http://url", "token");
167
+
168
+ expect(vi.mocked(spawnSync)).toHaveBeenCalledExactlyOnceWith(
169
+ "security",
170
+ [
171
+ "add-internet-password",
172
+ "-a",
173
+ "token",
174
+ "-l",
175
+ "url",
176
+ "-r",
177
+ "htps",
178
+ "-s",
179
+ "url",
180
+ "-U",
181
+ "-A",
182
+ "-w",
183
+ "token",
184
+ ],
185
+ {
186
+ encoding: "utf-8",
187
+ },
188
+ );
189
+ });
190
+
191
+ it("should handle keychain update cancel error", () => {
192
+ vi.mocked(spawnSync).mockReturnValueOnce({
193
+ output: [""],
194
+ pid: 0,
195
+ signal: null,
196
+ stdout: "",
197
+ status: 1,
198
+ stderr: "User canceled the operation",
199
+ });
200
+ expect(() => updateSPMToken("http://url", "token")).toThrowError("Please enter your keychain password");
201
+ });
202
+
203
+ it("should handle keychain already exists error", () => {
204
+ vi.mocked(spawnSync).mockReturnValueOnce({
205
+ output: [""],
206
+ pid: 0,
207
+ signal: null,
208
+ stdout: "",
209
+ status: 1,
210
+ stderr: "The specified item already exists in the keychain",
211
+ });
212
+ expect(() => updateSPMToken("http://url", "token")).toThrowError("Delete current token");
213
+ });
214
+
215
+ it("should handle keychain unknown error", () => {
216
+ vi.mocked(spawnSync).mockReturnValueOnce({
217
+ output: [""],
218
+ pid: 0,
219
+ signal: null,
220
+ stdout: "",
221
+ status: 1,
222
+ stderr: "unknown",
223
+ });
224
+ expect(() => updateSPMToken("http://url", "token")).toThrowError(
225
+ "Unable to update password in keychain.\nunknown",
226
+ );
227
+ });
228
+ });
229
+ });
@@ -0,0 +1,24 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { Command } from "commander";
3
+ import customHelp from "@/commands/commandHelp/customHelp.js";
4
+
5
+ describe("customHelpInformation", () => {
6
+ it("should return sorted command list with descriptions", () => {
7
+ const program = new Command();
8
+
9
+ program.command("gamma").description("Gamma command");
10
+ program.command("beta").description("Beta command");
11
+ program.command("alpha").description("Alpha command");
12
+
13
+ const helpText = customHelp(program);
14
+
15
+ //commands
16
+ expect(helpText).toContain("Alpha command");
17
+ expect(helpText.indexOf("alpha")).toBeLessThan(helpText.indexOf("beta"));
18
+ expect(helpText.indexOf("beta")).toBeLessThan(helpText.indexOf("gamma"));
19
+ //devices
20
+ expect(helpText).toContain("LG");
21
+ expect(helpText.indexOf("Android")).toBeLessThan(helpText.indexOf("LG"));
22
+ expect(helpText.indexOf("Samsung")).toBeLessThan(helpText.indexOf("TV OS"));
23
+ });
24
+ });
@@ -0,0 +1,76 @@
1
+ import { afterEach, expect, vi, describe } from "vitest";
2
+ import completion from "@/commands/completion/completion.js";
3
+ import { homedir } from "os";
4
+ import { COMMAND_ERROR } from "@/common/const/exitCodeConst.js";
5
+ import * as prompts from "@clack/prompts";
6
+ import { vol } from "memfs";
7
+ import { readFile } from "node:fs/promises";
8
+ import path from "node:path";
9
+
10
+ vi.mock("node:fs/promises");
11
+ vi.mock("node:os");
12
+ vi.mock("@clack/prompts");
13
+
14
+ afterEach(() => {
15
+ vi.resetAllMocks();
16
+ vol.reset();
17
+ });
18
+ const mockedPath = "/mocked/path/dana_completion.sh";
19
+
20
+ vi.mock("node:url", () => ({
21
+ fileURLToPath: () => mockedPath,
22
+ }));
23
+ vi.mock("node:os", () => ({
24
+ homedir: () => "/home/user",
25
+ }));
26
+
27
+ describe("completion", () => {
28
+ it("should run bash install without error", async () => {
29
+ vol.fromJSON({
30
+ [path.join(homedir(), ".bashrc")]: "bash",
31
+ [path.join(homedir(), ".zshrc")]: "zsh",
32
+ });
33
+ await completion("bash");
34
+
35
+ const updatedFile = await readFile("/home/user/.bashrc", "utf-8");
36
+ expect(updatedFile).toContain(`source "${path.join("/mocked", "dana_completion.sh")}"`);
37
+ expect(updatedFile).not.toContain("autoload -U compinit");
38
+ const unmodifiedFile = await readFile("/home/user/.zshrc", "utf-8");
39
+ expect(unmodifiedFile).toBe("zsh");
40
+ expect(prompts.log.success).toHaveBeenCalledOnce();
41
+ });
42
+ it("should run zsh install without error", async () => {
43
+ vol.fromJSON({
44
+ ["/home/user/.bashrc"]: "bash",
45
+ ["/home/user/.zshrc/"]: "zsh",
46
+ });
47
+ await completion("zsh");
48
+
49
+ const updatedFile = await readFile("/home/user/.zshrc", "utf-8");
50
+ expect(updatedFile).toContain("autoload -U compinit");
51
+ expect(updatedFile).toContain(`source "${path.join("/mocked", "dana_completion.sh")}"`);
52
+ const unmodifiedFile = await readFile("/home/user/.bashrc", "utf-8");
53
+ expect(unmodifiedFile).toBe("bash");
54
+ expect(prompts.log.success).toHaveBeenCalledOnce();
55
+ });
56
+ it("should exit if error", async () => {
57
+ vol.fromJSON({});
58
+ vi.spyOn(process, "exit").mockImplementation(() => undefined as never);
59
+ await completion("zsh");
60
+ expect(prompts.log.error).toHaveBeenCalledOnce();
61
+ expect(process.exit).toHaveBeenCalledWith(COMMAND_ERROR);
62
+ });
63
+ it("should exit if wrong shell argument", async () => {
64
+ vol.fromJSON({
65
+ ["/home/user/.bashrc"]: "bash",
66
+ ["/home/user/.zshrc/"]: "zsh",
67
+ });
68
+ const shellsArgs = ["fish", ""];
69
+ vi.spyOn(process, "exit").mockImplementation(() => undefined as never);
70
+ for (const arg of shellsArgs) {
71
+ await completion(arg);
72
+ expect(prompts.log.error).toHaveBeenCalled();
73
+ expect(process.exit).toHaveBeenCalledWith(COMMAND_ERROR);
74
+ }
75
+ });
76
+ });