Skip to content

Commit

Permalink
Add electron auto updater
Browse files Browse the repository at this point in the history
  • Loading branch information
cr0wst committed Apr 2, 2024
1 parent abf63f0 commit 14a3373
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
30 changes: 27 additions & 3 deletions package-lock.json

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

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "bunnet",
"version": "1.2.0",
"version": "1.2.1",
"description": "A simple RabbitMQ client for developers",
"main": "./out/main/index.js",
"author": "Steve Crow [email protected]",
"homepage": "https://bunnetapp.com",
"license": "GPL-3.0-or-later",
"repository": "github:cr0wst/bunnet",
"scripts": {
"format": "prettier --plugin prettier-plugin-svelte --write .",
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
Expand All @@ -26,7 +27,8 @@
"@zerodevx/svelte-json-view": "^1.0.9",
"axios": "^1.6.8",
"electron-settings": "^4.0.2",
"electron-updater": "^6.1.7"
"electron-updater": "^6.1.7",
"update-electron-app": "^3.0.0"
},
"devDependencies": {
"@electron-toolkit/eslint-config-prettier": "^2.0.0",
Expand Down
13 changes: 11 additions & 2 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { WindowStateManager } from './WindowStateManager'
import { RabbitConnection } from './rabbit'
import appConfig from 'electron-settings'

import { updateElectronApp } from 'update-electron-app'

updateElectronApp()
const windowStateManager = new WindowStateManager('main')

let rabbitConnection: RabbitConnection | null = null
Expand Down Expand Up @@ -50,7 +53,10 @@ function createWindow(): void {
// Save all of the details for the connection
mainWindow.on('close', () => {
if (rabbitConnection) {
appConfig.setSync(`rabbitConnection.${rabbitConnection.getConnection().id}`, rabbitConnection.getState())
appConfig.setSync(
`rabbitConnection.${rabbitConnection.getConnection().id}`,
rabbitConnection.getState()
)
}
})
}
Expand Down Expand Up @@ -119,7 +125,10 @@ ipcMain.handle('rabbit-disconnect', async () => {
}

await rabbitConnection.disconnect()
appConfig.setSync(`rabbitConnection.${rabbitConnection.getConnection().id}`, rabbitConnection.getState())
appConfig.setSync(
`rabbitConnection.${rabbitConnection.getConnection().id}`,
rabbitConnection.getState()
)
rabbitConnection = null
})

Expand Down

0 comments on commit 14a3373

Please sign in to comment.