feat(auto-updater): manual DMG download flow for macOS - #93
Conversation
The upcoming manual-download update flow needs to match a release asset's arch by filename, which only works if every dmg/zip unambiguously carries its arch - not the case under electron-builder's default naming, which omits the suffix for its "default" arch.
isNewerVersion compares two dotted version strings; pickMacAsset picks the release asset matching the running arch. Both are Electron-free so they're unit-testable directly, without the electron stub the rest of test/*.test.mjs needs.
Squirrel.Mac (electron-updater's mac apply mechanism) requires the app to be signed with a real Developer ID certificate. This build only ad-hoc signs (package.json mac.identity), so the existing electron-updater-driven flow can check for updates on macOS but can't apply them - see #92. On darwin, checkForUpdates now hits the GitHub releases API directly, downloads the arch-matched .dmg with progress reported the same way as the existing electron-updater download-progress events, and quitAndInstall quits the app and opens the mounted DMG so the user can drag it into Applications themselves. Windows/linux keep the existing electron-updater/NSIS path untouched.
Static value read at preload time, not an IPC round-trip. Needed by the update-notification toast to show mac-appropriate install copy.
There's no silent relaunch on macOS - the downloaded toast now tells mac users to open the installer and drag it into Applications, instead of the Windows "Restart Now" copy that doesn't apply there.
…ix version comparison for pre-release tags Co-authored-by: alpha <156915037+alpha5611331@users.noreply.github.com>
…rough Adds coverage for the semver pre-release precedence and the GitHub-provided digest field that Gitar's review fix (9c9e8d3) added to isNewerVersion and pickMacAsset - the original tests only covered plain integer versions and didn't touch either.
|
@gitar-bot |
Yes — the three findings raised earlier (DMG integrity verification, pre-release version parsing, and stale download cleanup) are all fixed in 9c9e8d3, with tests added in 5b479a5. The PR is approved and lint/type-check/tests are passing, so it should be good to merge. |
Code Review ✅ Approved 3 resolved / 3 findingsAdds a manual DMG download and installation flow for macOS to bypass ad-hoc signing limitations, addressing previous issues with temp file cleanup, DMG integrity verification, and pre-release version handling. No open issues remain. ✅ 3 resolved✅ Edge Case: Downloaded DMGs accumulate in temp and are never cleaned up
✅ Security: Downloaded DMG is opened without any integrity verification
✅ Edge Case: isNewerVersion mishandles pre-release/non-numeric version tags
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|
Good job 👍 |
Closes #92
Summary
mac.identity: "-",notarize: falsein package.json - deliberate for now, see macOS auto-update doesn't apply (unsigned/ad-hoc build blocks Squirrel.Mac) #92). So the existing electron-updater flow can check for updates on macOS but can't apply them.checkForUpdatesnow hits the GitHub releases API directly, downloads the arch-matched.dmg, andquitAndInstallquits the app and opens the mounted DMG so the user can drag it into Applications themselves. Windows/linux keep the existing electron-updater/NSIS flow untouched.mac.artifactNameis now pinned to${productName}-${version}-${arch}.${ext}so every release asset unambiguously carries its arch (needed for matching, takes effect from the next published release onward).Test plan
pnpm lintpnpm build(tsc -b + vite build)pnpm run electron:build-mainpnpm test:main- all existing checks plus newmac-update-utilsuite passshell.openPath, DMG mount, quit) - this was developed on Windows, so only static review + the pure-function unit tests (isNewerVersion,pickMacAsset) exercised it. Please sanity-check on a Mac before the next release ships.