Better debugging

This commit is contained in:
Brahim Hadriche committed 2022-11-30 10:16:44 -05:00
1 parent ce04a1af1a
commit 21593001ae
7 files changed
+45 -8

No files matched your search

+2 -1
View File
@@ -11,13 +11,14 @@
"enableDebuggerAutoRecovery": false,
"stopDebuggerOnAppExit": false,
"rootDir": "${workspaceFolder}/dist/build",
"preLaunchTask": "build",
"preLaunchTask": "build-dev",
"name": "Launch playlet (dev)",
"injectRdbOnDeviceComponent": true
},
{
"type": "brightscript",
"request": "launch",
"envFile": "${workspaceFolder}/.vscode/.env",
"host": "${env:ROKU_DEV_TARGET}",
"password": "${env:ROKU_DEVPASSWORD}",
"stopOnEntry": false,
+2 -2
View File
@@ -2,13 +2,13 @@
"version": "2.0.0",
"tasks": [
{
"label": "build",
"label": "build-dev",
"presentation": {
"close": true,
"reveal": "silent",
"revealProblems": "onProblem"
},
"script": "build",
"script": "build:dev",
"type": "npm"
},
{
+3 -1
View File
@@ -28,7 +28,8 @@
"scripts": {
"prebuild": "rm -rf dist",
"build": "bsc",
"build:prod": "npm run build -- --sourceMap=false",
"build:dev": "npm run manifest-symbols -- DEBUG=true && npm run build",
"build:prod": "npm run manifest-symbols -- DEBUG=false && npm run build -- --sourceMap=false",
"build:release": "npm run format:fix && npm run lint:fix && npm run manifest-version && npm run generate-images && npm run build:prod && npm run zip-package",
"lint": "bslint --project config/bsconfig.lint.json --lintConfig config/bslint.jsonc",
"lint:fix": "npm run lint -- --fix",
@@ -39,6 +40,7 @@
"manifest-version": "node scripts/update-manifest-version.js",
"zip-package": "node scripts/zip-package.js",
"screenshot": "node scripts/screenshot.js",
"manifest-symbols": "node scripts/update-manifest-symbols.js",
"postinstall": "npx ropm copy"
}
}
+33
View File
@@ -0,0 +1,33 @@
const fs = require('fs');
if (process.argv.length < 3) {
console.error("Invalid usage! usage: npm run manifest-symbols -- SYMBOL1=true [SYMBOL2=false]")
exit(-1)
}
function argsToSymbolsObject(arr) {
return arr.reduce(function (acc, value) {
keyValue = value.split("=")
acc[keyValue[0]] = keyValue[1]
return acc
}, {})
}
const newSymbols = argsToSymbolsObject(process.argv.slice(2))
let currentSymbols = {}
const appManifestLines = fs.readFileSync("./src/manifest", { encoding: 'utf8', flag: 'r' }).split('\n')
const bsConstIndex = appManifestLines.findIndex(line => line.startsWith("bs_const="))
if (bsConstIndex !== -1) {
let bsConst = appManifestLines[bsConstIndex]
bsConst = bsConst.substring("bs_const=".length)
currentSymbols = argsToSymbolsObject(bsConst.split(";"))
}
mergedSymbols = {...currentSymbols, ...newSymbols}
bsConst = "bs_const=" + Object.keys(mergedSymbols).map(key => `${key}=${mergedSymbols[key]}`).join(";")
appManifestLines[bsConstIndex] = bsConst
fs.writeFileSync("./src/manifest", appManifestLines.join("\n"))
@@ -37,7 +37,7 @@ function WebServerLoop()
m.server.UseRouter(new Http.StateApiRouter())
m.server.UseRouter(new Http.InvidiousRouter())
m.server.UseRouter(new Http.HttpStaticFilesRouter("/", m.settings.WwwRoot))
#if WEB_SERVER_PACKAGE_DEBUG
#if DEBUG
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/pkg", "pkg:/", true, true))
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/tmp", "tmp:/", true, true))
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/cachefs", "cachefs:/", true, true))
+1 -1
View File
@@ -21,4 +21,4 @@ splash_screen_sd=pkg:/images/splash-screen_sd.jpg
splash_color=#242424
splash_min_time=0
bs_const=WEB_SERVER_BASIC_AUTH=false;WEB_SERVER_PACKAGE_DEBUG=false;DASH_THUMBNAILS=false
bs_const=DEBUG=true;WEB_SERVER_BASIC_AUTH=false;DASH_THUMBNAILS=false
+3 -2
View File
@@ -9,8 +9,9 @@ function main() as void
' The following comment is to enable the SceneGraph inspector
' on the VSCode BrightScript plugin.
' vscode_rdb_on_device_component_entry
#if DEBUG
' vscode_rdb_on_device_component_entry
#end if
while true
msg = wait(0, m.port)