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.
- package/.github/dependabot.yml +43 -0
- package/.github/labeler.yml +30 -0
- package/.github/workflows/bump.yml +51 -0
- package/.github/workflows/ci-cd.yml +110 -0
- package/.github/workflows/dependabot-automerge-call.yml +13 -0
- package/.nvmrc +1 -0
- package/.prettierignore +4 -0
- package/.prettierrc +4 -0
- package/CODEOWNERS +5 -0
- package/README.md +50 -2
- package/bin/bump.js +48 -0
- package/eslint.config.mjs +12 -0
- package/images/vodScreen1.png +0 -0
- package/package.json +53 -5
- package/sonar-project.properties +20 -0
- package/tools/cli/README.md +51 -0
- package/tools/cli/__mocks__/fs/promises.cjs +4 -0
- package/tools/cli/bin/dana.js +3 -0
- package/tools/cli/dana_completion.sh +156 -0
- package/tools/cli/eslint.config.mjs +14 -0
- package/tools/cli/package.json +67 -0
- package/tools/cli/rollup.config.mjs +26 -0
- package/tools/cli/src/commands/addComponent/addMenu/add-menu.ts +65 -0
- package/tools/cli/src/commands/addComponent/addMenu/addMenuDefinition.ts +21 -0
- package/tools/cli/src/commands/addComponent/addRail/add-rail.ts +59 -0
- package/tools/cli/src/commands/addComponent/addRail/addRailDefinition.ts +34 -0
- package/tools/cli/src/commands/addComponent/addScreen/add-screen.ts +42 -0
- package/tools/cli/src/commands/addComponent/addScreen/addScreenDefinition.ts +17 -0
- package/tools/cli/src/commands/addComponent/addScrollView/add-scrollView.ts +48 -0
- package/tools/cli/src/commands/addComponent/addScrollView/addScrollViewDefinition.ts +16 -0
- package/tools/cli/src/commands/addComponent/config/ComponentConfig.ts +169 -0
- package/tools/cli/src/commands/addComponent/config/componentTypes.ts +38 -0
- package/tools/cli/src/commands/addComponent/const/componentConst.ts +20 -0
- package/tools/cli/src/commands/addComponent/const/defaultConfig.ts +28 -0
- package/tools/cli/src/commands/addComponent/const/navigationConst.ts +36 -0
- package/tools/cli/src/commands/addComponent/createComponent.ts +45 -0
- package/tools/cli/src/commands/addComponent/helper/ComponentHelper.ts +98 -0
- package/tools/cli/src/commands/addDevice/add-device.ts +106 -0
- package/tools/cli/src/commands/addDevice/addDeviceDefinition.ts +13 -0
- package/tools/cli/src/commands/addDevice/deviceConfig/androidtvConfig.ts +142 -0
- package/tools/cli/src/commands/addDevice/deviceConfig/configTypes.ts +44 -0
- package/tools/cli/src/commands/addDevice/deviceConfig/deviceConfig.ts +38 -0
- package/tools/cli/src/commands/addDevice/deviceConfig/titanosConfig.ts +17 -0
- package/tools/cli/src/commands/addDevice/deviceConfig/tizenConfig.ts +64 -0
- package/tools/cli/src/commands/addDevice/deviceConfig/tvosConfig.ts +50 -0
- package/tools/cli/src/commands/addDevice/deviceConfig/vidaaConfig.ts +17 -0
- package/tools/cli/src/commands/addDevice/deviceConfig/webosConfig.ts +64 -0
- package/tools/cli/src/commands/addDevice/helper/addDeviceHelper.ts +121 -0
- package/tools/cli/src/commands/addDianaSkills/add-dianaSkills.ts +55 -0
- package/tools/cli/src/commands/addDianaSkills/addDianaSkillsDefinition.ts +13 -0
- package/tools/cli/src/commands/addDianaSkills/dianaDependencies.ts +15 -0
- package/tools/cli/src/commands/addModule/add-module.ts +46 -0
- package/tools/cli/src/commands/addModule/addModuleDefinition.ts +17 -0
- package/tools/cli/src/commands/addModule/moduleConst.ts +18 -0
- package/tools/cli/src/commands/authentication/AuthenticationManager.ts +255 -0
- package/tools/cli/src/commands/authentication/authDefinition.ts +51 -0
- package/tools/cli/src/commands/authentication/authHook.ts +50 -0
- package/tools/cli/src/commands/authentication/authentConst.ts +6 -0
- package/tools/cli/src/commands/authentication/commands/get-packages-token.ts +40 -0
- package/tools/cli/src/commands/authentication/commands/login.ts +63 -0
- package/tools/cli/src/commands/authentication/commands/logout.ts +26 -0
- package/tools/cli/src/commands/authentication/commands/status.ts +47 -0
- package/tools/cli/src/commands/authentication/helper/CodeArtifactHelper.ts +66 -0
- package/tools/cli/src/commands/authentication/helper/CommandHelper.ts +9 -0
- package/tools/cli/src/commands/authentication/helper/CredentialsHelper.ts +176 -0
- package/tools/cli/src/commands/authentication/helper/SPM.ts +95 -0
- package/tools/cli/src/commands/authentication/tokenHook.ts +30 -0
- package/tools/cli/src/commands/commandHelp/customHelp.ts +31 -0
- package/tools/cli/src/commands/completion/completion.ts +53 -0
- package/tools/cli/src/commands/completion/completionDefinition.ts +16 -0
- package/tools/cli/src/commands/createApp/const/createAppTasks.ts +133 -0
- package/tools/cli/src/commands/createApp/const/setupConst.ts +16 -0
- package/tools/cli/src/commands/createApp/const/templateConst.ts +10 -0
- package/tools/cli/src/commands/createApp/createApp.ts +60 -0
- package/tools/cli/src/commands/createApp/createAppDefinition.ts +26 -0
- package/tools/cli/src/commands/createApp/helpers/CreateAppHelper.ts +167 -0
- package/tools/cli/src/commands/createApp/helpers/SetupChecker.ts +98 -0
- package/tools/cli/src/commands/hooks/checkDanaProjectHook.ts +30 -0
- package/tools/cli/src/commands/zip/zip.ts +26 -0
- package/tools/cli/src/commands/zip/zipDefinition.ts +13 -0
- package/tools/cli/src/common/commonConst.ts +1 -0
- package/tools/cli/src/common/const/deviceConst.ts +110 -0
- package/tools/cli/src/common/const/exitCodeConst.ts +12 -0
- package/tools/cli/src/common/helpers/CreateArchiveHelper.ts +55 -0
- package/tools/cli/src/common/helpers/CreateFileHelper.ts +199 -0
- package/tools/cli/src/common/helpers/InputValidator.ts +58 -0
- package/tools/cli/src/common/helpers/InstallHelper.ts +202 -0
- package/tools/cli/src/common/helpers/UpdateFileHelper.ts +239 -0
- package/tools/cli/src/common/helpers/UserInputGetter.ts +145 -0
- package/tools/cli/src/common/helpers/handlebarsHelper.ts +31 -0
- package/tools/cli/src/common/helpers/stringHelper.ts +25 -0
- package/tools/cli/src/common/translation/en.json +87 -0
- package/tools/cli/src/common/translation/translation.ts +6 -0
- package/tools/cli/src/common/types/helperTypes.ts +79 -0
- package/tools/cli/src/index.ts +16 -0
- package/tools/cli/src/program.ts +59 -0
- package/tools/cli/tests/commands/addComponent/addMenu/add-menu.test.ts +96 -0
- package/tools/cli/tests/commands/addComponent/addRail/add-rail.test.ts +57 -0
- package/tools/cli/tests/commands/addComponent/addScreen/add-screen.test.ts +55 -0
- package/tools/cli/tests/commands/addComponent/addScrollView/add-scrollView.test.ts +89 -0
- package/tools/cli/tests/commands/addComponent/config/ComponentConfig.test.ts +261 -0
- package/tools/cli/tests/commands/addComponent/createComponent.test.ts +87 -0
- package/tools/cli/tests/commands/addComponent/helper/ComponentHelper.test.ts +110 -0
- package/tools/cli/tests/commands/addDevice/add-device.test.ts +117 -0
- package/tools/cli/tests/commands/addDevice/deviceConfig/androidtvConfig.test.ts +184 -0
- package/tools/cli/tests/commands/addDevice/deviceConfig/deviceConfig.test.ts +30 -0
- package/tools/cli/tests/commands/addDevice/deviceConfig/titanosConfig.test.ts +20 -0
- package/tools/cli/tests/commands/addDevice/deviceConfig/tizenConfig.test.ts +63 -0
- package/tools/cli/tests/commands/addDevice/deviceConfig/tvosConfig.test.ts +47 -0
- package/tools/cli/tests/commands/addDevice/deviceConfig/vidaaConfig.test.ts +20 -0
- package/tools/cli/tests/commands/addDevice/deviceConfig/webosConfig.test.ts +74 -0
- package/tools/cli/tests/commands/addDevice/helper/addDeviceHelper.test.ts +144 -0
- package/tools/cli/tests/commands/addDianaSkills/add-dianaSkills.test.ts +72 -0
- package/tools/cli/tests/commands/addModule/add-module.test.ts +108 -0
- package/tools/cli/tests/commands/authentication/AuthenticationManager.test.ts +756 -0
- package/tools/cli/tests/commands/authentication/commands/authDefinition.test.ts +53 -0
- package/tools/cli/tests/commands/authentication/commands/authHook.test.ts +94 -0
- package/tools/cli/tests/commands/authentication/commands/get-packages-token.test.ts +69 -0
- package/tools/cli/tests/commands/authentication/commands/login.test.ts +170 -0
- package/tools/cli/tests/commands/authentication/commands/logout.test.ts +77 -0
- package/tools/cli/tests/commands/authentication/commands/status.test.ts +73 -0
- package/tools/cli/tests/commands/authentication/helper/CredentialsHelper.test.ts +352 -0
- package/tools/cli/tests/commands/authentication/helper/SPM.test.ts +229 -0
- package/tools/cli/tests/commands/cliHelp/customHelp.test.ts +24 -0
- package/tools/cli/tests/commands/completion/completion.test.ts +76 -0
- package/tools/cli/tests/commands/createApp/const/createAppTasks.test.ts +70 -0
- package/tools/cli/tests/commands/createApp/createApp.test.ts +116 -0
- package/tools/cli/tests/commands/createApp/helpers/CreateAppHelper.test.ts +197 -0
- package/tools/cli/tests/commands/createApp/helpers/SetupChecker.test.ts +152 -0
- package/tools/cli/tests/commands/createApp/helpers/fixtures/myApp/scripts/app/ui/screens/SplashScreen.js +70 -0
- package/tools/cli/tests/commands/hooks/checkDanaProjectHook.test.ts +55 -0
- package/tools/cli/tests/commands/zip/zip.test.ts +51 -0
- package/tools/cli/tests/common/helpers/CreateArchiveHelper.test.ts +69 -0
- package/tools/cli/tests/common/helpers/CreateFileHelper.test.ts +359 -0
- package/tools/cli/tests/common/helpers/InputValidator.test.ts +93 -0
- package/tools/cli/tests/common/helpers/InstallHelper.test.ts +262 -0
- package/tools/cli/tests/common/helpers/UpdateFileHelper.test.ts +288 -0
- package/tools/cli/tests/common/helpers/UserInputGetter.test.ts +182 -0
- package/tools/cli/tests/common/helpers/handlebarsHelper.test.ts +87 -0
- package/tools/cli/tests/common/helpers/stringHelper.test.ts +35 -0
- package/tools/cli/tests/program.test.ts +215 -0
- package/tools/cli/tsconfig.json +19 -0
- package/tools/cli/tsconfig.test.json +4 -0
- package/tools/cli/vitest.config.ts +4 -0
- package/tools/templates/app-template/.dana/.gitkeep +0 -0
- package/tools/templates/app-template/Gruntfile.js +31 -0
- package/tools/templates/app-template/README.md +17 -0
- package/tools/templates/app-template/app.config.json +56 -0
- package/tools/templates/app-template/editorconfigTemplate.hbs +18 -0
- package/tools/templates/app-template/eslintrc.jsonTemplate.hbs +5 -0
- package/tools/templates/app-template/gitignoreTemplate.hbs +27 -0
- package/tools/templates/app-template/i18n/LocaleStringEnUS.json +7 -0
- package/tools/templates/app-template/i18n/README.md +32 -0
- package/tools/templates/app-template/images/dana.png +0 -0
- package/tools/templates/app-template/images/dana_logo.png +0 -0
- package/tools/templates/app-template/images/dana_logo_light.png +0 -0
- package/tools/templates/app-template/images/loading.png +0 -0
- package/tools/templates/app-template/nvmrcTemplate.hbs +1 -0
- package/tools/templates/app-template/package.json +33 -0
- package/tools/templates/app-template/profiles/app.config.browser-css.json +16 -0
- package/tools/templates/app-template/profiles/app.config.browser-lightning.json +16 -0
- package/tools/templates/app-template/scripts/app/README.md +6 -0
- package/tools/templates/app-template/scripts/app/TemplateAppRoutes.js.hbs +18 -0
- package/tools/templates/app-template/scripts/app/app.js.hbs +17 -0
- package/tools/templates/app-template/scripts/app/theme/AppTheme.js +57 -0
- package/tools/templates/app-template/scripts/app/ui/screens/AppScreen.js +106 -0
- package/tools/templates/app-template/scripts/app/ui/screens/SplashScreen.js +70 -0
- package/tools/templates/app-template/scripts/app/ui/views/LoaderView.js +31 -0
- package/tools/templates/app-template/styles/fonts/Roboto-Bold.ttf +0 -0
- package/tools/templates/app-template/styles/fonts/Roboto-Regular.ttf +0 -0
- package/tools/templates/app-template/tests/README.md +70 -0
- package/tools/templates/app-template/tests/automation/features/splash.feature +5 -0
- package/tools/templates/app-template/tests/automation/init.js +20 -0
- package/tools/templates/app-template/tests/automation/steps-definitions/dictionary.js +31 -0
- package/tools/templates/app-template/tests/automation/steps-definitions/helpers.js +9 -0
- package/tools/templates/app-template/tests/unit/README.md +7 -0
- package/tools/templates/app-template/tests/unit/app/TemplateAppRoutes.js.hbs +24 -0
- package/tools/templates/assets/fonts/fa-solid-900.ttf +0 -0
- package/tools/templates/components/ButtonItemView.js.hbs +69 -0
- package/tools/templates/components/ButtonView.js.hbs +65 -0
- package/tools/templates/components/ScrollItemView.js.hbs +53 -0
- package/tools/templates/components/ScrollView.js.hbs +43 -0
- package/tools/templates/components/TileView.js.hbs +55 -0
- package/tools/templates/components/screen.js.hbs +74 -0
- package/tools/templates/components/settings.js.hbs +74 -0
- package/tools/templates/components/vod.js.hbs +104 -0
- package/tools/templates/components/wtvMenuListView.js.hbs +38 -0
- package/tools/templates/components/wtvRailListView.js.hbs +44 -0
- package/tools/templates/index.ts +3 -0
- package/tools/templates/mocks/menuMock.json +29 -0
- package/tools/templates/mocks/railMock.json +101 -0
- package/tools/templates/mocks/scrollViewMock.json +165 -0
- package/tools/templates/modules/fip/images/12.png +0 -0
- package/tools/templates/modules/fip/images/audioD.png +0 -0
- package/tools/templates/modules/fip/package.json +5 -0
- package/tools/templates/modules/fip/scripts/FipModule.js +19 -0
- package/tools/templates/modules/fip/scripts/FipRoutes.js +19 -0
- package/tools/templates/modules/fip/scripts/services/mock/fipMock.json +12 -0
- package/tools/templates/modules/fip/scripts/ui/screens/FipScreen.js +169 -0
- package/tools/templates/modules/fip/scripts/ui/views/FipContentInfoView.js +77 -0
- package/tools/templates/modules/fip/scripts/ui/views/InfoDetailImageView.js +35 -0
- package/tools/templates/modules/fip/scripts/ui/views/InfoDetailTextView.js +39 -0
- package/tools/templates/modules/fip/scripts/ui/views/InfoListView.js +57 -0
- package/tools/templates/modules/fip/scripts/ui/views/PlayButtonView.js +63 -0
- package/tools/templates/modules/home/package.json +5 -0
- package/tools/templates/modules/home/scripts/HomeModule.js +19 -0
- package/tools/templates/modules/home/scripts/HomeRoutes.js +19 -0
- package/tools/templates/modules/home/scripts/services/mock/highlightMock.json +40 -0
- package/tools/templates/modules/home/scripts/services/mock/homeScrollViewMock.json +170 -0
- package/tools/templates/modules/home/scripts/ui/screens/HomeScreen.js +258 -0
- package/tools/templates/modules/home/scripts/ui/views/highlight/DotsListItemView.js +37 -0
- package/tools/templates/modules/home/scripts/ui/views/highlight/DotsListView.js +22 -0
- package/tools/templates/modules/home/scripts/ui/views/highlight/HighlightContentDescriptionView.js +99 -0
- package/tools/templates/modules/home/scripts/ui/views/highlight/HighlightPlayButtonView.js +63 -0
- package/tools/templates/modules/home/scripts/ui/views/highlight/HighlightRailItemView.js +186 -0
- package/tools/templates/modules/home/scripts/ui/views/scrollview/HomeMockTileView.js +67 -0
- package/tools/templates/modules/home/scripts/ui/views/scrollview/HomeRailScrollView.js +53 -0
- package/tools/templates/modules/home/scripts/ui/views/scrollview/HomeScrollView.js +22 -0
- package/tools/templates/modules/menu/images/profile.png +0 -0
- package/tools/templates/modules/menu/package.json +5 -0
- package/tools/templates/modules/menu/scripts/MenuModule.js +18 -0
- package/tools/templates/modules/menu/scripts/MenuRoutes.js +14 -0
- package/tools/templates/modules/menu/scripts/services/menuMock.json +24 -0
- package/tools/templates/modules/menu/scripts/ui/const/MenuIcons.js +16 -0
- package/tools/templates/modules/menu/scripts/ui/views/MenuButtonView.js +101 -0
- package/tools/templates/modules/menu/scripts/ui/views/MenuListView.js +60 -0
- package/tools/templates/modules/menu/scripts/ui/views/MenuView.js +87 -0
- package/tools/templates/modules/menu/scripts/ui/views/ProfileImageView.js +30 -0
- package/tools/templates/modules/player/package.json +5 -0
- package/tools/templates/modules/player/scripts/PlayerModule.js +19 -0
- package/tools/templates/modules/player/scripts/PlayerRoutes.js +19 -0
- package/tools/templates/modules/player/scripts/ui/const/PlayerIcons.js +19 -0
- package/tools/templates/modules/player/scripts/ui/screens/PlayerScreen.js +361 -0
- package/tools/templates/modules/player/scripts/ui/views/PlayerControlButtonView.js +69 -0
- package/tools/templates/modules/player/scripts/ui/views/PlayerControlsView.js +173 -0
- package/tools/templates/modules/player/scripts/ui/views/ProgressBarView.js +53 -0
- package/tools/templates/modules/search/package.json +5 -0
- package/tools/templates/modules/search/scripts/SearchModule.js +18 -0
- package/tools/templates/modules/search/scripts/SearchRoutes.js +16 -0
- package/tools/templates/modules/search/scripts/ui/const/EnglishKeyboardData.js +31 -0
- package/tools/templates/modules/search/scripts/ui/const/SearchIcons.js +14 -0
- package/tools/templates/modules/search/scripts/ui/const/SearchKeyboardLayout.js +19 -0
- package/tools/templates/modules/search/scripts/ui/primitives/SearchTextPrimitive.js +36 -0
- package/tools/templates/modules/search/scripts/ui/screens/SearchScreen.js +234 -0
- package/tools/templates/modules/search/scripts/ui/services/MockSearchService.js +39 -0
- package/tools/templates/modules/search/scripts/ui/services/SearchVirtualKeyboardService.js +33 -0
- package/tools/templates/modules/search/scripts/ui/services/mock/searchMock.json +172 -0
- package/tools/templates/modules/search/scripts/ui/views/SearchView.js +62 -0
- package/tools/templates/modules/search/scripts/ui/views/keyboard/SearchKeyboardRowItemView.js +92 -0
- package/tools/templates/modules/search/scripts/ui/views/keyboard/SearchKeyboardRowListView.js +33 -0
- package/tools/templates/modules/search/scripts/ui/views/keyboard/SearchKeyboardView.js +63 -0
- package/tools/templates/modules/search/scripts/ui/views/rail/SearchScrollRailView.js +53 -0
- package/tools/templates/modules/search/scripts/ui/views/rail/SearchScrollView.js +22 -0
- package/tools/templates/modules/search/scripts/ui/views/rail/SearchTileView.js +68 -0
- package/tools/templates/modules/search/styles/styles/fonts/fa-solid-900.ttf +0 -0
- package/tools/templates/modules/settings/package.json +5 -0
- package/tools/templates/modules/settings/scripts/SettingsModule.js +19 -0
- package/tools/templates/modules/settings/scripts/SettingsRoutes.js +19 -0
- package/tools/templates/modules/settings/scripts/ui/screens/SettingsScreen.js +200 -0
- package/tools/templates/modules/settings/scripts/ui/views/SettingsListItemView.js +85 -0
- package/tools/templates/modules/settings/scripts/ui/views/SettingsListView.js +56 -0
- package/tools/templates/modules/vod/package.json +5 -0
- package/tools/templates/modules/vod/scripts/VodModule.js +19 -0
- package/tools/templates/modules/vod/scripts/VodRoutes.js +19 -0
- package/tools/templates/modules/vod/scripts/services/mock/scrollViewMock.json +172 -0
- package/tools/templates/modules/vod/scripts/ui/screens/VodScreen.js +204 -0
- package/tools/templates/modules/vod/scripts/ui/views/MockTileView.js +69 -0
- package/tools/templates/modules/vod/scripts/ui/views/RailScrollItemView.js +53 -0
- package/tools/templates/modules/vod/scripts/ui/views/VodScrollView.js +22 -0
- package/tools/templates/package.json +14 -0
- package/tools/templates/profiles/app.config.androidtv.json +17 -0
- package/tools/templates/profiles/app.config.titanos.json +24 -0
- package/tools/templates/profiles/app.config.tizen.json +52 -0
- package/tools/templates/profiles/app.config.tvos.json +18 -0
- package/tools/templates/profiles/app.config.vidaa.json +24 -0
- package/tools/templates/profiles/app.config.webos.json +21 -0
- package/tools/templates/tutorial/modules/fip/package.json +4 -0
- package/tools/templates/tutorial/modules/fip/scripts/FipModule.js +18 -0
- package/tools/templates/tutorial/modules/fip/scripts/FipRoutes.js +19 -0
- package/tools/templates/tutorial/modules/fip/scripts/ui/screens/FipContentScreen.js +146 -0
- package/tools/templates/tutorial/modules/fip/scripts/ui/views/ElevatorView.js +66 -0
- package/tools/templates/tutorial/modules/fip/scripts/ui/views/FipContentInfoView.js +90 -0
- package/tools/templates/tutorial/modules/fip/scripts/ui/views/PlayButtonView.js +58 -0
- package/tools/templates/tutorial/vendors/customBE/package.json +5 -0
- package/tools/templates/tutorial/vendors/customBE/scripts/datas/contents.json +749 -0
- package/tools/templates/tutorial/vendors/customBE/scripts/services/CustomBEVodService.js +70 -0
- package/tsconfig.json +8 -0
- package/vitest.config.ts +19 -0
|
@@ -0,0 +1,182 @@
|
|
|
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 UserInputGetter from "@/common/helpers/UserInputGetter.js";
|
|
14
|
+
import * as deviceConst from "@/common/const/deviceConst.js";
|
|
15
|
+
import * as prompts from "@clack/prompts";
|
|
16
|
+
import cp from "node:child_process";
|
|
17
|
+
import { beforeEach, describe, vi } from "vitest";
|
|
18
|
+
import { TITANOS, TIZEN, VIDAA, WEBOS } from "@/common/const/deviceConst.js";
|
|
19
|
+
import CreateAppHelper, { Spinner } from "@/commands/createApp/helpers/CreateAppHelper.js";
|
|
20
|
+
import DeviceConfig from "@/commands/addDevice/deviceConfig/deviceConfig.js";
|
|
21
|
+
|
|
22
|
+
vi.mock("@clack/prompts");
|
|
23
|
+
vi.mock("node:child_process");
|
|
24
|
+
|
|
25
|
+
afterEach(() => {
|
|
26
|
+
vi.resetAllMocks();
|
|
27
|
+
vi.restoreAllMocks();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("getPrompts", () => {
|
|
31
|
+
test("should return the prompts", () => {
|
|
32
|
+
const result = UserInputGetter.getPrompts("myProject", true);
|
|
33
|
+
|
|
34
|
+
expect(Object.keys(result)).toEqual(["name", "directory", "selectedDevices"]);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe("askProjectName", () => {
|
|
39
|
+
test("should return formatted name if there is one", async () => {
|
|
40
|
+
const inputs = [
|
|
41
|
+
{ name: "my-beautiful-app", expected: "my-beautiful-app" },
|
|
42
|
+
{ name: "my--beautiful_app", expected: "my--beautiful_app" },
|
|
43
|
+
{ name: "my/beautiful/app ", expected: "myBeautifulApp" },
|
|
44
|
+
{ name: "my beautiful app ", expected: "myBeautifulApp" },
|
|
45
|
+
];
|
|
46
|
+
for (const input of inputs) {
|
|
47
|
+
expect(await UserInputGetter.askProjectName(input.name)).toEqual(input.expected);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
test("should return the formatted result of prompts", async () => {
|
|
51
|
+
const inputs = [
|
|
52
|
+
{ name: "my-beautiful-app", expected: "my-beautiful-app" },
|
|
53
|
+
{ name: "my--beautiful_app", expected: "my--beautiful_app" },
|
|
54
|
+
{ name: "my/beautiful/app ", expected: "myBeautifulApp" },
|
|
55
|
+
{ name: "my beautiful app ", expected: "myBeautifulApp" },
|
|
56
|
+
];
|
|
57
|
+
for (const input of inputs) {
|
|
58
|
+
vi.mocked(prompts.text).mockResolvedValue(input.name);
|
|
59
|
+
expect(await UserInputGetter.askProjectName(input.name)).toEqual(input.expected);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe("getProjectDirectory", () => {
|
|
65
|
+
test("should return the name if there is one", async () => {
|
|
66
|
+
const name = await UserInputGetter.getProjectDirectory("Lapin");
|
|
67
|
+
|
|
68
|
+
expect(name).toEqual("./Lapin");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe("askDevices", () => {
|
|
73
|
+
describe("there are devices to select", () => {
|
|
74
|
+
beforeEach(() => {
|
|
75
|
+
vi.spyOn(UserInputGetter, "getAvailableDevices").mockResolvedValue({
|
|
76
|
+
availableDevices: [
|
|
77
|
+
{ value: "a", label: "a" },
|
|
78
|
+
{ value: "b", label: "b" },
|
|
79
|
+
],
|
|
80
|
+
unavailableDevices: [],
|
|
81
|
+
});
|
|
82
|
+
vi.mocked(prompts.confirm).mockResolvedValue(true);
|
|
83
|
+
vi.mocked(prompts.multiselect).mockResolvedValue(["a"]);
|
|
84
|
+
vi.spyOn(UserInputGetter, "getBasicDevices").mockReturnValue(["z"]);
|
|
85
|
+
});
|
|
86
|
+
test("should not display unavailable device list", async () => {
|
|
87
|
+
await UserInputGetter.askDevices(true);
|
|
88
|
+
|
|
89
|
+
expect(prompts.log.warn).toHaveBeenCalledTimes(0);
|
|
90
|
+
});
|
|
91
|
+
test("should return the result of prompts and basic devices", async () => {
|
|
92
|
+
const selectedDevices = await UserInputGetter.askDevices(true);
|
|
93
|
+
|
|
94
|
+
expect(selectedDevices).toEqual(["z", "a"]);
|
|
95
|
+
});
|
|
96
|
+
test("should use availableDevices list as option", async () => {
|
|
97
|
+
await UserInputGetter.askDevices(true);
|
|
98
|
+
expect(vi.mocked(prompts.multiselect).mock.calls[0][0].options).toEqual([
|
|
99
|
+
{ value: "a", label: "a" },
|
|
100
|
+
{ value: "b", label: "b" },
|
|
101
|
+
]);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
describe("there is no device subscribed", () => {
|
|
105
|
+
beforeEach(() => {
|
|
106
|
+
vi.spyOn(UserInputGetter, "getAvailableDevices").mockResolvedValue({
|
|
107
|
+
availableDevices: [],
|
|
108
|
+
unavailableDevices: ["a", "b"],
|
|
109
|
+
});
|
|
110
|
+
vi.mocked(prompts.confirm).mockResolvedValue(true);
|
|
111
|
+
vi.spyOn(UserInputGetter, "getBasicDevices").mockReturnValue(["z"]);
|
|
112
|
+
});
|
|
113
|
+
test("should display unavailable device list", async () => {
|
|
114
|
+
await UserInputGetter.askDevices(true);
|
|
115
|
+
|
|
116
|
+
expect(prompts.log.warn).toHaveBeenCalledTimes(1);
|
|
117
|
+
});
|
|
118
|
+
test("should not ask user to select device", async () => {
|
|
119
|
+
const selectedDevices = await UserInputGetter.askDevices(true);
|
|
120
|
+
|
|
121
|
+
expect(prompts.multiselect).toHaveBeenCalledTimes(0);
|
|
122
|
+
expect(selectedDevices).toEqual(["z"]);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
describe("User did not provide --devices option", () => {
|
|
126
|
+
test("should return only basic devices", async () => {
|
|
127
|
+
vi.spyOn(UserInputGetter, "getBasicDevices").mockReturnValue(["z"]);
|
|
128
|
+
vi.mocked(prompts.confirm).mockResolvedValue(false);
|
|
129
|
+
const selectedDevices = await UserInputGetter.askDevices(false);
|
|
130
|
+
|
|
131
|
+
expect(selectedDevices).toEqual(["z"]);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
describe("getDevicesConfig", () => {
|
|
137
|
+
it("should call getDeviceConfig for each selected device", async () => {
|
|
138
|
+
vi.spyOn(CreateAppHelper, "getDeviceConfig").mockReturnValue(DeviceConfig);
|
|
139
|
+
const selectedDevices = ["tvos", "webos"];
|
|
140
|
+
const awsProfile = "awsProfile";
|
|
141
|
+
|
|
142
|
+
const result = await UserInputGetter.getDevicesConfig({ selectedDevices, awsProfile });
|
|
143
|
+
expect(Object.keys(result)).toEqual(expect.arrayContaining(selectedDevices));
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe("getAvailableDevices", () => {
|
|
148
|
+
it("should return 2 arrays", async () => {
|
|
149
|
+
const deviceMock = {
|
|
150
|
+
device1: { label: "device 1", package: "package1", dependencies: [] },
|
|
151
|
+
device2: { label: "device 2", package: "package2", dependencies: [] },
|
|
152
|
+
};
|
|
153
|
+
vi.spyOn(deviceConst, "EXTENDED_SETUP", "get").mockReturnValue(deviceMock);
|
|
154
|
+
const execMock = vi.mocked(cp.execSync).mockRejectedValueOnce(new Error("no package")).mockResolvedValue("");
|
|
155
|
+
const spinner = {
|
|
156
|
+
start: vi.fn(),
|
|
157
|
+
stop: vi.fn(),
|
|
158
|
+
message: vi.fn(),
|
|
159
|
+
} as unknown as Spinner;
|
|
160
|
+
vi.mocked(prompts.spinner).mockReturnValue(spinner);
|
|
161
|
+
const expectedResult = {
|
|
162
|
+
availableDevices: [{ value: "device2", label: "device 2" }],
|
|
163
|
+
unavailableDevices: ["device 1"],
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
try {
|
|
167
|
+
const result = await UserInputGetter.getAvailableDevices();
|
|
168
|
+
expect(execMock).toHaveBeenCalledTimes(2);
|
|
169
|
+
expect(result.availableDevices).toStrictEqual(expectedResult.availableDevices);
|
|
170
|
+
expect(result.unavailableDevices).toStrictEqual(expectedResult.unavailableDevices);
|
|
171
|
+
} catch {
|
|
172
|
+
/* empty */
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
describe("getBasicDevices", () => {
|
|
178
|
+
it("should return a list of devices corresponding to BASIC_SETUP list", () => {
|
|
179
|
+
const result = UserInputGetter.getBasicDevices();
|
|
180
|
+
expect(result).toEqual([TIZEN, WEBOS, VIDAA, TITANOS]);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { afterEach, vi } from "vitest";
|
|
2
|
+
import { templateGenerator } from "@/common/helpers/handlebarsHelper.js";
|
|
3
|
+
import { vol } from "memfs";
|
|
4
|
+
|
|
5
|
+
vi.mock("node:fs/promises");
|
|
6
|
+
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
vi.resetAllMocks();
|
|
9
|
+
vol.reset();
|
|
10
|
+
});
|
|
11
|
+
describe("templateGenerator", () => {
|
|
12
|
+
it("should compile the template", async () => {
|
|
13
|
+
const tests = [
|
|
14
|
+
{
|
|
15
|
+
title: "ifNotEqTo returns false",
|
|
16
|
+
input: '{{#ifNotEqTo "Model" "Model"}}true{{else}}false{{/ifNotEqTo}}',
|
|
17
|
+
expected: "false",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
title: "ifNotEqTo returns true",
|
|
21
|
+
input: '{{#ifNotEqTo "aModel" "Model"}}true{{else}}false{{/ifNotEqTo}}',
|
|
22
|
+
expected: "true",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: "ifEqTo returns false",
|
|
26
|
+
input: '{{#ifEqTo "aModel" "Model"}}true{{else}}false{{/ifEqTo}}',
|
|
27
|
+
expected: "false",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: "ifEqTo returns true",
|
|
31
|
+
input: '{{#ifEqTo "Model" "Model"}}true{{else}}false{{/ifEqTo}}',
|
|
32
|
+
expected: "true",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: "normalizeName",
|
|
36
|
+
input: '{{normalizeName "rail" "ListView"}}',
|
|
37
|
+
expected: "RailListView",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: "normalizeName",
|
|
41
|
+
input: '{{normalizeName "railListView" "ListView"}}',
|
|
42
|
+
expected: "RailListView",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
title: "normalizeName",
|
|
46
|
+
input: '{{normalizeName "raillistView" "ListView"}}',
|
|
47
|
+
expected: "RailListView",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: "normalizeName",
|
|
51
|
+
input: '{{normalizeName "raillistview" "ListView"}}',
|
|
52
|
+
expected: "RailListView",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
title: "normalizeName",
|
|
56
|
+
input: '{{normalizeName "rail-listview" "ListView"}}',
|
|
57
|
+
expected: "RailListView",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
title: "normalizeName",
|
|
61
|
+
input: '{{normalizeName "rail_listview" "ListView"}}',
|
|
62
|
+
expected: "RailListView",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: "normalizeName",
|
|
66
|
+
input: '{{normalizeName "rail.listview" "ListView"}}',
|
|
67
|
+
expected: "RailListView",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
title: "normalizeName",
|
|
71
|
+
input: '{{normalizeName "playerscreen" "Screen"}}',
|
|
72
|
+
expected: "PlayerScreen",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
title: "capitalize",
|
|
76
|
+
input: '{{capitalize "rail" }}',
|
|
77
|
+
expected: "Rail",
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
for (const test of tests) {
|
|
82
|
+
vol.fromJSON({ "/template": test.input });
|
|
83
|
+
const result = await templateGenerator("/template", {});
|
|
84
|
+
expect(result).toEqual(test.expected);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
capitalizeFirstLetter,
|
|
4
|
+
formatToCamelCase,
|
|
5
|
+
formatWordToCamelCase,
|
|
6
|
+
optionsListString,
|
|
7
|
+
} from "@/common/helpers/stringHelper.js";
|
|
8
|
+
|
|
9
|
+
describe("capitalizeFirstLetter", () => {
|
|
10
|
+
it("should capitalize", () => {
|
|
11
|
+
expect(capitalizeFirstLetter("myComponent")).toBe("MyComponent");
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe("optionsListString", () => {
|
|
16
|
+
it("should return a string", () => {
|
|
17
|
+
const MOCK = [
|
|
18
|
+
{ value: `HORIZONTAL`, label: "HORIZONTAL", command: "h" },
|
|
19
|
+
{ value: `VERTICAL`, label: "VERTICAL", command: "v" },
|
|
20
|
+
];
|
|
21
|
+
expect(optionsListString(MOCK)).toBe("h, v");
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe("formatToCamelCase", () => {
|
|
26
|
+
it("should format", () => {
|
|
27
|
+
expect(formatToCamelCase("MY_cOmponent-is.noT/formatted")).toBe("myComponentIsNotFormatted");
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe("formatWordToCamelCase", () => {
|
|
32
|
+
it("should format", () => {
|
|
33
|
+
expect(formatWordToCamelCase("aPp")).toBe("App");
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, vi } from "vitest";
|
|
2
|
+
import { vol } from "memfs";
|
|
3
|
+
import { makeProgram } from "@/program.js";
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import { ModuleType } from "@/commands/addModule/moduleConst.js";
|
|
6
|
+
|
|
7
|
+
interface CommandWithHooks extends Command {
|
|
8
|
+
_lifeCycleHooks: {
|
|
9
|
+
preAction: { name: string }[];
|
|
10
|
+
preSubcommand: { name: string }[];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
vi.mock("node:fs/promises");
|
|
15
|
+
vi.mock("node:url", () => ({
|
|
16
|
+
fileURLToPath: () => "path",
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
vol.fromJSON({
|
|
21
|
+
["../package.json"]: JSON.stringify({ name: "dana/cli", version: "1.0.0" }),
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
vi.resetAllMocks();
|
|
26
|
+
vol.reset();
|
|
27
|
+
});
|
|
28
|
+
describe("makeProgram", () => {
|
|
29
|
+
it("should make program", async () => {
|
|
30
|
+
const program = await makeProgram();
|
|
31
|
+
|
|
32
|
+
expect(program.name()).toBe("dana/cli");
|
|
33
|
+
expect(program.commands.length).toBe(11);
|
|
34
|
+
});
|
|
35
|
+
it("should create add-rail command", async () => {
|
|
36
|
+
const pg = await makeProgram();
|
|
37
|
+
const command = pg.commands[0];
|
|
38
|
+
|
|
39
|
+
expect(command.name()).toBe("add-rail");
|
|
40
|
+
expect(command.registeredArguments[0].name()).toBe("name");
|
|
41
|
+
expect(command.options.length).toBe(6);
|
|
42
|
+
|
|
43
|
+
const expectedOptions = [
|
|
44
|
+
{ short: "--cm", long: "--custom" },
|
|
45
|
+
{ short: "-n", long: "--navigation" },
|
|
46
|
+
{ short: "-d", long: "--direction" },
|
|
47
|
+
{ short: "-c", long: "--cyclic" },
|
|
48
|
+
{ short: "-i", long: "--itemView" },
|
|
49
|
+
{ short: "-p", long: "--path" },
|
|
50
|
+
];
|
|
51
|
+
expectedOptions.forEach((option, index) => {
|
|
52
|
+
expect(command.options[index].short).toBe(option.short);
|
|
53
|
+
expect(command.options[index].long).toBe(option.long);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
it("should create add-device command", async () => {
|
|
57
|
+
const pg = await makeProgram();
|
|
58
|
+
const command = pg.commands[1];
|
|
59
|
+
expect(command.name()).toBe("add-device");
|
|
60
|
+
expect(command.options.length).toBe(0);
|
|
61
|
+
const hooks = (command as CommandWithHooks)._lifeCycleHooks;
|
|
62
|
+
expect(hooks.preAction).toBeDefined();
|
|
63
|
+
expect(hooks.preAction.length).toBe(1);
|
|
64
|
+
expect(hooks.preAction[0].name).toBe("authHook");
|
|
65
|
+
});
|
|
66
|
+
it("should create add-menu command", async () => {
|
|
67
|
+
const pg = await makeProgram();
|
|
68
|
+
const command = pg.commands[2];
|
|
69
|
+
|
|
70
|
+
expect(command.name()).toBe("add-menu");
|
|
71
|
+
expect(command.registeredArguments[0].name()).toBe("name");
|
|
72
|
+
expect(command.options.length).toBe(5);
|
|
73
|
+
|
|
74
|
+
const expectedOptions = [
|
|
75
|
+
{ short: "--cm", long: "--custom" },
|
|
76
|
+
{ short: "-i", long: "--itemView" },
|
|
77
|
+
{ short: "-m", long: "--itemMargin" },
|
|
78
|
+
{ short: "-d", long: "--direction" },
|
|
79
|
+
{ short: "-p", long: "--path" },
|
|
80
|
+
];
|
|
81
|
+
expectedOptions.forEach((option, index) => {
|
|
82
|
+
expect(command.options[index].short).toBe(option.short);
|
|
83
|
+
expect(command.options[index].long).toBe(option.long);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
it("should create auth command with subcommands", async () => {
|
|
87
|
+
const pg = await makeProgram();
|
|
88
|
+
const command = pg.commands[3];
|
|
89
|
+
expect(command.name()).toBe("auth");
|
|
90
|
+
|
|
91
|
+
const subcommands = command.commands;
|
|
92
|
+
expect(subcommands.length).toBe(4);
|
|
93
|
+
|
|
94
|
+
const loginComd = subcommands[0];
|
|
95
|
+
|
|
96
|
+
expect(loginComd.name()).toBe("login");
|
|
97
|
+
const expectedOptions = [{ short: "-o", long: "--org" }];
|
|
98
|
+
expectedOptions.forEach((option, index) => {
|
|
99
|
+
expect(loginComd.options[index].short).toBe(option.short);
|
|
100
|
+
expect(loginComd.options[index].long).toBe(option.long);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const logoutCommand = subcommands[1];
|
|
104
|
+
expect(logoutCommand.name()).toBe("logout");
|
|
105
|
+
const expectedLogoutOptions = [{ short: "-o", long: "--org" }];
|
|
106
|
+
expectedLogoutOptions.forEach((option, index) => {
|
|
107
|
+
expect(logoutCommand.options[index].short).toBe(option.short);
|
|
108
|
+
expect(logoutCommand.options[index].long).toBe(option.long);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const authCommand = subcommands[2];
|
|
112
|
+
expect(authCommand.name()).toBe("status");
|
|
113
|
+
|
|
114
|
+
const getPackagesTokenCommand = subcommands[3];
|
|
115
|
+
expect(getPackagesTokenCommand.name()).toBe("get-packages-token");
|
|
116
|
+
const expectedGetPackagesTokenOptions = [
|
|
117
|
+
{ short: "-t", long: "--target", mandatory: true, choices: ["android"] },
|
|
118
|
+
{ short: "-o", long: "--org" },
|
|
119
|
+
];
|
|
120
|
+
expectedGetPackagesTokenOptions.forEach((option, index) => {
|
|
121
|
+
expect(getPackagesTokenCommand.options[index].short).toBe(option.short);
|
|
122
|
+
expect(getPackagesTokenCommand.options[index].long).toBe(option.long);
|
|
123
|
+
expect(getPackagesTokenCommand.options[index].mandatory).toBe(option.mandatory ?? false);
|
|
124
|
+
expect(getPackagesTokenCommand.options[index].argChoices).toStrictEqual(option.choices);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
it("should create add-scrollView command", async () => {
|
|
128
|
+
const pg = await makeProgram();
|
|
129
|
+
const command = pg.commands[4];
|
|
130
|
+
|
|
131
|
+
expect(command.name()).toBe("add-scrollView");
|
|
132
|
+
expect(command.registeredArguments[0].name()).toBe("name");
|
|
133
|
+
expect(command.options.length).toBe(4);
|
|
134
|
+
|
|
135
|
+
const expectedOptions = [
|
|
136
|
+
{ short: "--cm", long: "--custom" },
|
|
137
|
+
{ short: "-i", long: "--itemView" },
|
|
138
|
+
{ short: "-m", long: "--itemMargin" },
|
|
139
|
+
{ short: "-p", long: "--path" },
|
|
140
|
+
];
|
|
141
|
+
expectedOptions.forEach((option, index) => {
|
|
142
|
+
expect(command.options[index].short).toBe(option.short);
|
|
143
|
+
expect(command.options[index].long).toBe(option.long);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
it("should create add-screen command", async () => {
|
|
147
|
+
const pg = await makeProgram();
|
|
148
|
+
const command = pg.commands[5];
|
|
149
|
+
|
|
150
|
+
expect(command.name()).toBe("add-screen");
|
|
151
|
+
expect(command.registeredArguments[0].name()).toBe("name");
|
|
152
|
+
expect(command.options.length).toBe(2);
|
|
153
|
+
|
|
154
|
+
const expectedOptions = [
|
|
155
|
+
{ short: "-s", long: "--screenType" },
|
|
156
|
+
{ short: "-p", long: "--path" },
|
|
157
|
+
];
|
|
158
|
+
expectedOptions.forEach((option, index) => {
|
|
159
|
+
expect(command.options[index].short).toBe(option.short);
|
|
160
|
+
expect(command.options[index].long).toBe(option.long);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
it("should create create-app command", async () => {
|
|
164
|
+
const pg = await makeProgram();
|
|
165
|
+
const command = pg.commands[6];
|
|
166
|
+
|
|
167
|
+
expect(command.name()).toBe("create-app");
|
|
168
|
+
expect(command.registeredArguments[0].name()).toBe("projectName");
|
|
169
|
+
const expectedOptions = [
|
|
170
|
+
{ short: "-t", long: "--type" },
|
|
171
|
+
{ short: "-d", long: "--devices" },
|
|
172
|
+
{ short: undefined, long: "--beta" },
|
|
173
|
+
{ short: undefined, long: "--no-skills" },
|
|
174
|
+
];
|
|
175
|
+
expectedOptions.forEach((option, index) => {
|
|
176
|
+
expect(command.options[index].short).toBe(option.short);
|
|
177
|
+
expect(command.options[index].long).toBe(option.long);
|
|
178
|
+
});
|
|
179
|
+
expect(command.options.length).toBe(4);
|
|
180
|
+
});
|
|
181
|
+
it("should create install completion command", async () => {
|
|
182
|
+
const pg = await makeProgram();
|
|
183
|
+
const command = pg.commands[7];
|
|
184
|
+
|
|
185
|
+
expect(command.name()).toBe("completion");
|
|
186
|
+
expect(command.registeredArguments[0].name()).toBe("shell");
|
|
187
|
+
});
|
|
188
|
+
it("should create zip-code command", async () => {
|
|
189
|
+
const pg = await makeProgram();
|
|
190
|
+
const command = pg.commands[8];
|
|
191
|
+
|
|
192
|
+
expect(command.name()).toBe("zip-code");
|
|
193
|
+
});
|
|
194
|
+
it("should create add-module command", async () => {
|
|
195
|
+
const pg = await makeProgram();
|
|
196
|
+
const command = pg.commands[9];
|
|
197
|
+
|
|
198
|
+
expect(command.name()).toBe("add-module");
|
|
199
|
+
expect(command.registeredArguments[0].name()).toBe("name");
|
|
200
|
+
expect(command.registeredArguments[0].argChoices!.length).toBe(Object.keys(ModuleType).length);
|
|
201
|
+
});
|
|
202
|
+
it("should create add-skills command", async () => {
|
|
203
|
+
const pg = await makeProgram();
|
|
204
|
+
const command = pg.commands[10];
|
|
205
|
+
|
|
206
|
+
expect(command.name()).toBe("add-skills");
|
|
207
|
+
});
|
|
208
|
+
it("should add preSubcommand hooks to dana-cli", async () => {
|
|
209
|
+
const command = await makeProgram();
|
|
210
|
+
const hooks = (command as CommandWithHooks)._lifeCycleHooks;
|
|
211
|
+
|
|
212
|
+
expect(hooks.preSubcommand).toBeDefined();
|
|
213
|
+
expect(hooks.preSubcommand.length).toBe(1);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "./dist",
|
|
4
|
+
"rootDir": "./src",
|
|
5
|
+
"module": "NodeNext",
|
|
6
|
+
"moduleResolution": "NodeNext",
|
|
7
|
+
"types": ["vitest/globals"],
|
|
8
|
+
"strictNullChecks": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"baseUrl": ".",
|
|
13
|
+
"paths": {
|
|
14
|
+
"@/*": ["src/*"]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"include": ["src/**/*", "src/**/*.json", "tests/**/*"],
|
|
18
|
+
"exclude": ["node_modules", "dist"]
|
|
19
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* jshint node: true */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
module.exports = function (grunt) {
|
|
5
|
+
|
|
6
|
+
// Load tasks
|
|
7
|
+
grunt.loadNpmTasks('@dana/tools-grunt');
|
|
8
|
+
|
|
9
|
+
// Define project config
|
|
10
|
+
grunt.config.merge({
|
|
11
|
+
"global": {
|
|
12
|
+
"options": {
|
|
13
|
+
"appName": "My App"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
grunt.registerTask("_dev", function () {
|
|
19
|
+
// Get tasks
|
|
20
|
+
var tasks = this.options().tasks;
|
|
21
|
+
// Run tasks
|
|
22
|
+
grunt.task.run(tasks);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
grunt.registerTask("_package", function () {
|
|
26
|
+
// Get tasks
|
|
27
|
+
var tasks = this.options().tasks;
|
|
28
|
+
// Run tasks
|
|
29
|
+
grunt.task.run(tasks);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
Start the server:
|
|
4
|
+
|
|
5
|
+
npm start
|
|
6
|
+
|
|
7
|
+
It should open a browser on `localhost:9000`.
|
|
8
|
+
|
|
9
|
+
The server watch your sources files, so you don't need to restart it when a file has changed; simply hit the refresh button of your browser.
|
|
10
|
+
|
|
11
|
+
### Autocompletion
|
|
12
|
+
|
|
13
|
+
Dana provides autocompletion script for bash and zsh:
|
|
14
|
+
|
|
15
|
+
npx @wiztivi/dana-cli completion <bash|zsh>
|
|
16
|
+
|
|
17
|
+
**For more information, read the [Dana documentation](https://doc.dana-framework.com/)**
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"includes": [],
|
|
3
|
+
"default": {
|
|
4
|
+
"autoRun": false,
|
|
5
|
+
"resolution": {
|
|
6
|
+
"name": "fullHd",
|
|
7
|
+
"width": 1920,
|
|
8
|
+
"height": 1080
|
|
9
|
+
},
|
|
10
|
+
"Logger": {
|
|
11
|
+
"ConsoleAppender": {
|
|
12
|
+
"level": "info"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"locales": [
|
|
16
|
+
"en-US"
|
|
17
|
+
],
|
|
18
|
+
"AppTheme": {
|
|
19
|
+
"fonts": {
|
|
20
|
+
"RobotoRegular": {
|
|
21
|
+
"family": "Roboto",
|
|
22
|
+
"path": "styles/fonts/Roboto-Regular.ttf"
|
|
23
|
+
},
|
|
24
|
+
"RobotoBold": {
|
|
25
|
+
"family": "Roboto",
|
|
26
|
+
"path": "styles/fonts/Roboto-Bold.ttf",
|
|
27
|
+
"weight": 700
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"defaultFont": "RobotoRegular"
|
|
31
|
+
},
|
|
32
|
+
"firstRoute": {
|
|
33
|
+
"id": "splash"
|
|
34
|
+
},
|
|
35
|
+
"base": {
|
|
36
|
+
"modules": []
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"testCucumber": {
|
|
40
|
+
"mixins": [
|
|
41
|
+
"default"
|
|
42
|
+
],
|
|
43
|
+
"base": {
|
|
44
|
+
"name": "Cucumber",
|
|
45
|
+
"vendors": [
|
|
46
|
+
"@dana/engine-nodejs",
|
|
47
|
+
"@dana/vendor-test"
|
|
48
|
+
],
|
|
49
|
+
"implementations": {
|
|
50
|
+
"Animation": "JsonAnimation",
|
|
51
|
+
"KeyEventAdapter": "NodeJsTestKeyEventAdapter"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"isTest": true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# http://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
indent_style = space
|
|
6
|
+
indent_size = 4
|
|
7
|
+
end_of_line = lf
|
|
8
|
+
charset = utf-8
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
insert_final_newline = true
|
|
11
|
+
|
|
12
|
+
[*.md]
|
|
13
|
+
trim_trailing_whitespace = false
|
|
14
|
+
|
|
15
|
+
[*.js]
|
|
16
|
+
ij_javascript_method_call_chain_wrap = normal
|
|
17
|
+
ij_javascript_object_literal_wrap = normal
|
|
18
|
+
ij_javascript_var_declaration_wrap = split_into_lines
|