Skip to content

Commit

Permalink
Added Redux DevTools and React Developer Tools in dev build (#3750)
Browse files Browse the repository at this point in the history
* Checkin `npm install --package-lock-only` changes

* Added `Redux DevTools` and `React Developer Tools` in dev build
  • Loading branch information
ramki-bruno authored Jan 8, 2025
1 parent 39e8b66 commit c5de234
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 15 deletions.
108 changes: 95 additions & 13 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion packages/bruno-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
},
"devDependencies": {
"electron": "33.2.1",
"electron-builder": "25.1.8"
"electron-builder": "25.1.8",
"electron-devtools-installer": "^4.0.0"
}
}
20 changes: 19 additions & 1 deletion packages/bruno-electron/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (isDev) {
}

const { format } = require('url');
const { BrowserWindow, app, Menu, ipcMain } = require('electron');
const { BrowserWindow, app, session, Menu, ipcMain } = require('electron');
const { setContentSecurityPolicy } = require('electron-util');

const menuTemplate = require('./app/menu-template');
Expand Down Expand Up @@ -51,6 +51,24 @@ let watcher;

// Prepare the renderer once the app is ready
app.on('ready', async () => {

if (isDev) {
const { installExtension, REDUX_DEVTOOLS, REACT_DEVELOPER_TOOLS } = require('electron-devtools-installer');
try {
const extensions = await installExtension([REDUX_DEVTOOLS, REACT_DEVELOPER_TOOLS], {
loadExtensionOptions: {allowFileAccess: true},
})
console.log(`Added Extensions: ${extensions.map(ext => ext.name).join(", ")}`)
await require("node:timers/promises").setTimeout(1000);
session.defaultSession.getAllExtensions().map((ext) => {
console.log(`Loading Extension: ${ext.name}`);
session.defaultSession.loadExtension(ext.path)
});
} catch (err) {
console.error('An error occurred while loading extensions: ', err);
}
}

Menu.setApplicationMenu(menu);
const { maximized, x, y, width, height } = loadWindowState();

Expand Down

0 comments on commit c5de234

Please sign in to comment.