{
"name": "scrumboard",
"productName": "scrumboard",
"version": "1.0.0",
"description": "My Electron application description",
"main": ".webpack/main",
"build": {
"icon": "./src/assets/icons/128x128.ico",
"extraResources": [
{
"from": "server",
"to": "server"
}
]
},
"scripts": {
"start": "electron-forge start",
"node-start": "node server/server.js",
"node-dev": "nodemon server/server.js",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\"",
"dev": "concurrently \"npm:node-dev\" \"npm start\""
},
}
const { app, BrowserWindow } = require('electron');
const path = require('node:path');
const { spawn } = require('child_process');
if (require('electron-squirrel-startup')) {
app.quit();
}
let serverProcess;
const startServer = () => {
serverProcess = spawn('npm', ['run', 'node-start'], { shell: true });
};
const stopServer = () => {
if (serverProcess) {
serverProcess.kill('SIGTERM');
serverProcess = null;
}
};
const createWindow = () => {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
icon: path.join(__dirname, '../src/assets/128x128.png'),
webPreferences: {
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
},
});
mainWindow.loadURL(`${MAIN_WINDOW_WEBPACK_ENTRY}#/scrumboard`);
mainWindow.setMenuBarVisibility(false);
mainWindow.maximize();
};
app.whenReady().then(() => {
createWindow();
startServer();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
app.on('before-quit', () => {
stopServer();
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
https://github.com/artem0011011000111001/SimpleOS