From 2389af0868fa91c3151ce2c328e731d56c307780 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Wed, 3 May 2023 17:21:04 -0400 Subject: [PATCH] Enable brighterscript, create NPM build scripts, install and use roku-log, and use bsc import statements (#1173) --- .github/workflows/build-dev.yml | 13 +- .github/workflows/build-prod.yml | 15 +- .vscode/launch.json | 10 +- .vscode/settings.json | 1 + .vscode/tasks.json | 40 +- bsconfig-prod.json | 37 + bsconfig-tests.json | 5 + bsconfig.json | 16 +- bsfmt.json | 15 +- components/ButtonGroupHoriz.xml | 7 +- components/Buttons/JFButtons.xml | 13 +- components/Buttons/TextSizeTask.xml | 5 +- components/GetNextEpisodeTask.brs | 3 + components/GetNextEpisodeTask.xml | 5 +- components/GetPlaybackInfoTask.brs | 6 + components/GetPlaybackInfoTask.xml | 8 +- components/GetShuffleEpisodesTask.brs | 3 + components/GetShuffleEpisodesTask.xml | 5 +- components/IconButton.xml | 5 +- components/ItemGrid/Alpha.xml | 91 +- components/ItemGrid/FavoriteItemsTask.brs | 4 + components/ItemGrid/FavoriteItemsTask.xml | 6 +- components/ItemGrid/GridItem.brs | 7 +- components/ItemGrid/GridItem.xml | 3 - components/ItemGrid/GridItemSmall.brs | 3 + components/ItemGrid/GridItemSmall.xml | 7 +- components/ItemGrid/ItemGrid.brs | 10 +- components/ItemGrid/ItemGrid.xml | 43 +- components/ItemGrid/ItemGridOptions.brs | 7 +- components/ItemGrid/ItemGridOptions.xml | 6 +- components/ItemGrid/LoadItemsTask2.brs | 12 +- components/ItemGrid/LoadItemsTask2.xml | 10 +- components/ItemGrid/LoadVideoContentTask.brs | 10 + components/ItemGrid/LoadVideoContentTask.xml | 12 +- components/ItemGrid/MovieLibraryView.brs | 7 + components/ItemGrid/MovieLibraryView.xml | 25 +- components/ItemGrid/MusicArtistGridItem.brs | 3 + components/ItemGrid/MusicArtistGridItem.xml | 9 +- components/ItemGrid/MusicLibraryView.brs | 6 + components/ItemGrid/MusicLibraryView.xml | 22 +- components/JFButton.xml | 5 +- components/JFGroup.xml | 5 +- components/JFMessageDialog.xml | 19 +- components/JFOverhang.brs | 2 + components/JFOverhang.xml | 10 +- components/JFScene.brs | 2 + components/JFScene.xml | 6 +- components/JFScreen.brs | 8 + components/JFScreen.xml | 5 +- components/JFVideo.brs | 4 + components/JFVideo.xml | 5 - components/ListPoster.brs | 3 + components/ListPoster.xml | 3 - components/OverviewDialog.bs | 17 + components/OverviewDialog.xml | 45 +- components/PersonDetails.brs | 4 + components/PersonDetails.xml | 34 +- components/PlaybackDialog.xml | 4 +- components/PlayedCheckmark.xml | 1 - components/PlaystateTask.brs | 3 + components/PlaystateTask.xml | 5 +- components/RadioDialog.brs | 2 + components/RadioDialog.xml | 4 +- components/SearchBox.brs | 6 + components/SearchBox.xml | 14 +- components/Spinner.xml | 6 +- components/StandardDialog.xml | 3 +- components/WhatsNewDialog.xml | 3 +- components/captionTask.brs | 3 + components/captionTask.xml | 3 - components/config/ConfigData.xml | 5 +- components/config/ConfigItem.xml | 8 +- components/config/ConfigList.brs | 2 + components/config/ConfigList.xml | 6 +- components/config/JFServer.brs | 1 - components/config/JFServer.xml | 4 +- components/config/LoginScene.xml | 5 +- components/config/ServerDiscoveryTask.brs | 13 +- components/config/ServerDiscoveryTask.xml | 3 +- components/config/SetServerScreen.brs | 6 +- components/config/SetServerScreen.xml | 10 +- components/data/AlbumData.xml | 5 +- components/data/ChannelData.brs | 4 + components/data/ChannelData.xml | 8 +- components/data/CollectionData.brs | 4 + components/data/CollectionData.xml | 6 +- components/data/FolderData.brs | 4 + components/data/FolderData.xml | 9 +- components/data/GetFiltersTask.brs | 3 + components/data/GetFiltersTask.xml | 6 +- components/data/HomeData.brs | 4 + components/data/HomeData.xml | 4 - components/data/ImageData.xml | 5 +- components/data/JFContentItem.xml | 4 +- components/data/MovieData.brs | 5 + components/data/MovieData.xml | 9 +- components/data/MusicAlbumData.xml | 5 +- components/data/MusicAlbumSongListData.brs | 4 + components/data/MusicAlbumSongListData.xml | 9 +- components/data/MusicArtistData.brs | 4 + components/data/MusicArtistData.xml | 9 +- components/data/MusicSongData.xml | 5 +- components/data/OptionsButton.brs | 2 + components/data/OptionsButton.xml | 6 +- components/data/OptionsData.brs | 2 + components/data/OptionsData.xml | 6 +- components/data/PersonData.brs | 4 + components/data/PersonData.xml | 16 +- components/data/PhotoData.brs | 4 + components/data/PhotoData.xml | 8 +- components/data/PlaylistData.xml | 5 +- components/data/PublicUserData.xml | 5 +- components/data/SceneManager.brs | 5 +- components/data/SceneManager.xml | 5 +- components/data/ScheduleProgramData.brs | 4 + components/data/ScheduleProgramData.xml | 6 +- components/data/SearchData.xml | 5 +- components/data/SeriesData.brs | 4 + components/data/SeriesData.xml | 8 +- components/data/TVEpisode.brs | 4 + components/data/TVEpisode.xml | 7 +- components/data/TVEpisodeData.xml | 5 +- components/data/TVSeasonData.xml | 5 +- components/data/UserData.brs | 2 + components/data/UserData.xml | 6 +- components/data/VideoData.brs | 4 + components/data/VideoData.xml | 7 +- components/extras/ExtrasItem.xml | 13 +- components/extras/ExtrasRowList.xml | 5 +- components/extras/ExtrasSlider.xml | 24 +- components/home/Home.brs | 5 +- components/home/Home.xml | 4 - components/home/HomeItem.brs | 12 +- components/home/HomeItem.xml | 5 - components/home/HomeRow.xml | 4 +- components/home/HomeRows.brs | 2 + components/home/HomeRows.xml | 2 - components/home/LoadItemsTask.brs | 8 + components/home/LoadItemsTask.xml | 12 +- components/liveTv/LoadChannelsTask.brs | 3 + components/liveTv/LoadChannelsTask.xml | 8 +- components/liveTv/LoadProgramDetailsTask.brs | 3 + components/liveTv/LoadProgramDetailsTask.xml | 5 +- components/liveTv/LoadSheduleTask.brs | 3 + components/liveTv/LoadSheduleTask.xml | 5 +- components/liveTv/ProgramDetails.brs | 3 + components/liveTv/ProgramDetails.xml | 19 +- components/liveTv/RecordProgramTask.brs | 7 +- components/liveTv/RecordProgramTask.xml | 7 +- components/liveTv/schedule.xml | 27 +- components/login/UserItem.xml | 5 +- components/login/UserRow.xml | 5 +- components/login/UserSelect.xml | 9 +- components/manager/QueueManager.brs | 3 + components/manager/QueueManager.xml | 7 +- components/mediaPlayers/AudioPlayer.brs | 2 + components/mediaPlayers/AudioPlayer.xml | 6 +- components/movies/AudioTrackListItem.xml | 7 +- components/movies/MovieDetails.brs | 3 + components/movies/MovieDetails.xml | 3 - components/movies/MovieOptions.xml | 5 +- components/movies/VideoTrackListItem.xml | 7 +- components/music/AlbumGrid.brs | 2 + components/music/AlbumGrid.xml | 6 +- components/music/AlbumTrackList.xml | 7 +- components/music/AlbumView.brs | 2 + components/music/AlbumView.xml | 10 +- components/music/ArtistView.brs | 2 + components/music/ArtistView.xml | 6 +- components/music/AudioPlayerView.brs | 5 + components/music/AudioPlayerView.xml | 9 +- .../music/LoadScreenSaverTimeoutTask.xml | 5 +- components/music/PlaylistView.brs | 2 + components/music/PlaylistView.xml | 6 +- components/music/SongItem.brs | 2 + components/music/SongItem.xml | 6 +- components/options/OptionNode.xml | 5 +- components/options/OptionsSlider.xml | 5 +- components/photos/LoadPhotoTask.brs | 4 + components/photos/LoadPhotoTask.xml | 8 +- components/photos/PhotoDetails.brs | 3 + components/photos/PhotoDetails.xml | 11 +- components/quickConnect/QuickConnect.brs | 4 + components/quickConnect/QuickConnect.xml | 10 +- .../quickConnect/QuickConnectDialog.brs | 4 + .../quickConnect/QuickConnectDialog.xml | 10 +- components/search/SearchResults.brs | 6 + components/search/SearchResults.xml | 24 +- components/search/SearchRow.brs | 6 + components/search/SearchRow.xml | 10 +- components/search/SearchTask.brs | 6 + components/search/SearchTask.xml | 10 +- components/section/section.brs | 2 + components/section/section.xml | 6 +- components/section/sectionScroller.brs | 2 + components/section/sectionScroller.xml | 6 +- components/settings/settings.brs | 8 +- components/settings/settings.xml | 29 +- components/tvshows/TVEpisodeRow.xml | 5 +- .../tvshows/TVEpisodeRowWithOptions.xml | 7 +- components/tvshows/TVEpisodes.brs | 5 + components/tvshows/TVEpisodes.xml | 5 - components/tvshows/TVListDetails.brs | 3 + components/tvshows/TVListDetails.xml | 17 +- components/tvshows/TVListOptions.xml | 5 +- components/tvshows/TVSeasonRow.xml | 5 +- components/tvshows/TVShowDescription.brs | 2 + components/tvshows/TVShowDescription.xml | 8 +- components/tvshows/TVShowDetails.brs | 3 + components/tvshows/TVShowDetails.xml | 7 +- components/video/VideoPlayerView.brs | 4 + components/video/VideoPlayerView.xml | 4 - package-lock.json | 1613 +++++++---------- package.json | 9 +- source/api/baserequest.brs | 1 - 215 files changed, 1543 insertions(+), 1720 deletions(-) create mode 100644 bsconfig-prod.json create mode 100644 components/OverviewDialog.bs diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index 3c945d5e..7957bffd 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -1,4 +1,4 @@ -name: build +name: build-dev on: pull_request: @@ -17,11 +17,14 @@ jobs: with: node-version: "lts/*" cache: "npm" - - run: npm ci - - run: npx ropm install - - run: make dev + - name: NPM install + run: npm ci + - name: Install roku module dependencies + run: npx ropm install + - name: Build app + run: npm run build - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3 with: name: Jellyfin-Roku-dev-${{ github.sha }} - path: ${{ github.workspace }}/out/staging + path: ${{ github.workspace }}/build/staging if-no-files-found: error \ No newline at end of file diff --git a/.github/workflows/build-prod.yml b/.github/workflows/build-prod.yml index ded52f4e..78ca1be0 100644 --- a/.github/workflows/build-prod.yml +++ b/.github/workflows/build-prod.yml @@ -1,4 +1,4 @@ -name: build +name: build-prod on: pull_request: @@ -66,11 +66,14 @@ jobs: with: node-version: "lts/*" cache: "npm" - - run: npm ci - - run: npx ropm install - - run: make release + - name: NPM install + run: npm ci + - name: Install roku module dependencies + run: npx ropm install + - name: Build app for production + run: npm run build-prod - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3 with: - name: Jellyfin-Roku-release-${{ github.sha }} - path: ${{ github.workspace }}/out/staging + name: Jellyfin-Roku-v${{ env.newManVersion }}-${{ github.sha }} + path: ${{ github.workspace }}/build/staging if-no-files-found: error \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index c4673d71..fe6b11d6 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,6 +5,8 @@ "type": "brightscript", "request": "launch", "name": "Jellyfin Debug", + "rootDir": "${workspaceFolder}/build/staging", + "preLaunchTask": "build-dev", "stopOnEntry": false, // To enable RALE: // set "brightscript.debug.raleTrackerTaskFileLocation": "/absolute/path/to/rale/TrackerTask.xml" in your vscode user settings @@ -14,14 +16,6 @@ //"host": "${promptForHost}", //WARNING: don't edit this value. Instead, set "brightscript.debug.password": "YOUR_PASSWORD_HERE" in your vscode user settings //"password": "${promptForPassword}", - "files": [ - "components/**/*", - "images/**/*", - "locale/**/*", - "settings/**/*", - "source/**/*", - "manifest" - ] }, { "name": "Run tests", diff --git a/.vscode/settings.json b/.vscode/settings.json index a2379557..b0c28bbe 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,5 +10,6 @@ }, "xml.format.maxLineWidth": 0, "editor.formatOnSave": true, + "brightscript.output.hyperlinkFormat": "FilenameAndFunction", "brightscript.bsdk": "node_modules/brighterscript" } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 232baf36..039935d0 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,6 +1,42 @@ { + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ + { + "label": "build-dev", + "type": "shell", + "command": "npm run build", + "problemMatcher": [], + "presentation": { + "echo": true, + "focus": false, + "panel": "shared", + "showReuseMessage": false, + "clear": true + }, + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "build-prod", + "type": "shell", + "command": "npm run build-prod", + "problemMatcher": [], + "presentation": { + "echo": true, + "focus": false, + "panel": "shared", + "showReuseMessage": false, + "clear": true + }, + "group": { + "kind": "build", + "isDefault": true + } + }, { "label": "build-tests", "type": "shell", @@ -8,7 +44,7 @@ "problemMatcher": [], "presentation": { "echo": true, - "reveal": "silent", + "reveal": "always", "focus": false, "panel": "shared", "showReuseMessage": false, @@ -26,7 +62,7 @@ "problemMatcher": [], "presentation": { "echo": true, - "reveal": "silent", + "reveal": "always", "focus": false, "panel": "shared", "showReuseMessage": false, diff --git a/bsconfig-prod.json b/bsconfig-prod.json new file mode 100644 index 00000000..60beb933 --- /dev/null +++ b/bsconfig-prod.json @@ -0,0 +1,37 @@ +{ + "files": [ + "manifest", + "source/**/*.*", + "components/**/*.*", + "images/**/*.*", + "locale/en_US/translations.ts", + "locale/en_GB/translations.ts", + "locale/fr_CA/translations.ts", + "locale/es_ES/translations.ts", + "locale/de_DE/translations.ts", + "locale/it_IT/translations.ts", + "locale/pt_BR/translations.ts", + "settings/**/*.*", + { + "src": "resources/branding/release/*.*", + "dest": "images" + } + ], + "plugins": [ + "@rokucommunity/bslint", + "roku-log-bsc-plugin" + ], + "rokuLog": { + "strip": true, + "insertPkgPath": false, + "removeComments": true + }, + "diagnosticFilters": [ + "node_modules/**/*", + "**/roku_modules/**/*" + ], + "allowBrighterScriptInBrightScript": true, + "autoImportComponentScript": true, + "stagingDir": "build/staging", + "retainStagingDir": true +} \ No newline at end of file diff --git a/bsconfig-tests.json b/bsconfig-tests.json index ee5a654b..21247d4a 100644 --- a/bsconfig-tests.json +++ b/bsconfig-tests.json @@ -20,7 +20,12 @@ "dest": "settings" } ], + "diagnosticFilters": [ + "node_modules/**/*", + "**/roku_modules/**/*" + ], "autoImportComponentScript": true, + "allowBrighterScriptInBrightScript": true, "createPackage": false, "stagingFolderPath": "build", "plugins": [ diff --git a/bsconfig.json b/bsconfig.json index 61a5eb62..907df1a7 100644 --- a/bsconfig.json +++ b/bsconfig.json @@ -10,10 +10,18 @@ ], "plugins": [ "@rokucommunity/bslint", - "rooibos-roku" + "roku-log-bsc-plugin" ], + "rokuLog": { + "insertPkgPath": true + }, "diagnosticFilters": [ - "node_modules/**", - "**/roku_modules/**" - ] + "node_modules/**/*", + "**/roku_modules/**/*" + ], + "sourceMap": true, + "autoImportComponentScript": true, + "allowBrighterScriptInBrightScript": true, + "stagingDir": "build/staging", + "retainStagingDir": true } \ No newline at end of file diff --git a/bsfmt.json b/bsfmt.json index 3deaa0f9..23cbd4f6 100644 --- a/bsfmt.json +++ b/bsfmt.json @@ -1,9 +1,10 @@ { - "files": [ - "source/**/*.brs", - "source/**/*.bs", - "components/**/*.brs", - "components/**/*.bs", - "test-app/**/*.bs" - ] + "files": [ + "source/**/*.brs", + "source/**/*.bs", + "components/**/*.brs", + "components/**/*.bs", + "test-app/**/*.bs", + "!**/roku_modules/**/*.*" + ] } \ No newline at end of file diff --git a/components/ButtonGroupHoriz.xml b/components/ButtonGroupHoriz.xml index 8646a3be..574e43fc 100644 --- a/components/ButtonGroupHoriz.xml +++ b/components/ButtonGroupHoriz.xml @@ -1,9 +1,6 @@ - + - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/components/PersonDetails.brs b/components/PersonDetails.brs index de3b5730..8104c7bf 100644 --- a/components/PersonDetails.brs +++ b/components/PersonDetails.brs @@ -1,3 +1,7 @@ +import "pkg:/source/api/Image.brs" +import "pkg:/source/api/baserequest.brs" +import "pkg:/source/utils/config.brs" + sub init() m.dscr = m.top.findNode("description") m.vidsList = m.top.findNode("extrasGrid") diff --git a/components/PersonDetails.xml b/components/PersonDetails.xml index 6acc1eb4..fc7ead8b 100644 --- a/components/PersonDetails.xml +++ b/components/PersonDetails.xml @@ -1,4 +1,4 @@ - + @@ -7,26 +7,26 @@ - - - - - - -