-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
extraMetadata: version
must be semver on Windows, but can be whatever on macOS and Linux
#7173
Comments
faern
added a commit
to mullvad/electron-builder
that referenced
this issue
Oct 4, 2022
faern
added a commit
to mullvad/electron-builder
that referenced
this issue
Oct 4, 2022
faern
added a commit
to mullvad/electron-builder
that referenced
this issue
Oct 4, 2022
faern
added a commit
to mullvad/electron-builder
that referenced
this issue
Oct 18, 2022
faern
added a commit
to mullvad/electron-builder
that referenced
this issue
Oct 19, 2022
mmaietta
pushed a commit
that referenced
this issue
Oct 21, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TLDR:
The following way of injecting our app's version works fine on macOS and Linux, but fails with a semver error on Windows:
distribution.js
:On Windows this results in:
Expected
I expect the version format requirements to 1) be the same everywhere and 2) not need to be semver formatted.
Longer explanation
The version format of our app is
$year.$number
. For example2022.6
. Theversion
field inpackage.json
requires this field to be semver. So we have always appended a.0
to our version to make it semver compatible. We have a hacky build script that injects this intopackage.json
when building. We now wanted to improve on this hack. We found a solution that works sooo nicely on Linux and macOS, but fails on Windows (see TLDR).In our actual code, the version string in
distribution.js
is not hardcoded, it looks like:To use existing Rust code to compute the desired product version. This includes git hashes etc for development builds. Normal versions are
2022.6-beta1
,2022.7-dev-afafaf
(-dev-$git_hash[0..6]
), but that is besides the point here.We don't see any reason why applications must have versions compatible with semver. Semver is mostly for libraries IMO, where there is API compatibility to think about.
The relevant code that crashes is here:
electron-builder/packages/app-builder-lib/src/appInfo.ts
Line 79 in 8166267
major
,minor
andpatch
. So it could just split the version string at.
and iterate, assigning the first part tomajor
, the second tominor
and so fourth, but default to version0
when the string split iterator comes to an end.Why allowing non-semver?
So
package.json
requires the version to be correct semver. Why shouldextraMetadata: version
not when what it does is override theversion
field inpackage.json
, they should have the same requirements? I'd argue no! Becausepackage.json
is for both libraries and applications, but most commonly for libraries. And for libraries it makes a lot of sense to version with semver. npmjs.com would be very messy if packages did not adhere to one versioning scheme. However,electron-builder
is for applications, and not libraries. Applications need not be semver, because they don't have a public API to provide stability guarantees for)The text was updated successfully, but these errors were encountered: