Skip to content

Commit

Permalink
feat(desktop): add electron-devtools-installer for Vue.js debugging s…
Browse files Browse the repository at this point in the history
…upport
  • Loading branch information
Red-Asuka committed Dec 18, 2024
1 parent 48e6661 commit 8bf0a4a
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"drizzle-kit": "^0.28.1",
"electron": "^33.2.0",
"electron-builder": "^26.0.0-alpha.6",
"electron-devtools-installer": "^3.2.1",
"electron-vite": "^2.3.0",
"jsdom": "^25.0.1",
"postcss": "^8.4.48",
Expand Down
8 changes: 7 additions & 1 deletion apps/desktop/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { join } from 'node:path'
import { electronApp, is, optimizer } from '@electron-toolkit/utils'
import { eq } from 'drizzle-orm'
import { app, BrowserWindow, ipcMain, shell } from 'electron'
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
import icon from '../../resources/icon.png?asset'
import { db, execute, runMigrate } from '../database/db.main'
import { type SelectSettings, settings } from '../database/schemas/settings'
Expand Down Expand Up @@ -48,8 +49,13 @@ async function createWindow() {

mainWindow.on('ready-to-show', () => {
mainWindow.show()
})

mainWindow.webContents.on('did-frame-finish-load', async () => {
if (is.dev) {
mainWindow.webContents.openDevTools()
installExtension(VUEJS_DEVTOOLS)
.then(() => mainWindow.webContents.openDevTools())
.catch(err => console.error('An error occurred: ', err))
}
})

Expand Down
58 changes: 58 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 8bf0a4a

Please sign in to comment.