Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand Down
44 changes: 33 additions & 11 deletions installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down Expand Up @@ -247,7 +247,7 @@ class Installer {
await waitingExtraction;
})();
// Install GUI
/*

Installer.log(`Grabbing repository from "${archivePath}"`);
await (async () => {
let response;
Expand Down Expand Up @@ -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 });

Expand Down Expand Up @@ -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...');
Expand Down
4 changes: 2 additions & 2 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down