forked from trent_larson/crowd-funder-for-time-pwa
commit working index.html
This commit is contained in:
@@ -22,13 +22,27 @@ async function main() {
|
||||
// Copy web files to www directory
|
||||
const wwwDir = path.join(distElectronDir, 'www');
|
||||
await fs.copy(webDist, wwwDir);
|
||||
console.log('Copied web files to:', wwwDir);
|
||||
|
||||
// Copy and process main.js
|
||||
const mainJsSrc = path.resolve(__dirname, '../src/electron/main.js');
|
||||
const mainJsDest = path.join(distElectronDir, 'main.js');
|
||||
await fs.copy(mainJsSrc, mainJsDest);
|
||||
console.log('Copied main.js to:', mainJsDest);
|
||||
// Fix paths in index.html
|
||||
const indexPath = path.join(wwwDir, 'index.html');
|
||||
let indexContent = await fs.readFile(indexPath, 'utf8');
|
||||
indexContent = indexContent.replace(/src="\//g, 'src="./');
|
||||
indexContent = indexContent.replace(/href="\//g, 'href="./');
|
||||
indexContent = indexContent.replace(/\/assets\//g, './assets/'); // Fix asset paths with explicit relative path
|
||||
indexContent = indexContent.replace(/\.\/\.\/assets\//g, './assets/'); // Clean up any double dots
|
||||
await fs.writeFile(indexPath, indexContent);
|
||||
|
||||
console.log('Copied and fixed web files in:', wwwDir);
|
||||
|
||||
// Copy main process files
|
||||
const mainProcessFiles = [
|
||||
'src/electron/main.js',
|
||||
];
|
||||
|
||||
for (const file of mainProcessFiles) {
|
||||
const destPath = path.join(distElectronDir, path.basename(file));
|
||||
await fs.copy(file, destPath);
|
||||
}
|
||||
|
||||
// Create the production package.json
|
||||
const devPackageJson = require('../package.json');
|
||||
@@ -38,7 +52,7 @@ async function main() {
|
||||
description: devPackageJson.description,
|
||||
author: devPackageJson.author,
|
||||
main: 'main.js',
|
||||
private: true
|
||||
private: true,
|
||||
};
|
||||
|
||||
await fs.writeJson(
|
||||
|
||||
Reference in New Issue
Block a user