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,142 @@
|
|
|
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
|
+
import { writeFile, readFile } from "node:fs/promises";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
import DeviceConfig from "./deviceConfig.js";
|
|
15
|
+
import ComponentHelper from "@/commands/addComponent/helper/ComponentHelper.js";
|
|
16
|
+
import * as prompts from "@clack/prompts";
|
|
17
|
+
import colors from "picocolors";
|
|
18
|
+
import { clean } from "semver-ts";
|
|
19
|
+
import { validAppId, validAppVersion, validAppVersionCode, validInputLength } from "@/common/helpers/InputValidator.js";
|
|
20
|
+
import { PackageFormat } from "@aws-sdk/client-codeartifact";
|
|
21
|
+
import { AndroidConfig } from "./configTypes.js";
|
|
22
|
+
import addDeviceHelper from "@/commands/addDevice/helper/addDeviceHelper.js";
|
|
23
|
+
|
|
24
|
+
interface ProfileJson {
|
|
25
|
+
"base-android": {
|
|
26
|
+
device: object;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const AndroidtvConfig = class extends DeviceConfig {
|
|
31
|
+
/**
|
|
32
|
+
* Ask the appId
|
|
33
|
+
*/
|
|
34
|
+
static readonly _askAppId = async (): Promise<string> => {
|
|
35
|
+
const appId = (await prompts.text({
|
|
36
|
+
message: "What is the appId ?",
|
|
37
|
+
placeholder: "com.yourname.ui",
|
|
38
|
+
validate: (value) => validAppId(value),
|
|
39
|
+
})) as string;
|
|
40
|
+
ComponentHelper.handleCancellation(appId);
|
|
41
|
+
return appId;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Ask the appName
|
|
46
|
+
*/
|
|
47
|
+
static readonly _askAppName = async (): Promise<string> => {
|
|
48
|
+
const errorMessage = "App name is required !";
|
|
49
|
+
const appName = (await prompts.text({
|
|
50
|
+
message: "What is the appName ?",
|
|
51
|
+
placeholder: "Dana",
|
|
52
|
+
validate: (value) => validInputLength(errorMessage, value),
|
|
53
|
+
})) as string;
|
|
54
|
+
ComponentHelper.handleCancellation(appName);
|
|
55
|
+
return appName;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Ask the appVersion
|
|
60
|
+
*/
|
|
61
|
+
static readonly _askAppVersion = async (): Promise<string> => {
|
|
62
|
+
const appVersion = (await prompts.text({
|
|
63
|
+
message: "What is the app version ?",
|
|
64
|
+
placeholder: "1.0.0",
|
|
65
|
+
initialValue: "1.0.0",
|
|
66
|
+
validate: (value) => validAppVersion(value!),
|
|
67
|
+
})) as string;
|
|
68
|
+
ComponentHelper.handleCancellation(appVersion);
|
|
69
|
+
return clean(appVersion) ?? "";
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Ask the appVersion code
|
|
74
|
+
*/
|
|
75
|
+
static readonly _askAppVersionCode = async (): Promise<number> => {
|
|
76
|
+
const appVersionCode = (await prompts.text({
|
|
77
|
+
message: "What is the app version code ?",
|
|
78
|
+
placeholder: "1000",
|
|
79
|
+
initialValue: "1000",
|
|
80
|
+
validate: (value) => validAppVersionCode(value!),
|
|
81
|
+
})) as string;
|
|
82
|
+
ComponentHelper.handleCancellation(appVersionCode);
|
|
83
|
+
return Number(appVersionCode);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Call aws to get latest android version
|
|
88
|
+
*/
|
|
89
|
+
static readonly _getWtvAndroidVersion = async (): Promise<string> => {
|
|
90
|
+
const requestParams = {
|
|
91
|
+
packageName: "v8-runtime",
|
|
92
|
+
repository: "internal-android-repository",
|
|
93
|
+
format: "maven" as PackageFormat,
|
|
94
|
+
namespace: "com.dana.androidtv",
|
|
95
|
+
};
|
|
96
|
+
return await addDeviceHelper.getLatestPackageVersion(requestParams);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
static override readonly getConfig = async (): Promise<AndroidConfig> => {
|
|
100
|
+
prompts.log.info(colors.bold("Let's configure Android !"));
|
|
101
|
+
const config = {
|
|
102
|
+
device: await prompts.group(
|
|
103
|
+
{
|
|
104
|
+
appId: () => this._askAppId(),
|
|
105
|
+
appName: () => this._askAppName(),
|
|
106
|
+
appVersion: () => this._askAppVersion(),
|
|
107
|
+
appVersionCode: () => this._askAppVersionCode(),
|
|
108
|
+
icon: () => addDeviceHelper.getAppIcon(),
|
|
109
|
+
wtvAndroidtvVersion: () => this._getWtvAndroidVersion(),
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
onCancel: () => {
|
|
113
|
+
prompts.cancel("Android configuration cancelled.");
|
|
114
|
+
process.exit(0);
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
),
|
|
118
|
+
};
|
|
119
|
+
return config;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
static readonly setConfig = async ({
|
|
123
|
+
directory,
|
|
124
|
+
config,
|
|
125
|
+
}: {
|
|
126
|
+
directory: string;
|
|
127
|
+
config: AndroidConfig;
|
|
128
|
+
}): Promise<string> => {
|
|
129
|
+
await this.updateProfileJson(directory, config);
|
|
130
|
+
return "Android config done";
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
static readonly updateProfileJson = async (directory: string, config: AndroidConfig): Promise<string> => {
|
|
134
|
+
const filePath = path.join(directory, "profiles", "app.config.androidtv.json");
|
|
135
|
+
const data = (await readFile(filePath)).toString();
|
|
136
|
+
const jsonData = JSON.parse(data) as ProfileJson;
|
|
137
|
+
jsonData["base-android"].device = { ...jsonData["base-android"].device, ...config.device };
|
|
138
|
+
await writeFile(filePath, JSON.stringify(jsonData, null, 4));
|
|
139
|
+
return "Profile.json updated";
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
export default AndroidtvConfig;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
export interface AndroidDevice {
|
|
14
|
+
appId: string;
|
|
15
|
+
appName: string;
|
|
16
|
+
appVersion: string;
|
|
17
|
+
appVersionCode: number;
|
|
18
|
+
icon: string;
|
|
19
|
+
wtvAndroidtvVersion: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface AndroidConfig {
|
|
23
|
+
device: AndroidDevice;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface TizenConf {
|
|
27
|
+
renderers: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface WebosConf {
|
|
31
|
+
renderers: string[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface TvosConf {
|
|
35
|
+
jscVersion: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface VidaaConf {
|
|
39
|
+
renderers: string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface TitanosConf {
|
|
43
|
+
renderers: string[];
|
|
44
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* A generic class for device configuration
|
|
15
|
+
*/
|
|
16
|
+
const DeviceConfig = class {
|
|
17
|
+
static readonly appConfig = {};
|
|
18
|
+
|
|
19
|
+
static getConfig(..._: string[]) {
|
|
20
|
+
return Promise.resolve({} as unknown);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static setConfig(..._: unknown[]): Promise<string> {
|
|
24
|
+
return Promise.resolve("Device configuration done");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Add renderers configuration to json
|
|
29
|
+
*/
|
|
30
|
+
static updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object {
|
|
31
|
+
for (const renderer of renderers) {
|
|
32
|
+
jsonData = { ...jsonData, ...(this.appConfig[renderer] as Record<string, string>) };
|
|
33
|
+
}
|
|
34
|
+
return jsonData;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default DeviceConfig;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import DeviceConfig from "./deviceConfig.js";
|
|
2
|
+
import { TitanosConf } from "./configTypes.js";
|
|
3
|
+
import { LIGHTNING, CSS } from "@/common/const/deviceConst.js";
|
|
4
|
+
|
|
5
|
+
const TitanosConfig = class extends DeviceConfig {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
7
|
+
static readonly getConfig = async (): Promise<TitanosConf> => {
|
|
8
|
+
return {
|
|
9
|
+
renderers: [LIGHTNING, CSS],
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
static readonly setConfig = (): Promise<string> => {
|
|
14
|
+
return Promise.resolve("TitanOS configuration done");
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default TitanosConfig;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 { writeFile, readFile } from "node:fs/promises";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import DeviceConfig from "./deviceConfig.js";
|
|
16
|
+
import { LIGHTNING } from "@/common/const/deviceConst.js";
|
|
17
|
+
import { TizenConf } from "./configTypes.js";
|
|
18
|
+
|
|
19
|
+
const TizenConfig = class extends DeviceConfig {
|
|
20
|
+
static readonly appConfig = {
|
|
21
|
+
css: {
|
|
22
|
+
"template-tizen_css": {
|
|
23
|
+
mixins: ["default", "tizen"],
|
|
24
|
+
base: {
|
|
25
|
+
name: "Tizen",
|
|
26
|
+
vendors: ["@dana/renderer-css"],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
lightning: {
|
|
31
|
+
"template-tizen_lightning": {
|
|
32
|
+
mixins: ["default", "tizen"],
|
|
33
|
+
base: {
|
|
34
|
+
name: "Tizen",
|
|
35
|
+
vendors: ["@dana/renderer-lightning-html5"],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
42
|
+
static readonly getConfig = async (): Promise<TizenConf> => {
|
|
43
|
+
return {
|
|
44
|
+
renderers: [LIGHTNING],
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
static readonly setConfig = async ({
|
|
49
|
+
directory,
|
|
50
|
+
config,
|
|
51
|
+
}: {
|
|
52
|
+
directory: string;
|
|
53
|
+
config: TizenConf;
|
|
54
|
+
}): Promise<string> => {
|
|
55
|
+
const filePath = path.join(directory, "profiles", "app.config.tizen.json");
|
|
56
|
+
const data = (await readFile(filePath)).toString();
|
|
57
|
+
let jsonData = JSON.parse(data) as Record<string, unknown>;
|
|
58
|
+
jsonData = this.updateProfileJsonWithRenderers(jsonData, config.renderers) as Record<string, unknown>;
|
|
59
|
+
|
|
60
|
+
await writeFile(filePath, JSON.stringify(jsonData, null, 4));
|
|
61
|
+
return "Tizen configuration done";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export default TizenConfig;
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
import { writeFile, readFile } from "node:fs/promises";
|
|
13
|
+
import DeviceConfig from "./deviceConfig.js";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import { PackageFormat } from "@aws-sdk/client-codeartifact";
|
|
16
|
+
import { TvosConf } from "./configTypes.js";
|
|
17
|
+
import addDeviceHelper from "@/commands/addDevice/helper/addDeviceHelper.js";
|
|
18
|
+
|
|
19
|
+
const TvosConfig = class extends DeviceConfig {
|
|
20
|
+
static readonly GITIGNORE_PATH = ".gitignore";
|
|
21
|
+
/**
|
|
22
|
+
* Set config for TVOS
|
|
23
|
+
*/
|
|
24
|
+
static readonly setConfig = async ({ directory }: { directory: string }): Promise<string> => {
|
|
25
|
+
const update = `\n# For TVOS\napp_tvos/build \napp_tvos/libs`;
|
|
26
|
+
const filePath = path.join(directory, TvosConfig.GITIGNORE_PATH);
|
|
27
|
+
const data = await readFile(filePath, { encoding: "utf8" });
|
|
28
|
+
await writeFile(filePath, data + update);
|
|
29
|
+
return ".gitignore updated";
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
static override readonly getConfig = async (): Promise<TvosConf> => {
|
|
33
|
+
return {
|
|
34
|
+
jscVersion: await TvosConfig.getJscVersion(),
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Call aws to get latest jsc version
|
|
39
|
+
*/
|
|
40
|
+
static readonly getJscVersion = async (): Promise<string> => {
|
|
41
|
+
const requestParams = {
|
|
42
|
+
packageName: "jscmodule",
|
|
43
|
+
repository: "internal-apple-repository",
|
|
44
|
+
format: "swift" as PackageFormat,
|
|
45
|
+
namespace: "dana",
|
|
46
|
+
};
|
|
47
|
+
return await addDeviceHelper.getLatestPackageVersion(requestParams);
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export default TvosConfig;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import DeviceConfig from "./deviceConfig.js";
|
|
2
|
+
import { VidaaConf } from "./configTypes.js";
|
|
3
|
+
import { LIGHTNING, CSS } from "@/common/const/deviceConst.js";
|
|
4
|
+
|
|
5
|
+
const VidaaConfig = class extends DeviceConfig {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
7
|
+
static readonly getConfig = async (): Promise<VidaaConf> => {
|
|
8
|
+
return {
|
|
9
|
+
renderers: [LIGHTNING, CSS],
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
static readonly setConfig = (): Promise<string> => {
|
|
14
|
+
return Promise.resolve("Vidaa configuration done");
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default VidaaConfig;
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
import { writeFile, readFile } from "node:fs/promises";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
import DeviceConfig from "./deviceConfig.js";
|
|
15
|
+
import { WebosConf } from "./configTypes.js";
|
|
16
|
+
import { CSS } from "@/common/const/deviceConst.js";
|
|
17
|
+
|
|
18
|
+
interface WebosJsonData {
|
|
19
|
+
webos?: { device: object };
|
|
20
|
+
}
|
|
21
|
+
const WebosConfig = class extends DeviceConfig {
|
|
22
|
+
static readonly appConfig = {
|
|
23
|
+
css: {
|
|
24
|
+
"template-webos_css": {
|
|
25
|
+
mixins: ["default", "webos"],
|
|
26
|
+
base: {
|
|
27
|
+
name: "Webos",
|
|
28
|
+
vendors: ["@dana/vendor-components", "@dana/vendor-shaka", "@dana/vendor-webos-css"],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
lightning: {
|
|
33
|
+
"template-webos_lightning": {
|
|
34
|
+
mixins: ["default", "webos"],
|
|
35
|
+
base: {
|
|
36
|
+
name: "Webos",
|
|
37
|
+
vendors: ["@dana/vendor-components", "@dana/vendor-shaka", "@dana/vendor-webos-lightning"],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
43
|
+
static readonly getConfig = async (): Promise<WebosConf> => {
|
|
44
|
+
return {
|
|
45
|
+
renderers: [CSS],
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
static readonly setConfig = async ({
|
|
50
|
+
directory,
|
|
51
|
+
config,
|
|
52
|
+
}: {
|
|
53
|
+
directory: string;
|
|
54
|
+
config: WebosConf;
|
|
55
|
+
}): Promise<string> => {
|
|
56
|
+
const filePath: string = path.join(directory, "profiles", "app.config.webos.json");
|
|
57
|
+
const data: string = (await readFile(filePath)).toString();
|
|
58
|
+
let jsonData = JSON.parse(data) as WebosJsonData;
|
|
59
|
+
jsonData = this.updateProfileJsonWithRenderers(jsonData as Record<string, unknown>, config.renderers);
|
|
60
|
+
await writeFile(filePath, JSON.stringify(jsonData, null, 4));
|
|
61
|
+
return "Webos configuration done";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export default WebosConfig;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import * as prompts from "@clack/prompts";
|
|
5
|
+
import { DEFAULT_IMAGE_URL } from "@/commands/createApp/const/setupConst.js";
|
|
6
|
+
import ComponentHelper from "@/commands/addComponent/helper/ComponentHelper.js";
|
|
7
|
+
import { CredentialsHelper } from "@/commands/authentication/helper/CredentialsHelper.js";
|
|
8
|
+
import { createCodeArtifactClient } from "@/commands/authentication/helper/CodeArtifactHelper.js";
|
|
9
|
+
import { ListPackageVersionsCommand, PackageFormat } from "@aws-sdk/client-codeartifact";
|
|
10
|
+
import { DOMAIN, DOMAIN_OWNER } from "@/commands/authentication/authentConst.js";
|
|
11
|
+
import translation from "@/common/translation/translation.js";
|
|
12
|
+
import { maxSatisfying } from "semver";
|
|
13
|
+
|
|
14
|
+
interface PackageJson {
|
|
15
|
+
name: string;
|
|
16
|
+
scripts: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface PromptFactoryParams {
|
|
20
|
+
errorMessage?: string;
|
|
21
|
+
promptMessage: string;
|
|
22
|
+
validationFunction: (value: string, errorMessage?: string) => string | undefined;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
initialValue?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const AddDeviceHelper = class {
|
|
28
|
+
/**
|
|
29
|
+
* clean on error
|
|
30
|
+
*/
|
|
31
|
+
static readonly cleanOnError = () => {
|
|
32
|
+
try {
|
|
33
|
+
execSync(`git clean -d -f && git reset --hard head`);
|
|
34
|
+
} catch {
|
|
35
|
+
throw new Error("Files deletion failed. Delete changes manually.");
|
|
36
|
+
}
|
|
37
|
+
return "Changes successfully deleted.";
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get installed devices from script list in package.json
|
|
42
|
+
* We use script so we can get renderers for smartTv
|
|
43
|
+
*/
|
|
44
|
+
static readonly getInstalledDevices = async (directory: string): Promise<string[]> => {
|
|
45
|
+
const filepath: string = path.join(directory, "package.json");
|
|
46
|
+
const rawData = (await readFile(filepath)).toString();
|
|
47
|
+
const jsonData = JSON.parse(rawData) as PackageJson;
|
|
48
|
+
const installedDevices: string[] = [];
|
|
49
|
+
|
|
50
|
+
for (const t of Object.keys(jsonData.scripts)) {
|
|
51
|
+
if (t.includes("start:")) {
|
|
52
|
+
const device = t.split(":")[1];
|
|
53
|
+
installedDevices.push(device);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return installedDevices;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get the app icon url
|
|
61
|
+
*/
|
|
62
|
+
static readonly getAppIcon = (): Promise<string> => {
|
|
63
|
+
return Promise.resolve(DEFAULT_IMAGE_URL);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
static readonly promptTextFactory = async ({
|
|
67
|
+
errorMessage,
|
|
68
|
+
promptMessage,
|
|
69
|
+
validationFunction,
|
|
70
|
+
placeholder,
|
|
71
|
+
initialValue,
|
|
72
|
+
}: PromptFactoryParams): Promise<string> => {
|
|
73
|
+
const result = (await prompts.text({
|
|
74
|
+
message: promptMessage,
|
|
75
|
+
placeholder,
|
|
76
|
+
initialValue,
|
|
77
|
+
validate: (value) => validationFunction(value!, errorMessage),
|
|
78
|
+
})) as string;
|
|
79
|
+
ComponentHelper.handleCancellation(result);
|
|
80
|
+
return result;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
static readonly getLatestPackageVersion = async ({
|
|
84
|
+
packageName,
|
|
85
|
+
repository,
|
|
86
|
+
format,
|
|
87
|
+
namespace,
|
|
88
|
+
}: {
|
|
89
|
+
packageName: string;
|
|
90
|
+
repository: string;
|
|
91
|
+
format: PackageFormat;
|
|
92
|
+
namespace: string;
|
|
93
|
+
}) => {
|
|
94
|
+
let packageVersion: string;
|
|
95
|
+
try {
|
|
96
|
+
const credentials = await CredentialsHelper.get();
|
|
97
|
+
const client = createCodeArtifactClient(credentials.aws!);
|
|
98
|
+
const command = new ListPackageVersionsCommand({
|
|
99
|
+
package: packageName,
|
|
100
|
+
domain: DOMAIN,
|
|
101
|
+
domainOwner: DOMAIN_OWNER,
|
|
102
|
+
repository,
|
|
103
|
+
format,
|
|
104
|
+
namespace,
|
|
105
|
+
});
|
|
106
|
+
const response = await client.send(command);
|
|
107
|
+
const versionListArray = response.versions?.map((v) => v.version).filter(Boolean) as string[];
|
|
108
|
+
// need to use semver-ts to avoid this error
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment
|
|
110
|
+
packageVersion = maxSatisfying(versionListArray, "*");
|
|
111
|
+
if (packageVersion) {
|
|
112
|
+
return packageVersion;
|
|
113
|
+
} else {
|
|
114
|
+
throw new Error(translation["command.device.version.error"]);
|
|
115
|
+
}
|
|
116
|
+
} catch (error: unknown) {
|
|
117
|
+
throw new Error((error as Error).message ?? translation["error.common.start.message"]);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
export default AddDeviceHelper;
|
|
@@ -0,0 +1,55 @@
|
|
|
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 * as prompts from "@clack/prompts";
|
|
14
|
+
import colors from "picocolors";
|
|
15
|
+
import process from "node:process";
|
|
16
|
+
import translation from "@/common/translation/translation.js";
|
|
17
|
+
import InstallHelper from "@/common/helpers/InstallHelper.js";
|
|
18
|
+
import CreateAppHelper from "@/commands/createApp/helpers/CreateAppHelper.js";
|
|
19
|
+
import { DIANA_DEP } from "@/commands/addDianaSkills/dianaDependencies.js";
|
|
20
|
+
import CreateFileHelper from "@/common/helpers/CreateFileHelper.js";
|
|
21
|
+
import { COMMAND_ERROR } from "@/common/const/exitCodeConst.js";
|
|
22
|
+
|
|
23
|
+
const addDianaSkills = async () => {
|
|
24
|
+
prompts.intro(`Add skills !`);
|
|
25
|
+
const spinner = prompts.spinner();
|
|
26
|
+
const data = {
|
|
27
|
+
directory: "./",
|
|
28
|
+
allowBeta: true,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
spinner.start(translation["task.installation.start"]);
|
|
33
|
+
await CreateAppHelper.installation(
|
|
34
|
+
[
|
|
35
|
+
{
|
|
36
|
+
title: "Install dependencies with npm",
|
|
37
|
+
task: async () => InstallHelper.installDependencies(data, DIANA_DEP),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: "Copy skills for ai agents",
|
|
41
|
+
task: async () => CreateFileHelper.copySkillsFiles(data),
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
spinner,
|
|
45
|
+
);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
const message = e instanceof Error ? e.message : (e as string);
|
|
48
|
+
spinner.stop(message);
|
|
49
|
+
prompts.outro(colors.red(`${translation["error.common.start.message"]} ${message}`));
|
|
50
|
+
process.exit(COMMAND_ERROR);
|
|
51
|
+
}
|
|
52
|
+
spinner.stop(translation["task.installation.end"]);
|
|
53
|
+
prompts.outro("Everything is ready ! Don't forget to commit your change.");
|
|
54
|
+
};
|
|
55
|
+
export default addDianaSkills;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import addDianaSkills from "./add-dianaSkills.js";
|
|
3
|
+
import translation from "@/common/translation/translation.js";
|
|
4
|
+
import { authHook } from "@/commands/authentication/authHook.js";
|
|
5
|
+
|
|
6
|
+
const addDianaSkillsDefinition = () => {
|
|
7
|
+
return new Command("add-skills")
|
|
8
|
+
.description(translation["command.ai.description"])
|
|
9
|
+
.hook("preAction", authHook)
|
|
10
|
+
.action(addDianaSkills);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default addDianaSkillsDefinition;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
// Pinned: the dana-verify structural gate depends on this ast-grep rule syntax. See wtv-diana
|
|
13
|
+
const AST_GREP_VERSION = "0.51.1";
|
|
14
|
+
|
|
15
|
+
export const DIANA_DEP = ["@playwright/cli", `@ast-grep/cli@${AST_GREP_VERSION}`, "@dana/ai-skills"];
|