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
https://www.electron.build
MIT License
13.61k stars 1.74k forks source link

getLatestVersion() needs to be more tolerant of missing latest.yml files #3874

Closed grantcv1 closed 5 years ago

grantcv1 commented 5 years ago

Electron-builder: 20.15.0 Electron-updater: 4,0.6

FWIW, I'm using Electron-builder 20.15.0 and cannot move forward as all subsequent versions of electon-builder won't copy over the node_modules contained within any submodules (#3665, #3185)

Background: I'm working on the auto-updater. I have a private repository and have the GH_TOKEN and all that working fine (after a bit of a struggle).

I use autoUpdater.setFileURL() as the auto-updater was looking in the wrong project without it. (My main release project, for permission reasons, is a submodule rather than the primary module. Despite setting the repo in the publish settings to be my release submodule, the auto-updater was looking in the main module, from which I build, for releases.atom rather than in my release repo.)

Problem: I have older releases that are missing the latest.yml file. These releases were generated by earlier versions of electron-builder. What I am finding is that the version of the auto-updater I am using is not resilient to this file being missing in earlier versions, sometime much earlier versions. In my case, the problem versions are way back and are neither the currently installed version or the new version, they are an old version a dozen or so releases in the past.

I get the following transcript:

annot find latest.yml in the release https://github.com/Xcential-Corporation/LegisPro-Sunrise/releases/tag/v3.1.6-beta.6 at newError (C:\Program Files\LegisPro\resources\app.asar\Workspace\node_modules\builder-util-runtime\src\index.ts:29:17) at C:\Program Files\LegisPro\resources\app.asar\Workspace\node_modules\electron-updater\src\providers\PrivateGitHubProvider.ts:34:13 From previous event: at PrivateGitHubProvider.getLatestVersion (C:\Program Files\LegisPro\resources\app.asar\Workspace\node_modules\electron-updater\src\providers\PrivateGitHubProvider.ts:26:25) at C:\Program Files\LegisPro\resources\app.asar\Workspace\node_modules\electron-updater\src\AppUpdater.ts:347:26 at Generator.next () at processImmediate (internal/timers.js:443:21) From previous event: at NsisUpdater.getUpdateInfoAndProvider (C:\Program Files\LegisPro\resources\app.asar\Workspace\node_modules\electron-updater\src\AppUpdater.ts:336:43) at C:\Program Files\LegisPro\resources\app.asar\Workspace\node_modules\electron-updater\src\AppUpdater.ts:363:31 at Generator.next () From previous event: at NsisUpdater.doCheckForUpdates (C:\Program Files\LegisPro\resources\app.asar\Workspace\node_modules\electron-updater\src\AppUpdater.ts:360:34) at NsisUpdater.checkForUpdates (C:\Program Files\LegisPro\resources\app.asar\Workspace\node_modules\electron-updater\src\AppUpdater.ts:220:35) at NsisUpdater.checkForUpdatesAndNotify (C:\Program Files\LegisPro\resources\app.asar\Workspace\node_modules\electron-updater\src\AppUpdater.ts:249:41) at App. (C:\Program Files\LegisPro\resources\app.asar\Workspace\scripts\Main.js:78:15) at App.emit (events.js:199:15)

I have forcibly set allowPrereleases to false and it seems to help a bit. Regardless, the code should be more graceful about handling a missing latest.yml file, especially as earlier versions of electron-builder weren't already producing this file.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.