Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoupdate is overwriting unpublished 0.0.1-beta.10 with published 0.0.1-beta.9 #3360

Closed
semireg opened this issue Oct 2, 2018 · 1 comment
Labels

Comments

@semireg
Copy link

semireg commented Oct 2, 2018

  • Version: 20.28.4
  • electron-updater: 3.1.2
  • Target: Mac

I've published version 0.0.1-beta.1 through 0.0.1-beta.9 of my app. Before publishing 0.0.1-beta.10 I launched and it found and tried to install 0.0.1-beta.9. Is this expected behavior?

Looking at isUpdateAvailable it seems getVersionPreleaseComponents (semver.prerelease) parses "beta.9" into an array consisting of ["beta", 9]. The equality check fails and the method falls through to return default true.

The more I read about semver and prerelease tags the more confused I am. When a channel is assigned via autoUpdater.channel = 'beta' it is hitting the update file beta-mac.yml. However, when it's comparing these prerelease components... shouldn't it instead be comparing the channel (1st element)?

if (currentVersionPrereleaseComponent === latestVersionPrereleaseComponent) {
      // allowDowngrade taken in account only if channel differs
      return isLatestVersionNewer
}

should be something like...

    const currentChannel = currentVersionPrereleaseComponent[0]
    const latestChannel = latestVersionPrereleaseComponent[0]

    if (currentChannel === latestChannel) {
      // allowDowngrade taken in account only if channel differs
      return isLatestVersionNewer
    }

I forked the repo and committed this quick test/fix.

I'm unsure how to test this, though. The electron-builder repo contains many other NPM packages... what is the npm command or package.json format to install electron-updater from a different repo?

This doesn't work:

    "electron-updater": "https://github.com/semireg/electron-builder/tree/semireg-beta-build-num/packages/electron-updater",

I've also tried:

    "electron-updater": "file:../electron-builder/packages/electron-updater",

and then run npm run compile within ../electron-builder and npm install within ../electron-builder/packages/electron-updater.

However, then I get this error when trying to npm install in my electron project:

Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3".

I've spent a few hours trying to update babel to 7, but I'm having all sorts of issues. 👎

@stale
Copy link

stale bot commented Jul 2, 2019

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.

@stale stale bot added the backlog label Jul 2, 2019
@stale stale bot closed this as completed Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant