Skip to content
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
"electron-installer-dmg": "^5.0.1",
"electron-installer-redhat": "^3.2.0",
"electron-installer-snap": "^5.2.0",
"electron-windows-msix": "^2.0.4",
"electron-windows-store": "^2.1.0",
"electron-winstaller": "^5.3.0",
"electron-wix-msi": "^5.1.3"
Expand Down
1 change: 1 addition & 0 deletions packages/api/core/spec/slow/api.slow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ describe.each([
'@electron-forge/maker-deb',
'@electron-forge/maker-dmg',
'@electron-forge/maker-flatpak',
'@electron-forge/maker-msix',
'@electron-forge/maker-rpm',
'@electron-forge/maker-snap',
'@electron-forge/maker-squirrel',
Expand Down
1 change: 1 addition & 0 deletions packages/maker/appx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"node": ">= 16.4.0"
},
"dependencies": {
"@electron-forge/core-utils": "7.9.0",
"@electron-forge/maker-base": "7.9.0",
"@electron-forge/shared-types": "7.9.0",
"cross-spawn": "^7.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/maker/appx/src/MakerAppX.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'node:path';

import { getNameFromAuthor } from '@electron-forge/core-utils';
import { MakerBase, MakerOptions } from '@electron-forge/maker-base';
import { ForgePlatform } from '@electron-forge/shared-types';
import resolveCommand from 'cross-spawn/lib/util/resolveCommand';
Expand All @@ -11,7 +12,6 @@ import {
import fs from 'fs-extra';

import { MakerAppXConfig } from './Config';
import getNameFromAuthor from './util/author-name';

// NB: This is not a typo, we require AppXs to be built on 64-bit
// but if we're running in a 32-bit node.js process, we're going to
Expand Down
27 changes: 27 additions & 0 deletions packages/maker/msix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## maker-msix

> [!IMPORTANT]
> This module is _experimental_ and is subject to breaking changes between releases.
> See GitHub Releases change notes for migration instructions.

`@electron-forge/maker-msix` builds `.msix` packages, which can be distributed directly or via the Windows Store.

You can only build the MSIX target on Windows machines with the Windows 10 SDK installed.

Configuration options are documented in [`MakerMSIXConfig`](https://js.electronforge.io/interfaces/_electron_forge_maker_msix.MakerMSIXConfig.html).

maker-msix utilizes @electron/windows-sign via the `windowsSignOptions` property. See the [windows-sign documentation](https://github.com/electron/windows-sign/blob/main/README.md) for details.

```javascript
{
name: '@electron-forge/maker-msix',
config: {
manifestVariables: {
publisher: 'Electron Dev'
},
windowsSignOptions: {
certificatePassword: '12345'
}
}
}
```
32 changes: 32 additions & 0 deletions packages/maker/msix/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@electron-forge/maker-msix",
"version": "7.8.3",
"description": "MSIX maker for Electron Forge",
"repository": "https://github.com/electron/forge",
"author": "Jan Hannemann",
"license": "MIT",
"main": "dist/MakerMSIX.js",
"typings": "dist/MakerMSIX.d.ts",
"devDependencies": {
"vitest": "^3.1.3"
},
"engines": {
"node": ">= 16.4.0"
},
"dependencies": {
"@electron-forge/core-utils": "7.9.0",
"@electron-forge/maker-base": "7.9.0",
"@electron-forge/shared-types": "7.9.0",
"cross-spawn": "^7.0.3",
"electron-windows-msix": "^2.0.4",
"fs-extra": "^10.0.0",
"parse-author": "^2.0.0"
},
"publishConfig": {
"access": "public"
},
"files": [
"dist",
"src"
]
}
30 changes: 30 additions & 0 deletions packages/maker/msix/spec/util/arch.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { describe, expect, it } from 'vitest';

import { toMsixArch } from '../../src/util/arch';

describe('toMsixArch', () => {
[
{
arch: 'x64',
expectedMsixArch: 'x64',
},
{
arch: 'arm64',
expectedMsixArch: 'arm64',
},
{
arch: 'ia32',
expectedMsixArch: 'x86',
},
].forEach((test) => {
it(`${test.arch} converts to ${test.expectedMsixArch}`, () => {
expect(toMsixArch(test.arch)).toBe(test.expectedMsixArch);
});
});

it(`throw for arch values without a match`, () => {
expect(() => toMsixArch('armv7l')).toThrowError(
'Invalid architecture: armv7l. Must be one of x64, arm64 or ia32',
);
});
});
10 changes: 10 additions & 0 deletions packages/maker/msix/src/Config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { PackagingOptions } from 'electron-windows-msix';

/**
* The configuration object for the MSIX maker.
* The `outputDir` and `appDir` parameters are preconfigured by Forge so that the
* Maker uses the package output and can be then used to publish the app.
*
* @see https://github.com/bitdisaster/electron-windows-msix/blob/master/src/types.ts
*/
export type MakerMsixConfig = Omit<PackagingOptions, 'outputDir' | 'appDir'>;
49 changes: 49 additions & 0 deletions packages/maker/msix/src/MakerMSIX.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { getNameFromAuthor } from '@electron-forge/core-utils';
import { MakerBase, MakerOptions } from '@electron-forge/maker-base';
import { ForgePlatform } from '@electron-forge/shared-types';
import { packageMSIX } from 'electron-windows-msix';

import { MakerMsixConfig } from './Config';
import { toMsixArch } from './util/arch';

/**
* Creates an MSIX package for your Electron app.
* @experimental
*/
export default class MakerMsix extends MakerBase<MakerMsixConfig> {
name = 'msix';
defaultPlatforms: ForgePlatform[] = ['win32'];

isSupportedOnCurrentPlatform(): boolean {
return process.platform === 'win32';
}

async make({
dir,
makeDir,
targetArch,
packageJSON,
appName,
}: MakerOptions): Promise<string[]> {
const configManifestVariables = this.config.manifestVariables;
const packageOptions = this.config;
delete packageOptions.manifestVariables;

const result = await packageMSIX({
manifestVariables: {
packageDescription: packageJSON.description,
appExecutable: `${appName}.exe`,
packageVersion: packageJSON.version,
publisher: getNameFromAuthor(packageJSON.author),
packageIdentity: appName,
targetArch: toMsixArch(targetArch),
...configManifestVariables,
},
...packageOptions,
appDir: dir,
outputDir: makeDir,
});

return [result.msixPackage];
}
}
21 changes: 21 additions & 0 deletions packages/maker/msix/src/util/arch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
type MsixArch = 'x64' | 'arm64' | 'x86' | 'arm' | '*';

/**
* Converts a Node.JS architecture to the corresponding MSIX architecture.
* Valid Node.js values are x64, arm64, and ia32.
*/
export function toMsixArch(arch: string): MsixArch {
const validArchitectures = ['x64', 'arm64'];

if (arch === 'ia32') {
return 'x86';
}

if (validArchitectures.includes(arch)) {
return arch as MsixArch;
}

throw new Error(
`Invalid architecture: ${arch}. Must be one of ${validArchitectures.join(', ')} or ia32`,
);
}
1 change: 1 addition & 0 deletions packages/maker/wix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"node": ">= 16.4.0"
},
"dependencies": {
"@electron-forge/core-utils": "7.9.0",
"@electron-forge/maker-base": "7.9.0",
"@electron-forge/shared-types": "7.9.0",
"chalk": "^4.0.0",
Expand Down
38 changes: 0 additions & 38 deletions packages/maker/wix/spec/author-name.spec.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/maker/wix/src/MakerWix.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'node:path';

import { getNameFromAuthor } from '@electron-forge/core-utils';
import { MakerBase, MakerOptions } from '@electron-forge/maker-base';
import { ForgePlatform } from '@electron-forge/shared-types';
import chalk from 'chalk';
Expand All @@ -8,7 +9,6 @@ import logSymbols from 'log-symbols';
import semver from 'semver';

import { MakerWixConfig } from './Config';
import getNameFromAuthor from './util/author-name';

export default class MakerWix extends MakerBase<MakerWixConfig> {
name = 'wix';
Expand Down
24 changes: 0 additions & 24 deletions packages/maker/wix/src/util/author-name.ts

This file was deleted.

Loading
Loading