feat: refactored about menu + added static path updates for win build

This commit is contained in:
Anoop M D
2025-03-18 21:43:28 +05:30
parent 98bd997665
commit ccd4a14da6
4 changed files with 199 additions and 187 deletions

View File

@ -2,6 +2,7 @@ const os = require('os');
const fs = require('fs-extra');
const util = require('util');
const spawn = util.promisify(require('child_process').spawn);
const path = require('path');
async function deleteFileIfExists(filePath) {
try {
@ -80,7 +81,7 @@ async function main() {
// Copy build
await copyFolderIfExists('packages/bruno-app/dist', 'packages/bruno-electron/web');
// Change paths in next
// Update static paths
const files = await fs.readdir('packages/bruno-electron/web');
for (const file of files) {
if (file.endsWith('.html')) {
@ -90,6 +91,22 @@ async function main() {
}
}
// update font load paths
const cssDir = path.join('packages/bruno-electron/web/static/css');
try {
const cssFiles = await fs.readdir(cssDir);
for (const file of cssFiles) {
if (file.endsWith('.css')) {
const filePath = path.join(cssDir, file);
let content = await fs.readFile(filePath, 'utf8');
content = content.replace(/\/static\/font/g, '../../static/font');
await fs.writeFile(filePath, content);
}
}
} catch (error) {
console.error(`Error updating font paths: ${error}`);
}
// Remove sourcemaps
await removeSourceMapFiles('packages/bruno-electron/web');