Added prototype for bundling files.

This commit is contained in:
SamTV12345 2024-06-02 19:30:43 +02:00
parent 5809e9286f
commit ffe40b82c9
13 changed files with 579 additions and 72 deletions

21
ui/copyProdPadFiles.js Normal file
View file

@ -0,0 +1,21 @@
import {fileURLToPath} from "url";
import {dirname} from "path";
import fs from "node:fs";
import path from "node:path";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
let padHtml = fs.readFileSync(path.join(__dirname, "..", "src", "templates", "pad_template.html"), 'utf8');
const OUTPUT_PATH = path.join(__dirname, "..", "src", "templates", "pad.html");
// Walk directory and find pad js file
let padJsFile = "";
const walkSync = (dir) => {
fs.readdirSync(dir).forEach(file => {
if (file.startsWith("pad-")) {
padJsFile = file;
}
})}
walkSync(path.join(__dirname, "..", "src", "static", "oidc", "assets"))
console.log(padJsFile)
padHtml = padHtml.replace("PLACEHOLDER_FOR_PAD_JS", `../../views/assets/${padJsFile}?callback=require.define`);
fs.writeFileSync(OUTPUT_PATH, padHtml);