feat: implement electron-updater with event-driven architecture #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request: Auto-Updater Implementation and Version Display
Hi everyone, I'm Alvaro (aka Bryzzen on Discord), a developer from Brazil. Thank you for taking the time to review my PR
🚀 Summary
This PR implements a robust auto-update system using
electron-updater, replacing the legacy manual check. It introduces an event-driven architecture for handling update flows (availability, progress, completion) and exposes the application version to the UI footer. Additionally, it enforces "Clean Code" standards by removing comments from refactored files and ensuring strict MVVM/Service separation where applicable.🛠 Technical Implementation Details
1. Auto-Updater Engine (
backend/updateManager.js)electron-updaterfor handling GH Releases artifacts.autoDownloadset tofalsefor controlled UX (user sees popup -> downloads -> restarts).update-available,download-progress,update-downloaded,error.2. IPC & Main Process (
main.js&preload.js)check-for-updates: Triggers the check mechanism.install-update: CallsautoUpdater.quitAndInstall().get-app-version: Returnsapp.getVersion()for UI display.onUpdateProgress,onUpdateDownloaded,installUpdateto the renderer, maintaining security boundaries (Context Isolation).3. Frontend / GUI (
GUI/js/update.js,ui.js,index.html)ClientUpdateManagerto listen for new IPC events.download-progressevent data (percent, MB transferred/total).update-downloaded.v<version>inindex.html.ui.jsfetches version asynchronously on startup.4. Configuration & CI/CD (
package.json)publishconfiguration forgithubprovider (owner:amiayweb, repo:Hytale-F2P).2.0.2b->2.0.3to comply withsemverstandards required byelectron-updater.🧪 Testing
autoUpdaterskips checks locally (log: Skip checkForUpdates because application is not packed).npm run buildand a valid GitHub Release to fully end-to-end test download/install.v2.0.3appears in the footer.