diff --git a/docs/Options.md b/docs/Options.md index fd46234d5b7..ec953e67324 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -92,7 +92,7 @@ MAS (Mac Application Store) specific options (in addition to `build.osx`). | --- | --- | iconUrl |

A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). Defaults to the Electron icon.

Please note — [local icon file url is not accepted](https://github.com/atom/grunt-electron-installer/issues/73), must be https/http.

| loadingGif |

The path to a .gif file to display during install. build/install-spinner.gif will be used if exists (it is a recommended way to set) (otherwise [default](https://github.com/electron/windows-installer/blob/master/resources/install-spinner.gif)).

-| noMsi | Whether to create an MSI installer. Defaults to `true` (MSI is not created). +| msi | Whether to create an MSI installer. Defaults to `false` (MSI is not created). | remoteReleases | A URL to your existing updates. If given, these will be downloaded to create delta updates. | remoteToken | Authentication token for remote updates diff --git a/package.json b/package.json index 00defe96c78..bd937ff83d0 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "deep-assign": "^2.0.0", "electron-osx-sign-tf": "0.4.0-beta.0", "electron-packager-tf": "^7.0.2-beta.0", - "electron-winstaller-fixed": "~2.7.1", + "electron-winstaller-fixed": "~2.8.0", "fs-extra-p": "^1.0.1", "globby": "^4.0.0", "hosted-git-info": "^2.1.4", @@ -106,8 +106,8 @@ "should": "^8.3.1", "ts-babel": "^0.8.6", "tsconfig-glob": "^0.4.3", - "tslint": "^3.10.0-dev.1", - "typescript": "1.9.0-dev.20160511", + "tslint": "3.10.0-dev.1", + "typescript": "1.9.0-dev.20160513", "whitespace": "^2.0.0" }, "babel": { diff --git a/src/metadata.ts b/src/metadata.ts index 2b758711cf1..eb0cb011202 100755 --- a/src/metadata.ts +++ b/src/metadata.ts @@ -231,9 +231,9 @@ export interface WinBuildOptions extends PlatformSpecificBuildOptions { readonly loadingGif?: string | null /* - Whether to create an MSI installer. Defaults to `true` (MSI is not created). + Whether to create an MSI installer. Defaults to `false` (MSI is not created). */ - readonly noMsi?: boolean + readonly msi?: boolean /* A URL to your existing updates. If given, these will be downloaded to create delta updates. diff --git a/src/winPackager.ts b/src/winPackager.ts index 3579244a307..cd5cb858a44 100644 --- a/src/winPackager.ts +++ b/src/winPackager.ts @@ -4,7 +4,7 @@ import { PlatformPackager, BuildInfo } from "./platformPackager" import { Platform, WinBuildOptions } from "./metadata" import * as path from "path" import { log, statOrNull, warn } from "./util" -import { deleteFile, rename, emptyDir, open, close, read, move } from "fs-extra-p" +import { deleteFile, emptyDir, open, close, read, move } from "fs-extra-p" import { sign } from "signcode-tf" import ElectronPackagerOptions = ElectronPackager.ElectronPackagerOptions @@ -103,7 +103,7 @@ export class WinPackager extends PlatformPackager { } } - protected async computeEffectiveDistOptions(appOutDir: string, installerOutDir: string, packOptions: ElectronPackagerOptions): Promise { + protected async computeEffectiveDistOptions(appOutDir: string, installerOutDir: string, packOptions: ElectronPackagerOptions, setupExeName: string): Promise { let iconUrl = this.customBuildOptions.iconUrl || this.devMetadata.build.iconUrl if (iconUrl == null) { if (this.info.repositoryInfo != null) { @@ -132,6 +132,7 @@ export class WinPackager extends PlatformPackager { name: this.metadata.name, productName: this.appName, exe: this.appName + ".exe", + setupExe: setupExeName, title: this.appName, appDirectory: appOutDir, outputDirectory: installerOutDir, @@ -145,7 +146,7 @@ export class WinPackager extends PlatformPackager { fixUpPaths: false, skipUpdateIcon: true, usePackageJson: false, - noMsi: true, + msi: false, extraMetadataSpecs: projectUrl == null ? null : `\n ${projectUrl}`, copyright: packOptions["app-copyright"], sign: { @@ -166,17 +167,15 @@ export class WinPackager extends PlatformPackager { async packageInDistributableFormat(outDir: string, appOutDir: string, arch: string, packOptions: ElectronPackagerOptions): Promise { const installerOutDir = computeDistOut(outDir, arch) const winstaller = require("electron-winstaller-fixed") - await winstaller.createWindowsInstaller(await this.computeEffectiveDistOptions(appOutDir, installerOutDir, packOptions)) - const version = this.metadata.version const archSuffix = arch === "x64" ? "" : ("-" + arch) - const nupkgPath = `${this.metadata.name}-${winstaller.convertVersion(version)}-full.nupkg` + const setupExeName = `${this.appName} Setup ${version}${archSuffix}.exe` - this.dispatchArtifactCreated(path.join(installerOutDir, nupkgPath)) - this.dispatchArtifactCreated(path.join(installerOutDir, "RELEASES")) + await winstaller.createWindowsInstaller(await this.computeEffectiveDistOptions(appOutDir, installerOutDir, packOptions, setupExeName)) - await rename(path.join(installerOutDir, "Setup.exe"), path.join(installerOutDir, `${this.appName} Setup ${version}${archSuffix}.exe`)) - .then(it => this.dispatchArtifactCreated(it, `${this.metadata.name}-Setup-${version}${archSuffix}.exe`)) + this.dispatchArtifactCreated(path.join(installerOutDir, setupExeName), `${this.metadata.name}-Setup-${version}${archSuffix}.exe`) + this.dispatchArtifactCreated(path.join(installerOutDir, `${this.metadata.name}-${winstaller.convertVersion(version)}-full.nupkg`)) + this.dispatchArtifactCreated(path.join(installerOutDir, "RELEASES")) } } @@ -235,13 +234,18 @@ export function computeDistOut(outDir: string, arch: string): string { function checkConflictingOptions(options: any) { for (let name of ["outputDirectory", "appDirectory", "exe", "fixUpPaths", "usePackageJson", "extraFileSpecs", "extraMetadataSpecs", "skipUpdateIcon", "setupExe"]) { - if (name! in options) { + if (name in options) { throw new Error(`Option ${name} is ignored, do not specify it.`) } } - const noMsi = options.noMsi - if (noMsi != null && typeof noMsi !== "boolean") { - throw new Error(`noMsi expected to be boolean value, but string '"${noMsi}"' was specified`) + if ("noMsi" in options) { + warn(`noMsi is deprecated, please specify as "msi": true if you want to create an MSI installer`) + options.msi = !options.noMsi + } + + const msi = options.msi + if (msi != null && typeof msi !== "boolean") { + throw new Error(`msi expected to be boolean value, but string '"${msi}"' was specified`) } } \ No newline at end of file diff --git a/test/src/winPackagerTest.ts b/test/src/winPackagerTest.ts index 68759580374..daa3fdd4722 100755 --- a/test/src/winPackagerTest.ts +++ b/test/src/winPackagerTest.ts @@ -50,14 +50,14 @@ test.ifDevOrWinCi("win f", () => { }) }) -test.ifNotCiOsx("noMsi as string", t => t.throws(assertPack("test-app-one", platform(Platform.WINDOWS), +test.ifNotCiOsx("msi as string", t => t.throws(assertPack("test-app-one", platform(Platform.WINDOWS), { tempDirCreated: it => modifyPackageJson(it, data => { data.build.win = { - noMsi: "false", + msi: "false", } }) - }), `noMsi expected to be boolean value, but string '"false"' was specified`) + }), `msi expected to be boolean value, but string '"false"' was specified`) ) test("detect install-spinner", () => { @@ -115,7 +115,7 @@ class CheckingWinPackager extends WinPackager { // skip pack const installerOutDir = computeDistOut(outDir, arch) const packOptions = this.computePackOptions(outDir, arch) - this.effectiveDistOptions = await this.computeEffectiveDistOptions(this.computeAppOutDir(outDir, arch), installerOutDir, packOptions) + this.effectiveDistOptions = await this.computeEffectiveDistOptions(this.computeAppOutDir(outDir, arch), installerOutDir, packOptions, "Foo.exe") } async packageInDistributableFormat(outDir: string, appOutDir: string, arch: string, packOptions: ElectronPackagerOptions): Promise {