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

fix(maker-wix): version with pre-release tag breaks app start #3855

Merged
merged 3 commits into from
Feb 19, 2025

Conversation

ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Feb 14, 2025

Resolves

Details

  1. @electron-forge/maker-wix replaces the version (semantic version) with the windows compatible, making it an invalid semantic version, e.g. 1.2.3-beta -> 1.2.3.0
  2. electron-wix-msi expects a semantic version as an input option and then separates it into 2 versions:
  3. StubExecutable expects the app to be in app-{semver} folder and search to the latest semantic version
  4. Because @electron-forge/maker-wix passes an invalid semantic version as the version StubExecutable cannot run the app

As a result, building with a version with a pre-release tag or build metadata results in an unstartable installation.

Notes

I kept the note. But I think it can be moved to the documentation instead.

@ShGKme ShGKme requested a review from a team as a code owner February 14, 2025 20:28
`electron-wix-msi` expects a valid semantic version as the `version` option.

It then uses the original semantic version as an app version and transformed to windows compatible version as the MSI version separately.

Providing windows compatible but invalid semantic version breaks app running via StubExecutable.

Signed-off-by: Grigorii K. Shartsev <[email protected]>
@ShGKme ShGKme force-pushed the fix/maker-wix--semantic-version branch from 034a401 to 1001ded Compare February 14, 2025 21:34
Comment on lines 25 to 26
const { version } = packageJSON;
if (version.includes('-') || version.includes('+')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs import semver from 'semver' above but:

Suggested change
const { version } = packageJSON;
if (version.includes('-') || version.includes('+')) {
const { version } = packageJSON;
const parsed = semver.prerelease(version);
if (Array.isArray(parsed) && parsed.length > 0) {

Copy link
Contributor Author

@ShGKme ShGKme Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with using semver package to check the version components (I thought about it but didn't want to add it to have one more dependency just to show one log message).

But I intentionally added a new check for + because prerelease is not the only part of semver that will be changed. There is also build part.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks! Didn't realize there was that distinction between + and - so I had to re-read the spec.

Since we're already including semver in many places across the monorepo (including @electron-forge/core, I think adding the dep to maker-wix is kind of "free" in a sense!

@erickzhao erickzhao added this pull request to the merge queue Feb 19, 2025
Merged via the queue into electron:main with commit 4571cb5 Feb 19, 2025
12 checks passed
@ShGKme ShGKme deleted the fix/maker-wix--semantic-version branch February 19, 2025 19:07
@ShGKme
Copy link
Contributor Author

ShGKme commented Feb 19, 2025

I was just about to push squashed commit ༼ つ ◕_◕ ༽つ

Thanks for a quick review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants