diff --git a/packages/maker/appx/src/MakerAppX.ts b/packages/maker/appx/src/MakerAppX.ts index 84d1b2c1e7..9b6a057775 100644 --- a/packages/maker/appx/src/MakerAppX.ts +++ b/packages/maker/appx/src/MakerAppX.ts @@ -110,7 +110,7 @@ export default class MakerAppX extends MakerBase { opts.devCert = await createDefaultCertificate(opts.publisher, { certFilePath: outPath, program: opts }); } - if (opts.packageVersion.includes('-')) { + if (/[-+]/.test(opts.packageVersion)) { if (opts.makeVersionWinStoreCompatible) { opts.packageVersion = this.normalizeWindowsVersion(opts.packageVersion); } else { diff --git a/packages/maker/base/src/Maker.ts b/packages/maker/base/src/Maker.ts index 0f135b5ea7..672e88c73e 100644 --- a/packages/maker/base/src/Maker.ts +++ b/packages/maker/base/src/Maker.ts @@ -174,7 +174,7 @@ export default abstract class Maker implements IForgeMaker { * prerelease information for use in Windows apps. */ normalizeWindowsVersion(version: string): string { - const noPrerelease = version.replace(/-.*/, ''); + const noPrerelease = version.replace(/[-+].*/, ''); return `${noPrerelease}.0`; } } diff --git a/packages/maker/base/test/version_spec.ts b/packages/maker/base/test/version_spec.ts index 184ead56ea..9b2dbe4e60 100644 --- a/packages/maker/base/test/version_spec.ts +++ b/packages/maker/base/test/version_spec.ts @@ -16,6 +16,11 @@ describe('normalizeWindowsVersion', () => { expect(maker.normalizeWindowsVersion(version)).to.equal('1.0.0.0'); } }); + it('removes everything after the plus sign', () => { + for (const version of ['1.0.0-alpha+001', '1.0.0+20130313144700', '1.0.0-beta+exp.sha.5114f85', '1.0.0+21AF26D3----117B344092BD']) { + expect(maker.normalizeWindowsVersion(version)).to.equal('1.0.0.0'); + } + }); it('does not truncate the version when there is no dash', () => { expect(maker.normalizeWindowsVersion('2.0.0')).to.equal('2.0.0.0'); });