Merge pull request #1289 from cewert/fix-and-update-roku-log

This commit is contained in:
Charles Ewert 2023-06-09 21:47:52 -04:00 committed by GitHub
commit 59f46c9db5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 16 deletions

18
package-lock.json generated
View File

@ -10,16 +10,16 @@
"hasInstallScript": true,
"license": "GPL-2.0",
"dependencies": {
"@rokucommunity/bslib": "0.1.1",
"bgv": "npm:button-group-vert@1.0.2",
"brighterscript-formatter": "1.6.29",
"intKeyboard": "npm:integer-keyboard@1.0.12",
"log": "npm:roku-log@0.9.3",
"log": "npm:roku-log@0.11.1",
"sob": "npm:slide-out-button@1.0.1"
},
"devDependencies": {
"@rokucommunity/bslint": "0.8.6",
"brighterscript": "0.65.0",
"bslib": "npm:@rokucommunity/bslib@0.1.1",
"jshint": "2.13.6",
"markdownlint-cli2": "0.7.1",
"rimraf": "5.0.1",
@ -706,12 +706,6 @@
"base64-js": "^1.1.2"
}
},
"node_modules/bslib": {
"name": "@rokucommunity/bslib",
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@rokucommunity/bslib/-/bslib-0.1.1.tgz",
"integrity": "sha512-2ox6EUL+UTtccTbD4dbVjZK3QHa0PHCqpoKMF8lZz9ayzzEP3iVPF8KZR6hOi6bxsIcbGXVjqmtCVkpC4P9SrA=="
},
"node_modules/camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
@ -2228,11 +2222,11 @@
},
"node_modules/log": {
"name": "roku-log",
"version": "0.9.3",
"resolved": "https://registry.npmjs.org/roku-log/-/roku-log-0.9.3.tgz",
"integrity": "sha512-YzvtSCdmZJeimyZZ/C5Y7tdw6vpNMrZV90pg8EPn3vLAtRjtxN3dOt73s48BVOx2W00M0BEGmeaECObS2RdIqg==",
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/roku-log/-/roku-log-0.11.1.tgz",
"integrity": "sha512-ezowFIgthbFhM6iNQwfQT/oARhYNvwetgCaeMyN7deq1JwdUpe3Mzzvhqs9/2+ogtRF7sKVtnfmNKAWx4W2rOw==",
"dependencies": {
"bslib": "npm:@rokucommunity/bslib@^0.1.1"
"@rokucommunity/bslib": "^0.1.1"
}
},
"node_modules/log-driver": {

View File

@ -3,16 +3,16 @@
"version": "1.6.6",
"description": "Roku app for Jellyfin media server",
"dependencies": {
"@rokucommunity/bslib": "0.1.1",
"bgv": "npm:button-group-vert@1.0.2",
"brighterscript-formatter": "1.6.29",
"intKeyboard": "npm:integer-keyboard@1.0.12",
"log": "npm:roku-log@0.9.3",
"log": "npm:roku-log@0.11.1",
"sob": "npm:slide-out-button@1.0.1"
},
"devDependencies": {
"@rokucommunity/bslint": "0.8.6",
"brighterscript": "0.65.0",
"bslib": "npm:@rokucommunity/bslib@0.1.1",
"jshint": "2.13.6",
"markdownlint-cli2": "0.7.1",
"rimraf": "5.0.1",
@ -31,10 +31,11 @@
"check-formatting": "npx bsfmt --check",
"format": "npx bsfmt --write",
"lint": "bslint",
"lint-json": "jshint --extra-ext .json --verbose --exclude node_modules ./",
"lint-json": "jshint --extra-ext .json --verbose --exclude node_modules,scripts ./",
"lint-markdown": "markdownlint-cli2 \"**/*.md\" \"#node_modules\"",
"lint-spelling": "spellchecker -d dictionary.txt --files \"**/*.md\" \"**/.*/**/*.md\" \"!node_modules/**/*.md\"",
"postinstall": "npx ropm copy",
"postinstall": "npm run ropm",
"ropm": "ropm copy && node scripts/ropm-hook.js",
"validate": "npx bsc --copy-to-staging=false --create-package=false"
},
"repository": {

59
scripts/ropm-hook.js Normal file
View File

@ -0,0 +1,59 @@
// MIT License
// Copyright (c) 2019 George Cook
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable github/array-foreach */
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-require-imports */
const fs = require('fs-extra');
const path = require('path');
let componentsDir = path.join(__dirname, '..', 'components', 'roku_modules');
parseFolder(componentsDir);
let sourceDir = path.join(__dirname, '..', 'source', 'roku_modules');
parseFolder(sourceDir);
function parseFolder(sourceDir) {
try {
fs.readdirSync(sourceDir).forEach(file => {
let filePath = path.join(sourceDir, file);
let fileStats = fs.statSync(filePath);
if (fileStats.isDirectory()) {
parseFolder(filePath);
} else if (filePath.endsWith('.xml')) {
let text = fs.readFileSync(filePath, 'utf8');
let r = /\/roku_modules\/undefined\/bslib\.brs/gim;
text = text.replace(r, '/roku_modules/rokucommunity_bslib/bslib.brs');
r = /\/roku_modules\/bslib\/bslib\.brs/gim;
text = text.replace(r, '/roku_modules/rokucommunity_bslib/bslib.brs');
r = /\/roku_modules\/undefined/gim;
text = text.replace(r, '/roku_modules/maestro');
fs.writeFileSync(filePath, text);
// console.log('fixed', filePath);
}
});
} catch (e) {
console.log(e);
}
}