docs: move build instructions from README to BUILDING.md

- Move detailed setup and build instructions from README.md to BUILDING.md
- Add concise reference to BUILDING.md in README.md
- Keep testing and other documentation in README.md
- Improve organization of documentation by separating build-specific content
This commit is contained in:
Matthew Raymer
2025-02-13 04:48:18 +00:00
parent f0d0f63672
commit 4e0f9235cd
6 changed files with 82 additions and 135 deletions

View File

@@ -3,13 +3,13 @@ const path = require("path");
const fs = require("fs");
// Check if running in dev mode
const isDev = process.argv.includes('--inspect');
const isDev = process.argv.includes("--inspect");
function createWindow() {
// Add before createWindow function
const preloadPath = path.join(__dirname, 'preload.js');
console.log('Checking preload path:', preloadPath);
console.log('Preload exists:', fs.existsSync(preloadPath));
const preloadPath = path.join(__dirname, "preload.js");
console.log("Checking preload path:", preloadPath);
console.log("Preload exists:", fs.existsSync(preloadPath));
// Create the browser window.
const mainWindow = new BrowserWindow({
@@ -20,7 +20,7 @@ function createWindow() {
contextIsolation: true,
webSecurity: true,
allowRunningInsecureContent: false,
preload: path.join(__dirname, 'preload.js')
preload: path.join(__dirname, "preload.js"),
},
});
@@ -33,30 +33,32 @@ function createWindow() {
console.log("__dirname:", __dirname);
console.log("process.cwd():", process.cwd());
const indexPath = path.join(__dirname, 'www', 'index.html');
console.log("www path:", path.join(__dirname, 'www'));
console.log("www assets path:", path.join(__dirname, 'www', 'assets'));
const indexPath = path.join(__dirname, "www", "index.html");
console.log("www path:", path.join(__dirname, "www"));
console.log("www assets path:", path.join(__dirname, "www", "assets"));
if (!fs.existsSync(indexPath)) {
console.error(`Index file not found at: ${indexPath}`);
throw new Error('Index file not found');
throw new Error("Index file not found");
}
// Set CSP headers
mainWindow.webContents.session.webRequest.onHeadersReceived((details, callback) => {
callback({
responseHeaders: {
...details.responseHeaders,
'Content-Security-Policy': [
"default-src 'self';" +
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;" +
"font-src 'self' https://fonts.gstatic.com;" +
"script-src 'self' 'unsafe-eval' 'unsafe-inline';" +
"img-src 'self' data: https:;"
]
}
});
});
mainWindow.webContents.session.webRequest.onHeadersReceived(
(details, callback) => {
callback({
responseHeaders: {
...details.responseHeaders,
"Content-Security-Policy": [
"default-src 'self';" +
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;" +
"font-src 'self' https://fonts.gstatic.com;" +
"script-src 'self' 'unsafe-eval' 'unsafe-inline';" +
"img-src 'self' data: https:;",
],
},
});
},
);
// Load the index.html
mainWindow
@@ -79,17 +81,23 @@ function createWindow() {
});
// Add right after creating the BrowserWindow
mainWindow.webContents.on('did-fail-load', (event, errorCode, errorDescription) => {
console.error('Page failed to load:', errorCode, errorDescription);
mainWindow.webContents.on(
"did-fail-load",
(event, errorCode, errorDescription) => {
console.error("Page failed to load:", errorCode, errorDescription);
},
);
mainWindow.webContents.on("preload-error", (event, preloadPath, error) => {
console.error("Preload script error:", preloadPath, error);
});
mainWindow.webContents.on('preload-error', (event, preloadPath, error) => {
console.error('Preload script error:', preloadPath, error);
});
mainWindow.webContents.on('console-message', (event, level, message, line, sourceId) => {
console.log('Renderer Console:', message);
});
mainWindow.webContents.on(
"console-message",
(event, level, message, line, sourceId) => {
console.log("Renderer Console:", line, sourceId, message);
},
);
// Enable remote debugging when in dev mode
if (isDev) {