Skip to content

Commit

Permalink
add dev electron auto-reload
Browse files Browse the repository at this point in the history
  • Loading branch information
henrique-coder committed Jan 22, 2024
1 parent 51a313a commit 9897cda
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const { app, BrowserWindow, ipcMain, shell } = require('electron');
const axios = require('axios');
const path = require('path');
const { format } = require('url');
const reload = require('electron-reload');

let mainWindow;

Expand All @@ -17,7 +20,13 @@ function createWindow() {
mainWindow.removeMenu();
}

app.whenReady().then(createWindow);
app.whenReady().then(() => {
createWindow();
reload(__dirname, {
electron: path.join(__dirname, 'node_modules', '.bin', 'electron'),
awaitWriteFinish: true,
});
});

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
Expand Down
198 changes: 198 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
"dependencies": {
"axios": "^1.6.5",
"electron": "^28.1.4"
},
"devDependencies": {
"electron-reload": "^2.0.0-alpha.1"
}
}

0 comments on commit 9897cda

Please sign in to comment.