From 76166af3ab6f95b83cacb68e20ff2e437825dea6 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 1 Dec 2017 11:15:26 +1100 Subject: [PATCH] feat(maker): add Wix support --- README.md | 1 + package.json | 3 ++- src/makers/win32/wix.js | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/makers/win32/wix.js diff --git a/README.md b/README.md index 17e85814da..c648856abe 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,7 @@ config object: | `zip` | All | Zips your packaged application | None | Yes | `zip` on Darwin/Linux | | `squirrel` | Windows | Generates an installer and `.nupkg` files for Squirrel.Windows | [`electronWinstallerConfig`](https://github.com/electron/windows-installer#usage) | Yes | | | `appx` | Windows | Generates a Windows Store package | [`windowsStoreConfig`](https://github.com/felixrieseberg/electron-windows-store#programmatic-usage) | No | | +| `wix` | Windows | Generates a traditional MSI file | [`electronWixMSIConfig`](https://github.com/felixrieseberg/electron-wix-msi#configuration) | No | [Wix Toolit](https://github.com/felixrieseberg/electron-wix-msi#prerequisites) | | `dmg` | Darwin | Generates a DMG file | [`electronInstallerDMG`](https://github.com/mongodb-js/electron-installer-dmg#api) | No | | | `deb` | Linux | Generates a Debian package | [`electronInstallerDebian`](https://github.com/unindented/electron-installer-debian#options) | Yes | [`fakeroot` and `dpkg`](https://github.com/unindented/electron-installer-debian#requirements) | | `rpm` | Linux | Generates an RPM package | [`electronInstallerRedhat`](https://github.com/unindented/electron-installer-redhat#options) | Yes | [`rpm`](https://github.com/unindented/electron-installer-redhatn#requirements) | diff --git a/package.json b/package.json index d78ce659c2..9a71dda51a 100644 --- a/package.json +++ b/package.json @@ -158,7 +158,8 @@ "electron-installer-flatpak": "^0.8.0", "electron-installer-redhat": "^0.5.0", "electron-windows-store": "^0.12.0", - "electron-winstaller": "^2.5.0" + "electron-winstaller": "^2.5.0", + "electron-wix-msi": "^1.2.3" }, "engines": { "node": ">= 6.0" diff --git a/src/makers/win32/wix.js b/src/makers/win32/wix.js new file mode 100644 index 0000000000..dad174f347 --- /dev/null +++ b/src/makers/win32/wix.js @@ -0,0 +1,31 @@ +import path from 'path'; + +import { ensureDirectory } from '../../util/ensure-output'; +import configFn from '../../util/config-fn'; +import isInstalled from '../../util/is-installed'; +import { getDistinguishedNameFromAuthor } from './appx'; + +export const isSupportedOnCurrentPlatform = async () => isInstalled('electron-wix-msi'); + +export default async ({ dir, appName, targetArch, forgeConfig, packageJSON }) => { + const { MSICreator } = require('electron-wix-msi'); + + const outPath = path.resolve(dir, `../make/wix/${targetArch}`); + await ensureDirectory(outPath); + + const creator = new MSICreator(Object.assign({ + description: packageJSON.description, + name: appName, + version: packageJSON.version, + manufacturer: getDistinguishedNameFromAuthor(packageJSON.author).substr(3), + exe: `${appName}.exe`, + }, configFn(forgeConfig.electronWixMSIConfig, targetArch), { + appDirectory: dir, + outputDirectory: outPath, + })); + + await creator.create(); + const { msiFile } = await creator.compile(); + + return [msiFile]; +};