diff --git a/index.js b/index.js index ba91c3f..4703d3b 100644 --- a/index.js +++ b/index.js @@ -76,9 +76,9 @@ ipcMain.handle("beginHomeProcess", () => { existingHomeProcess.kill('SIGINT'); } - const extractedArchivesPath = path.resolve("./penguinmod/compilation/extraction"); - const homePagePath = path.join(extractedArchivesPath, 'PenguinMod-Home-main'); - const command = `cd ${JSON.stringify(homePagePath)} && npm run dev --force`; + const extractedArchivesPath = path.resolve("./penguinmod/compilation/extractiongui"); + const homePagePath = path.join(extractedArchivesPath, 'penguinmod.github.io-develop'); + const command = `cd ${JSON.stringify(homePagePath)} && npm run start`; const process = childProcess.spawn(command, { shell: true }); existingHomeProcess = process; @@ -94,8 +94,8 @@ ipcMain.handle("beginHomeProcess", () => { }); }); ipcMain.handle("goToHome", () => { - // TODO: we should not use port 5173 - window.loadURL('http://localhost:5173/'); + // TODO: we should not use port 5173 FIXED(?) + window.loadURL('http://localhost:54642/'); }); app.on("window-all-closed", () => { if (existingHomeProcess) { diff --git a/installer.js b/installer.js index f2a3252..53369b0 100644 --- a/installer.js +++ b/installer.js @@ -214,7 +214,7 @@ class Installer { Installer.log('Extracting archive...'); // we made this dir earlier to make sure we could but just remake it to clear its contents - const extractedArchivePath = path.resolve(path.join(filepath, "/extraction")); + const extractedArchivePath = path.resolve(path.join(filepath, "/extractionhome")); Installer.fs.rmSync(extractedArchivePath, { recursive: true, force: true }); Installer.fs.mkdirSync(extractedArchivePath, { recursive: true }); @@ -247,7 +247,7 @@ class Installer { await waitingExtraction; })(); // Install GUI - /* + Installer.log(`Grabbing repository from "${archivePath}"`); await (async () => { let response; @@ -293,7 +293,7 @@ class Installer { Installer.log('Extracting archive...'); // we made this dir earlier to make sure we could but just remake it to clear its contents - const extractedArchivePath = path.resolve(path.join(filepath, "/extraction")); + const extractedArchivePath = path.resolve(path.join(filepath, "/extractiongui")); Installer.fs.rmSync(extractedArchivePath, { recursive: true, force: true }); Installer.fs.mkdirSync(extractedArchivePath, { recursive: true }); @@ -325,18 +325,40 @@ class Installer { }); await waitingExtraction; })(); - // */ + // ---- COMPILATION ---- - const extractedArchivesPath = path.resolve(path.join(filepath, "/extraction")); + const extractedHomeArchivesPath = path.resolve(path.join(filepath, "/extractionhome")); + const extractedGuiArchivesPath = path.resolve(path.join(filepath, "/extractiongui")); + // Compile Home Page - const homePagePath = path.join(extractedArchivesPath, 'PenguinMod-Home-main'); - Installer.log('Downloading all dependencies for Home, please wait...'); - // we cant actually compile svelte locally, so we will just run in dev later - await Installer.exec(`cd ${JSON.stringify(homePagePath)} && npm i --force`); + const homePagePath = path.join(extractedHomeArchivesPath, 'PenguinMod-Home-main'); + Installer.log('Downloading all dependencies for Home, please wait...'); + // we cant actually compile svelte locally, so we will just run in dev later + try { + const result = await Installer.exec(`cd ${JSON.stringify(homePagePath)} && npm i --force`); + if (result && result.error) { + Installer.log('Dependency install failed: ' + JSON.stringify(result)); + throw new Error('Dependency install failed: ' + JSON.stringify(result)); + } + } catch (err) { + Installer.log('Dependency install threw: ' + (err && err.stack ? err.stack : err)); + throw err; + } // Compile GUI page - /* - // */ + const editorPagePath = path.join(extractedGuiArchivesPath, 'penguinmod.github.io-develop'); + Installer.log('Downloading all dependencies for Editor, please wait...'); + // we cant actually compile svelte locally, so we will just run in dev later + try { + const result = await Installer.exec(`cd ${JSON.stringify(editorPagePath)} && npm i --force`); + if (result && result.error) { + Installer.log('Dependency install failed: ' + JSON.stringify(result)); + throw new Error('Dependency install failed: ' + JSON.stringify(result)); + } + } catch (err) { + Installer.log('Dependency install threw: ' + (err && err.stack ? err.stack : err)); + throw err; + } // create the verification file (used by the base program to see if penguinmod is even installed at all) Installer.log('Creating verification...'); diff --git a/preload.js b/preload.js index 1c1e221..16e4ac8 100644 --- a/preload.js +++ b/preload.js @@ -83,8 +83,8 @@ window.addEventListener("DOMContentLoaded", () => { console.log('Attempting to launch'); // TODO: we should start on a port that is not 5173 (should be exclusive to launcher so not 5174 either) // api needs to be able to handle that btw - const runningPort = 5173; - const queryIntervalUrl = `http://localhost:${runningPort}/dot_blue.png`; + const runningPort = 54642; + const queryIntervalUrl = `http://localhost:${runningPort}/favicon.png`; console.log('running'); ipcRenderer.invoke('beginHomeProcess'); // continously try to access a file until it succeeds (this is because running as dev never exits)