Skip to content

Commit 37aef09

Browse files
committed
Update autoInstaller and package.json settings
1 parent 462ec82 commit 37aef09

File tree

3 files changed

+40
-33
lines changed

3 files changed

+40
-33
lines changed

frontend/main.js

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron');
22
const path = require('path');
33
const { exec } = require('child_process');
44
const fs = require('fs');
5+
6+
// Import autoUpdater from electron-updater
57
const { autoUpdater } = require('electron-updater');
68

79
let mainWindow;
@@ -33,30 +35,10 @@ function createWindow() {
3335
// Check if JAMS is installed
3436
checkJAMSInstallation();
3537

36-
// Check for updates (only in prod mode)
37-
if (!isDev) {
38-
autoUpdater.checkForUpdatesAndNotify();
39-
}
38+
// Check for updates after creating the window
39+
autoUpdater.checkForUpdatesAndNotify();
4040
}
4141

42-
autoUpdater.on('update-available', () => {
43-
mainWindow.webContents.send('update-available');
44-
});
45-
46-
autoUpdater.on('update-downloaded', () => {
47-
mainWindow.webContents.send('update-downloaded');
48-
});
49-
50-
// IPC handler for installing the update
51-
ipcMain.on('install-update', () => {
52-
autoUpdater.quitAndInstall();
53-
});
54-
55-
ipcMain.handle('get-app-version', () => {
56-
return app.getVersion();
57-
});
58-
59-
6042
app.on('ready', createWindow);
6143

6244
app.on('window-all-closed', () => {
@@ -71,6 +53,25 @@ app.on('activate', () => {
7153
}
7254
});
7355

56+
// Listen for update events
57+
autoUpdater.on('update-available', () => {
58+
dialog.showMessageBox({
59+
type: 'info',
60+
title: 'Update available',
61+
message: 'A new version of the application is available. It will be downloaded now.',
62+
});
63+
});
64+
65+
autoUpdater.on('update-downloaded', () => {
66+
dialog.showMessageBox({
67+
type: 'info',
68+
title: 'Update ready',
69+
message: 'A new version of the application has been downloaded. The application will now restart to apply the update.',
70+
}).then(() => {
71+
autoUpdater.quitAndInstall();
72+
});
73+
});
74+
7475
function checkJAMSInstallation() {
7576
const homeDir = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
7677
const binDir = path.join(homeDir, 'bin');

frontend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "JAMS",
3-
"version": "0.1.2",
3+
"version": "0.1.4",
44
"description": "Just a Microbiology System (JAMS) - a suite for analyzing microbiological sequencing data for use on NIH HPC systems (Biowulf)",
55
"main": "main.js",
66
"scripts": {
@@ -55,13 +55,13 @@
5555
"!dist/**",
5656
"!node_modules/**",
5757
"!frontend/**",
58-
"!.git/**",
59-
"!**/.git/**",
60-
"!**/.parcel-cache/**",
61-
"!**/*.dmg",
62-
"!**/*.app/**",
63-
"!**/*.exe",
64-
"!**/node_modules/**"
58+
"!.git/**",
59+
"!**/.git/**",
60+
"!**/.parcel-cache/**",
61+
"!**/*.dmg",
62+
"!**/*.app/**",
63+
"!**/*.exe",
64+
"!**/node_modules/**"
6565
]
6666
}
6767
],
@@ -71,6 +71,12 @@
7171
"owner": "tmossington",
7272
"repo": "JAMS_BW_dev"
7373
}
74-
]
74+
],
75+
"mac": {
76+
"target": "dmg"
77+
},
78+
"win": {
79+
"target": "nsis"
80+
}
7581
}
7682
}

0 commit comments

Comments
 (0)