35 lines
790 B
JavaScript
35 lines
790 B
JavaScript
const { app, BrowserWindow } = require("electron");
|
|
const path = require("path");
|
|
|
|
const isDev = process.env.NODE_ENV === "development";
|
|
|
|
function createWindow() {
|
|
const win = new BrowserWindow({
|
|
width: 1200,
|
|
height: 800,
|
|
webPreferences: {
|
|
preload: path.join(__dirname, "preload.js"),
|
|
contextIsolation: true,
|
|
nodeIntegration: false,
|
|
},
|
|
});
|
|
|
|
if (isDev) {
|
|
win.loadURL("http://localhost:5173");
|
|
win.webContents.openDevTools();
|
|
} else {
|
|
win.loadFile(path.join(__dirname, "../renderer/dist/index.html"));
|
|
}
|
|
}
|
|
|
|
app.whenReady().then(() => {
|
|
require("./db/init");
|
|
require("./ipc/templateIpc");
|
|
require("./ipc/generateIpc");
|
|
createWindow();
|
|
});
|
|
|
|
app.on("window-all-closed", () => {
|
|
if (process.platform !== "darwin") app.quit();
|
|
});
|