First of all, I have done a much complex analysis for each possible solution mentioned in Week 1. Right now, this is the current configuration for each platform:
Windows - NSIS Installer
macOS - DMG Package
Linux - AppImage
Let’s compare autoUpdater vs. electron-updater
autoUpdater
As part of Electron, the autoUpdater module provides native integration with Electron applications, reducing the need for additional dependencies.
You configure the package to build release metadata (
latest.yml
)
Electron builder uploads the actual release targets and metadata files to the configured target (except for generic server, where you have to upload manually)
You configure the Electron application to use auto-updates, which queries the publish server for possible new releases
Auto-updatable Targets:
macOS: DMG.
Linux: AppImage, DEB and RPM.
Windows: NSIS. (Squirrel.Windows is not supported**)**
A dedicated release server is not required.
Code signature validation not only on macOS, but also on Windows.
All required metadata files and artifacts are produced and published automatically.
Download progress and staged rollouts supported on all platforms.
Different providers supported out of the box: (GitHub Releases, Amazon S3, DigitalOcean Spaces, Keygen and generic HTTP(s) server).
github repository:
GitHub - electron-userland/electron-builder: A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
Pros for autoUpdater:
Native Integration
Handles updates for Windows and macOS using platform-specific tools (Squirrel.Windows and Squirrel.Mac).
Cons for autoUpdater:
The built-in autoUpdater has fewer features compared to electron-updater, particularly around real-time updates and delta updates.
Good support but less active development compared to electron-updater.
Pros for electron-updater:
Supports real-time updates, delta updates, and more flexible configuration options.
Well-supported with active development and a large user base and more contributors.
Cons:
Requires adding a separate package to the project, which introduces an extra dependency.
I have tried to use both for this project, it was easier for me to use electron-updater. I have noticed we do not support Squirrel as of now, and the built-in autoUpdater needs it. For Real-Time Updates,
electron-updater
is the better choice due to its advanced features,
Second of all, I managed to integrate the electron-updater module with the application and tried testing it. In package.json, I added the local server under “publish”. The autoupdater requires three files: the executable, the file “latest.yml”, and a file that end with the extension “.blockmap”. The
blockmap
file is crucial for supporting delta updates, which allows the application to download only the changed parts of the new version, rather than the entire new version.
I have added the autoUpdater from electron-updater together with the following events:
checking-for-update
update-available
update-not-available
error
download-progress
update-downloaded (for now, it waits 15 seconds, then quits and installs, but in the app you can just close it)
The rest of the events just print in the terminal, they do not have a custom behavior for now. The autoUpdater is set to search for updates in the beginning of the application and from 15 to 15 seconds (for development purposes only, in production the value will be much bigger). In code, the updates will be checked after the application is ready (inside the start method from ElectronAppWrapper).
Demo:
Week 3.mkv
(6.8 MB)
For Week 4, my focus will be on the user experience and formatting code. I also have to make that pop-up error (shown in the demo after updating) disappear.
I had a difficult time trying to test it locally, without the need to build the application every time. I was still unable to make it work on the dev env. I have searched on the internet trying to find solutions/examples, I have tried each one of them, but without success. This was the error that I was receiving:
skip checkforupdates because application is not packed and dev update config is not forced
. Solutions that I have tried until now:
creating the file named “dev-app-update.yml” and setting the variable
updateConfigPath
(of autoUpdater) to the path of the file
using
checkForUpdates
instead of
checkForUpdatesAndNotify
,
calling the method
setFeedURL
when using autoUpdater
For your build issues, please consider creating a post on the forum providing details about it. I'm not familiar with that particular error message you mentioned but with full context and log we can probably figure it out.
electron-updater indeed seems like a good choice. As I understand it can use our release files on GitHub, without having to create a special server for it, is that correct?