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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/maker/wix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"chalk": "^4.0.0",
"electron-wix-msi": "^5.1.3",
"log-symbols": "^4.0.0",
"parse-author": "^2.0.0"
"parse-author": "^2.0.0",
"semver": "^7.2.1"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/wix/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface MakerWixConfig {
*/
upgradeCode?: string;
/**
* The app's version
* The app's version. It must be a valid semantic version.
*/
version?: string;
/**
Expand Down
12 changes: 8 additions & 4 deletions packages/maker/wix/src/MakerWix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ForgePlatform } from '@electron-forge/shared-types';
import chalk from 'chalk';
import { MSICreator, MSICreatorOptions } from 'electron-wix-msi/lib/creator';
import logSymbols from 'log-symbols';
import semver from 'semver';

import { MakerWixConfig } from './Config';
import getNameFromAuthor from './util/author-name';
Expand All @@ -22,13 +23,16 @@ export default class MakerWix extends MakerBase<MakerWixConfig> {
const outPath = path.resolve(makeDir, `wix/${targetArch}`);
await this.ensureDirectory(outPath);

let { version } = packageJSON;
if (version.includes('-')) {
const { version } = packageJSON;
const parsed = semver.parse(version);
if ((Array.isArray(parsed?.prerelease) && parsed.prerelease.length > 0) || (Array.isArray(parsed?.build) && parsed.build.length > 0)) {
console.warn(
logSymbols.warning,
chalk.yellow('WARNING: WiX distributables do not handle prerelease information in the app version, removing it from the MSI')
chalk.yellow(
'WARNING: MSI packages follow Windows version format "major.minor.build.revision".\n' +
`The provided semantic version "${version}" will be transformed to Windows version format. Prerelease component will not be retained.`
)
);
version = this.normalizeWindowsVersion(version);
}

const creator = new MSICreator({
Expand Down