Auto-update manifest version on build

This commit is contained in:
Brahim Hadriche committed 2022-11-06 12:36:13 -05:00
1 parent 0fba45717f
commit e61cf6ae8a
3 files changed
+32 -7

No files matched your search

+4 -2
View File
@@ -14,7 +14,8 @@
"maestro-roku-bsc-plugin": "^0.25.7",
"roku-log-bsc-plugin": "^0.6.1",
"rooibos-roku": "^5.2.3",
"ropm": "^0.10.10"
"ropm": "^0.10.10",
"semver": "^7.3.8"
},
"ropm": {
"rootDir": "src",
@@ -25,8 +26,9 @@
]
},
"scripts": {
"build": "node scripts/run-roku-youtube.js",
"build": "npm run manifest-version && node scripts/run-roku-youtube.js",
"test": "echo \"Error: no test specified\" && exit 1",
"manifest-version": "node scripts/update-manifest-version.js",
"postinstall": "npx ropm copy",
"lint": "npx bsc"
},
+21
View File
@@ -0,0 +1,21 @@
const path = require('path');
const fs = require('fs');
const semverParse = require('semver/functions/parse')
const packageJsonContent = fs.readFileSync("./package.json", {encoding:'utf8', flag:'r'})
const packageJson = JSON.parse(packageJsonContent)
const version = packageJson.version
const parsedVersion = semverParse(version)
let appManifestContent = fs.readFileSync("./src/manifest", {encoding:'utf8', flag:'r'})
const majorPattern = /major_version=(\d+)/
const minorPattern = /minor_version=(\d+)/
const buildPattern = /build_version=(\d+)/
appManifestContent = appManifestContent.replace(majorPattern, `major_version=${parsedVersion.major}`)
appManifestContent = appManifestContent.replace(minorPattern, `minor_version=${parsedVersion.minor}`)
appManifestContent = appManifestContent.replace(buildPattern, `build_version=${String(parsedVersion.patch).padStart(5, '0')}`)
fs.writeFileSync("./src/manifest", appManifestContent)
+7 -5
View File
@@ -1,16 +1,18 @@
title=Roku Youtube
major_version=1
minor_version=0
build_version=00001
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=1
build_version=00000
## Channel Assets
### Main Menu Icons / Channel Poster Artwork
### Main Menu Icons / Channel Poster Artwork
#### Image sizes are FHD: 540x405px | HD: 290x218px | SD: 214x144px
mm_icon_focus_fhd=pkg:/images/channel-poster_fhd.png
mm_icon_focus_hd=pkg:/images/channel-poster_hd.png
mm_icon_focus_sd=pkg:/images/channel-poster_sd.png
### Splash Screen + Loading Screen Artwork
### Splash Screen + Loading Screen Artwork
#### Image sizes are FHD: 1920x1080px | HD: 1280x720px | SD: 720x480px
splash_screen_fhd=pkg:/images/splash-screen_fhd.jpg
splash_screen_hd=pkg:/images/splash-screen_hd.jpg