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,156 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# Unified completion script for dana CLI
|
|
4
|
+
# Detects shell and loads appropriate completion
|
|
5
|
+
|
|
6
|
+
# Shared command list
|
|
7
|
+
dana_commands=(
|
|
8
|
+
'add-device'
|
|
9
|
+
'add-menu'
|
|
10
|
+
'add-rail'
|
|
11
|
+
'add-scrollView'
|
|
12
|
+
'add-screen'
|
|
13
|
+
'auth'
|
|
14
|
+
'create-app'
|
|
15
|
+
'package'
|
|
16
|
+
'add-module',
|
|
17
|
+
'zip-code
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Shared subcommand declarations
|
|
21
|
+
login_sub="login"
|
|
22
|
+
logout_sub="logout"
|
|
23
|
+
status_sub="status"
|
|
24
|
+
# Shared option declarations
|
|
25
|
+
direction_opts="-d --direction"
|
|
26
|
+
navigation_opts="-n --navigation"
|
|
27
|
+
cyclic_opts="-c --cyclic"
|
|
28
|
+
margin_opts="-m --itemMargin"
|
|
29
|
+
custom_opts="--cm --custom"
|
|
30
|
+
item_view_opts="-i --itemView"
|
|
31
|
+
org_opts="-o --org"
|
|
32
|
+
device_opts="-d --device"
|
|
33
|
+
tutorial_opts="-t, --tutorial"
|
|
34
|
+
|
|
35
|
+
# Shared option values
|
|
36
|
+
direction_values="h v"
|
|
37
|
+
navigation_values="fixed lmr lr paginated"
|
|
38
|
+
org_values="preprod"
|
|
39
|
+
# Detect shell and load appropriate completion
|
|
40
|
+
if [ -n "$BASH_VERSION" ]; then
|
|
41
|
+
# Bash completion
|
|
42
|
+
_dana()
|
|
43
|
+
{
|
|
44
|
+
local cur prev opts
|
|
45
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
46
|
+
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
47
|
+
# Complete option values
|
|
48
|
+
case "$prev" in
|
|
49
|
+
-d|--direction)
|
|
50
|
+
COMPREPLY=($(compgen -W "$direction_values" -- "$cur"))
|
|
51
|
+
return 0
|
|
52
|
+
;;
|
|
53
|
+
-n|--navigation)
|
|
54
|
+
COMPREPLY=($(compgen -W "$navigation_values" -- "$cur"))
|
|
55
|
+
return 0
|
|
56
|
+
;;
|
|
57
|
+
-o|--org)
|
|
58
|
+
COMPREPLY=($(compgen -W "$org_values" -- "$cur"))
|
|
59
|
+
return 0
|
|
60
|
+
;;
|
|
61
|
+
esac
|
|
62
|
+
# If we're completing the first argument (command)
|
|
63
|
+
if [[ $COMP_CWORD -eq 1 ]]; then
|
|
64
|
+
COMPREPLY=($(compgen -W "${dana_commands[*]}" -- "$cur"))
|
|
65
|
+
return 0
|
|
66
|
+
fi
|
|
67
|
+
# If we're completing options for specific commands
|
|
68
|
+
local cmd="${COMP_WORDS[1]}"
|
|
69
|
+
case "$cmd" in
|
|
70
|
+
add-rail)
|
|
71
|
+
opts="$navigation_opts $cyclic_opts $direction_opts $custom_opts $item_view_opts"
|
|
72
|
+
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
73
|
+
;;
|
|
74
|
+
add-menu)
|
|
75
|
+
opts="$direction_opts $margin_opts $custom_opts $item_view_opts"
|
|
76
|
+
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
77
|
+
;;
|
|
78
|
+
add-scrollView)
|
|
79
|
+
opts="$custom_opts $item_view_opts $margin_opts"
|
|
80
|
+
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
81
|
+
;;
|
|
82
|
+
auth)
|
|
83
|
+
if [[ $COMP_CWORD -eq 2 ]]; then
|
|
84
|
+
opts="$login_sub $logout_sub $status_sub"
|
|
85
|
+
else
|
|
86
|
+
opts="$org_opts"
|
|
87
|
+
fi
|
|
88
|
+
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
89
|
+
;;
|
|
90
|
+
create-app)
|
|
91
|
+
opts="$device_opts $tutorial_opts"
|
|
92
|
+
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
93
|
+
;;
|
|
94
|
+
*)
|
|
95
|
+
COMPREPLY=()
|
|
96
|
+
;;
|
|
97
|
+
esac
|
|
98
|
+
}
|
|
99
|
+
complete -F _dana dana
|
|
100
|
+
elif [ -n "$ZSH_VERSION" ]; then
|
|
101
|
+
# Zsh completion
|
|
102
|
+
_dana() {
|
|
103
|
+
# Main commands
|
|
104
|
+
if (( CURRENT == 2 )); then
|
|
105
|
+
local -a commands
|
|
106
|
+
commands=(${dana_commands[@]})
|
|
107
|
+
compadd -a commands
|
|
108
|
+
return
|
|
109
|
+
fi
|
|
110
|
+
# Complete option values
|
|
111
|
+
local prev=${words[CURRENT-1]}
|
|
112
|
+
case "$prev" in
|
|
113
|
+
-d|--direction)
|
|
114
|
+
compadd -- ${=direction_values}
|
|
115
|
+
return
|
|
116
|
+
;;
|
|
117
|
+
-n|--navigation)
|
|
118
|
+
compadd -- ${=navigation_values}
|
|
119
|
+
return
|
|
120
|
+
;;
|
|
121
|
+
-o|--org)
|
|
122
|
+
compadd -- ${=org_values}
|
|
123
|
+
return
|
|
124
|
+
;;
|
|
125
|
+
login|logout|status)
|
|
126
|
+
compadd -- ${=org_opts}
|
|
127
|
+
return
|
|
128
|
+
;;
|
|
129
|
+
esac
|
|
130
|
+
# Complete options for commands
|
|
131
|
+
local cmd=${words[2]}
|
|
132
|
+
case "$cmd" in
|
|
133
|
+
add-rail)
|
|
134
|
+
compadd -- ${=navigation_opts} ${=cyclic_opts} ${=direction_opts} ${=custom_opts} ${=item_view_opts}
|
|
135
|
+
;;
|
|
136
|
+
add-menu)
|
|
137
|
+
compadd -- ${=direction_opts} ${=margin_opts} ${=custom_opts} ${=item_view_opts}
|
|
138
|
+
;;
|
|
139
|
+
add-scrollView)
|
|
140
|
+
compadd -- ${=custom_opts} ${=item_view_opts} ${=margin_opts}
|
|
141
|
+
;;
|
|
142
|
+
auth)
|
|
143
|
+
if (( CURRENT == 3 )); then
|
|
144
|
+
compadd -- ${=login_sub} ${=logout_sub} ${=status_sub}
|
|
145
|
+
else
|
|
146
|
+
compadd -- ${=org_opts}
|
|
147
|
+
fi
|
|
148
|
+
;;
|
|
149
|
+
create-app)
|
|
150
|
+
compadd -- ${device_opts} $={tutorial_opts}
|
|
151
|
+
esac
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
# Register the completion
|
|
155
|
+
compdef _dana dana
|
|
156
|
+
fi
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import rootConfig from "../../eslint.config.mjs";
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
...rootConfig,
|
|
5
|
+
{
|
|
6
|
+
files: ["src/**/*.ts", "tests/**/*.ts"],
|
|
7
|
+
languageOptions: {
|
|
8
|
+
parserOptions: {
|
|
9
|
+
project: ["./tsconfig.test.json"],
|
|
10
|
+
tsconfigRootDir: import.meta.dirname,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wiztivi/dana-cli",
|
|
3
|
+
"version": "0.0.26",
|
|
4
|
+
"description": "Dana create app CLI",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": "./dist/bundle.min.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"dana": "bin/dana.js"
|
|
9
|
+
},
|
|
10
|
+
"engineStrict": true,
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=20.0.0"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"lint": "eslint src tests",
|
|
16
|
+
"test": "vitest",
|
|
17
|
+
"test:coverage": "vitest run --coverage",
|
|
18
|
+
"build": "npm run _clean:dist && npm run _rollup && npm run _add_files:dist",
|
|
19
|
+
"build:watch": "npm run _clean:dist && rollup -c --watch",
|
|
20
|
+
"ci": "npm run build && npm run lint && npm run test:coverage",
|
|
21
|
+
"_add_files:dist": "cpx ../../README.md .",
|
|
22
|
+
"_clean:dist": "rimraf ./dist tsconfig.tsbuildinfo",
|
|
23
|
+
"_rollup": "rollup -c"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"dana_completion.sh",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@aws-sdk/client-codeartifact": "3.1170.0",
|
|
32
|
+
"@babel/generator": "8.1.2",
|
|
33
|
+
"@babel/parser": "8.1.2",
|
|
34
|
+
"@babel/template": "8.1.2",
|
|
35
|
+
"@babel/traverse": "8.1.2",
|
|
36
|
+
"@babel/types": "8.1.2",
|
|
37
|
+
"@clack/prompts": "1.9.0",
|
|
38
|
+
"@types/adm-zip": "0.6.0",
|
|
39
|
+
"@wiztivi/dana-templates": "^0.0.26",
|
|
40
|
+
"adm-zip": "0.6.1",
|
|
41
|
+
"child_process": "1.0.x",
|
|
42
|
+
"command-exists": "1.2.9",
|
|
43
|
+
"commander": "15.1.x",
|
|
44
|
+
"express": "5.3.0",
|
|
45
|
+
"find-up": "8.0.0",
|
|
46
|
+
"get-port": "7.2.0",
|
|
47
|
+
"grunt-cli": "1.5.x",
|
|
48
|
+
"handlebars": "4.7.10",
|
|
49
|
+
"jsonwebtoken": "9.0.3",
|
|
50
|
+
"open": "11.0.4",
|
|
51
|
+
"picocolors": "1.1.x",
|
|
52
|
+
"semver": "7.8.6",
|
|
53
|
+
"semver-ts": "1.0.3"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@rollup/plugin-commonjs": "29.0.3",
|
|
57
|
+
"@rollup/plugin-json": "6.1.0",
|
|
58
|
+
"@rollup/plugin-node-resolve": "16.0.3",
|
|
59
|
+
"@rollup/plugin-terser": "1.0.2",
|
|
60
|
+
"@rollup/plugin-typescript": "12.3.1",
|
|
61
|
+
"@types/express": "5.0.6",
|
|
62
|
+
"@types/jsonwebtoken": "9.0.10",
|
|
63
|
+
"cpx": "1.5.0",
|
|
64
|
+
"rollup": "4.68.4",
|
|
65
|
+
"rollup-plugin-node-externals": "8.1.2"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import json from "@rollup/plugin-json";
|
|
2
|
+
import terser from "@rollup/plugin-terser";
|
|
3
|
+
import resolve from "@rollup/plugin-node-resolve";
|
|
4
|
+
import typescript from "@rollup/plugin-typescript";
|
|
5
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
6
|
+
import nodeExternals from "rollup-plugin-node-externals";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
input: "src/index.ts",
|
|
10
|
+
output: {
|
|
11
|
+
file: "dist/bundle.min.js",
|
|
12
|
+
format: "esm",
|
|
13
|
+
inlineDynamicImports: true,
|
|
14
|
+
},
|
|
15
|
+
plugins: [
|
|
16
|
+
resolve(),
|
|
17
|
+
commonjs(),
|
|
18
|
+
json(),
|
|
19
|
+
typescript({
|
|
20
|
+
tsconfig: "./tsconfig.json",
|
|
21
|
+
outputToFilesystem: false,
|
|
22
|
+
}),
|
|
23
|
+
terser(),
|
|
24
|
+
nodeExternals(),
|
|
25
|
+
],
|
|
26
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
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 { BUTTON_ITEM_VIEW } from "@/commands/addComponent/const/componentConst.js";
|
|
14
|
+
import { ConfigOptions } from "@/common/types/helperTypes.js";
|
|
15
|
+
import createComponent from "@/commands/addComponent/createComponent.js";
|
|
16
|
+
import process from "node:process";
|
|
17
|
+
import path from "node:path";
|
|
18
|
+
import { cp } from "node:fs/promises";
|
|
19
|
+
import { MenuConfig } from "@/commands/addComponent/config/componentTypes.js";
|
|
20
|
+
import ComponentConfig from "@/commands/addComponent/config/ComponentConfig.js";
|
|
21
|
+
import { MENU_DEFAULT_CONFIG } from "@/commands/addComponent/const/defaultConfig.js";
|
|
22
|
+
import ComponentHelper from "@/commands/addComponent/helper/ComponentHelper.js";
|
|
23
|
+
import UpdateFileHelper from "@/common/helpers/UpdateFileHelper.js";
|
|
24
|
+
import CreateFileHelper from "@/common/helpers/CreateFileHelper.js";
|
|
25
|
+
|
|
26
|
+
interface MenuOptions {
|
|
27
|
+
custom?: string;
|
|
28
|
+
itemView?: string;
|
|
29
|
+
itemMargin?: number;
|
|
30
|
+
path?: string;
|
|
31
|
+
}
|
|
32
|
+
const addMenu = async (name?: string, options?: MenuOptions) => {
|
|
33
|
+
const data = { ...options } as ConfigOptions;
|
|
34
|
+
if (name) {
|
|
35
|
+
data.name = name;
|
|
36
|
+
}
|
|
37
|
+
data.path = options?.path ?? process.cwd();
|
|
38
|
+
|
|
39
|
+
const menuConfig: MenuConfig = {
|
|
40
|
+
...data,
|
|
41
|
+
...(await ComponentConfig.menuConfig(data)),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const componentList: ConfigOptions[] = [menuConfig as unknown as ConfigOptions];
|
|
45
|
+
if (!data.custom) {
|
|
46
|
+
componentList.push({
|
|
47
|
+
type: BUTTON_ITEM_VIEW,
|
|
48
|
+
name: data.itemView ?? MENU_DEFAULT_CONFIG.itemView,
|
|
49
|
+
path: data.path,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
await createComponent(componentList);
|
|
53
|
+
if (!data.custom) {
|
|
54
|
+
const currentDirectory = process.cwd();
|
|
55
|
+
const modulePath = ComponentHelper.getTemplatePath();
|
|
56
|
+
const mockPath = path.join(path.dirname(modulePath), "mocks", "menuMock.json");
|
|
57
|
+
const mockFinalPath = path.resolve(data.path, "menuMock.json");
|
|
58
|
+
|
|
59
|
+
await cp(mockPath, mockFinalPath);
|
|
60
|
+
await CreateFileHelper.copyFontFile(currentDirectory);
|
|
61
|
+
await UpdateFileHelper.updateAppTheme({ directory: currentDirectory }, "MockIcons");
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default addMenu;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import addMenu from "@/commands/addComponent/addMenu/add-menu.js";
|
|
3
|
+
import translation from "@/common/translation/translation.js";
|
|
4
|
+
|
|
5
|
+
const addMenuDefinition = () => {
|
|
6
|
+
const command = new Command("add-menu");
|
|
7
|
+
|
|
8
|
+
command
|
|
9
|
+
.description(translation["command.menu.description"])
|
|
10
|
+
.argument("[name]", translation["command.component.name"])
|
|
11
|
+
.option("--cm, --custom", translation["command.component.customization"])
|
|
12
|
+
.option("-i, --itemView <itemView>", translation["command.menu.option.itemView"])
|
|
13
|
+
.option("-m, --itemMargin <itemMargin>", translation["command.menu.option.itemMargin"])
|
|
14
|
+
.option("-d, --direction <direction>", translation["command.rail.option.direction"])
|
|
15
|
+
.option("-p, --path <path>", translation["command.component.path"])
|
|
16
|
+
.action(addMenu);
|
|
17
|
+
|
|
18
|
+
return command;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default addMenuDefinition;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { ConfigOptions } from "@/common/types/helperTypes.js";
|
|
14
|
+
import { TILE_VIEW } from "@/commands/addComponent/const/componentConst.js";
|
|
15
|
+
import createComponent from "@/commands/addComponent/createComponent.js";
|
|
16
|
+
import process from "node:process";
|
|
17
|
+
import path from "node:path";
|
|
18
|
+
import { cp } from "node:fs/promises";
|
|
19
|
+
import { RailConfig } from "@/commands/addComponent/config/componentTypes.js";
|
|
20
|
+
import ComponentConfig from "@/commands/addComponent/config/ComponentConfig.js";
|
|
21
|
+
import { RAIL_DEFAULT_CONFIG } from "@/commands/addComponent/const/defaultConfig.js";
|
|
22
|
+
import ComponentHelper from "@/commands/addComponent/helper/ComponentHelper.js";
|
|
23
|
+
|
|
24
|
+
interface CommandOptions {
|
|
25
|
+
navigation?: string;
|
|
26
|
+
direction?: string;
|
|
27
|
+
cyclic?: boolean;
|
|
28
|
+
custom?: string;
|
|
29
|
+
type?: string;
|
|
30
|
+
itemView?: string;
|
|
31
|
+
path?: string;
|
|
32
|
+
}
|
|
33
|
+
const addRail = async (name?: string, options?: CommandOptions) => {
|
|
34
|
+
const data = { ...options } as ConfigOptions;
|
|
35
|
+
if (name) {
|
|
36
|
+
data.name = name;
|
|
37
|
+
}
|
|
38
|
+
data.path = options?.path ?? process.cwd();
|
|
39
|
+
|
|
40
|
+
const railConfig: RailConfig = {
|
|
41
|
+
...data,
|
|
42
|
+
...(await ComponentConfig.railConfig(data)),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const componentList: ConfigOptions[] = [railConfig as unknown as ConfigOptions];
|
|
46
|
+
if (!data.custom) {
|
|
47
|
+
componentList.push({ type: TILE_VIEW, name: data.itemView ?? RAIL_DEFAULT_CONFIG.itemView, path: data.path });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
await createComponent(componentList);
|
|
51
|
+
if (!data.custom) {
|
|
52
|
+
const modulePath = ComponentHelper.getTemplatePath();
|
|
53
|
+
const mockPath = path.join(path.dirname(modulePath), "mocks", "railMock.json");
|
|
54
|
+
const finalPath = path.resolve(data.path, "railMock.json");
|
|
55
|
+
await cp(mockPath, finalPath);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default addRail;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import addRail from "./add-rail.js";
|
|
3
|
+
import { NAVIGATION_TYPES, DIRECTION_TYPES } from "@/commands/addComponent/const/navigationConst.js";
|
|
4
|
+
import translation from "@/common/translation/translation.js";
|
|
5
|
+
import { optionsListString } from "@/common/helpers/stringHelper.js";
|
|
6
|
+
|
|
7
|
+
const addRailDefinition = () => {
|
|
8
|
+
const command = new Command("add-rail");
|
|
9
|
+
|
|
10
|
+
command
|
|
11
|
+
.description(translation["command.rail.description"])
|
|
12
|
+
.argument("[name]", translation["command.component.name"])
|
|
13
|
+
.option("--cm, --custom", translation["command.component.customization"])
|
|
14
|
+
.option("-n, --navigation <navigation>", translation["command.rail.option.navigation"])
|
|
15
|
+
.option("-d, --direction <direction>", translation["command.rail.option.direction"])
|
|
16
|
+
.option("-c, --cyclic", translation["command.rail.option.cyclic"])
|
|
17
|
+
.option("-i, --itemView <itemView>", translation["command.menu.option.itemView"])
|
|
18
|
+
.option("-p, --path <path>", translation["command.component.path"])
|
|
19
|
+
.addHelpText(
|
|
20
|
+
"after",
|
|
21
|
+
`
|
|
22
|
+
${translation["help.option.title"]}
|
|
23
|
+
-navigation: ${optionsListString(NAVIGATION_TYPES)}
|
|
24
|
+
-direction: ${optionsListString(DIRECTION_TYPES)}
|
|
25
|
+
|
|
26
|
+
More about rail feature, ${translation["help.option.check"]} https://doc.dana-framework.com/apis/components/components/views/rails/abstractrailview/
|
|
27
|
+
`,
|
|
28
|
+
)
|
|
29
|
+
.action(addRail);
|
|
30
|
+
|
|
31
|
+
return command;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default addRailDefinition;
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { ConfigOptions } from "@/common/types/helperTypes.js";
|
|
14
|
+
import { SCREEN, VOD_SCREEN } from "@/commands/addComponent/const/componentConst.js";
|
|
15
|
+
import createComponent from "@/commands/addComponent/createComponent.js";
|
|
16
|
+
import addMenu from "@/commands/addComponent/addMenu/add-menu.js";
|
|
17
|
+
import addScrollView from "@/commands/addComponent/addScrollView/add-scrollView.js";
|
|
18
|
+
import * as prompts from "@clack/prompts";
|
|
19
|
+
|
|
20
|
+
interface CommandOptions {
|
|
21
|
+
screenType?: string;
|
|
22
|
+
path?: string;
|
|
23
|
+
}
|
|
24
|
+
const addScreen = async (name?: string, options?: CommandOptions) => {
|
|
25
|
+
try {
|
|
26
|
+
const data = {
|
|
27
|
+
name: name ?? "Mock",
|
|
28
|
+
type: options?.screenType ?? SCREEN,
|
|
29
|
+
path: options?.path ?? process.cwd(),
|
|
30
|
+
} as unknown as ConfigOptions;
|
|
31
|
+
|
|
32
|
+
if (options?.screenType === VOD_SCREEN) {
|
|
33
|
+
await addMenu(VOD_SCREEN, { path: data.path });
|
|
34
|
+
await addScrollView(VOD_SCREEN, { path: data.path });
|
|
35
|
+
}
|
|
36
|
+
await createComponent([data]);
|
|
37
|
+
} catch (e) {
|
|
38
|
+
prompts.log.info(`Error creating screen: ${(e as Error).message}`);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default addScreen;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import translation from "@/common/translation/translation.js";
|
|
3
|
+
import addScreen from "./add-screen.js";
|
|
4
|
+
|
|
5
|
+
const addScreenDefinition = () => {
|
|
6
|
+
const command = new Command("add-screen");
|
|
7
|
+
|
|
8
|
+
command
|
|
9
|
+
.description(translation["command.screen.description"])
|
|
10
|
+
.argument("[name]", translation["command.component.name"])
|
|
11
|
+
.option("-s, --screenType [screenType]", translation["command.screen.option.type"])
|
|
12
|
+
.option("-p, --path <path>", translation["command.component.path"])
|
|
13
|
+
.action(addScreen);
|
|
14
|
+
return command;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default addScreenDefinition;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ConfigOptions } from "@/common/types/helperTypes.js";
|
|
2
|
+
import { SCROLL_ITEM, TILE_VIEW } from "@/commands/addComponent/const/componentConst.js";
|
|
3
|
+
import createComponent from "@/commands/addComponent/createComponent.js";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { cp } from "node:fs/promises";
|
|
7
|
+
import { SCROLLVIEW_DEFAULT_CONFIG } from "@/commands/addComponent/const/defaultConfig.js";
|
|
8
|
+
import ComponentConfig from "@/commands/addComponent/config/ComponentConfig.js";
|
|
9
|
+
import { ScrollViewConfig } from "@/commands/addComponent/config/componentTypes.js";
|
|
10
|
+
import ComponentHelper from "@/commands/addComponent/helper/ComponentHelper.js";
|
|
11
|
+
|
|
12
|
+
interface CommandOptions {
|
|
13
|
+
itemView?: string;
|
|
14
|
+
itemMargin?: number;
|
|
15
|
+
custom?: boolean;
|
|
16
|
+
path?: string;
|
|
17
|
+
}
|
|
18
|
+
const addScrollView = async (name?: string, options?: CommandOptions) => {
|
|
19
|
+
const data = { ...options } as ConfigOptions;
|
|
20
|
+
if (name) {
|
|
21
|
+
data.name = name;
|
|
22
|
+
}
|
|
23
|
+
data.path = options?.path ?? process.cwd();
|
|
24
|
+
|
|
25
|
+
const scrollViewConfig: ScrollViewConfig = {
|
|
26
|
+
...data,
|
|
27
|
+
...(await ComponentConfig.scrollViewConfig(data)),
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const componentList: ConfigOptions[] = [scrollViewConfig as unknown as ConfigOptions];
|
|
31
|
+
if (!data.custom) {
|
|
32
|
+
componentList.push(
|
|
33
|
+
{ type: SCROLL_ITEM, name: data.itemView ?? SCROLLVIEW_DEFAULT_CONFIG.itemView, path: data.path },
|
|
34
|
+
{ type: TILE_VIEW, name: "mockTile", path: data.path },
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
await createComponent(componentList);
|
|
39
|
+
if (!data.custom) {
|
|
40
|
+
const modulePath = ComponentHelper.getTemplatePath();
|
|
41
|
+
const mockPath = path.join(path.dirname(modulePath), "mocks", "scrollViewMock.json");
|
|
42
|
+
const finalPath = path.resolve(data.path, "scrollViewMock.json");
|
|
43
|
+
|
|
44
|
+
await cp(mockPath, finalPath);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default addScrollView;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import addScrollView from "./add-scrollView.js";
|
|
3
|
+
import translation from "@/common/translation/translation.js";
|
|
4
|
+
|
|
5
|
+
const addScrollViewDefinition = () => {
|
|
6
|
+
return new Command("add-scrollView")
|
|
7
|
+
.description(translation["command.scrollView.description"])
|
|
8
|
+
.argument("[name]", translation["command.component.name"])
|
|
9
|
+
.option("--cm, --custom", translation["command.component.customization"])
|
|
10
|
+
.option("-i, --itemView <itemView>", translation["command.menu.option.itemView"])
|
|
11
|
+
.option("-m, --itemMargin <itemMargin>", translation["command.menu.option.itemMargin"])
|
|
12
|
+
.option("-p, --path <path>", translation["command.component.path"])
|
|
13
|
+
.action(addScrollView);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default addScrollViewDefinition;
|