From cc8278a87f91b0c6fc8bb368805deb56a3e2e1d5 Mon Sep 17 00:00:00 2001 From: develar Date: Wed, 18 May 2016 08:17:45 +0200 Subject: [PATCH] fix: Trouble building delta package for Squirrel.Windows on OSX Closes #407 --- docs/Options.md | 2 +- package.json | 12 ++++++------ src/winPackager.ts | 14 ++++++++++---- test/src/winPackagerTest.ts | 29 +++++++++++++++++++++-------- 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/docs/Options.md b/docs/Options.md index 4175c781799..394a366da9d 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -69,7 +69,7 @@ See all [appdmg options](https://www.npmjs.com/package/appdmg#json-specification | Name | Description | --- | --- | icon | The path to icon, which will be shown when mounted (default: `build/icon.icns`). -| background |

The path to background (default: build/background.png if exists). The resolution of this file determines the resolution of the installer window. If background is not specified, use window.size, see [specification](https://github.com/LinusU/node-appdmg#json-specification)).

+| background |

The path to background (default: build/background.png if exists). The resolution of this file determines the resolution of the installer window. If background is not specified, use window.size, see [specification](https://github.com/LinusU/node-appdmg#json-specification).

| target | Target package type: list of `default`, `dmg`, `zip`, `mas`, `7z`. Defaults to `default` (dmg and zip for Squirrel.Mac). | identity |

The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](https://github.com/electron-userland/electron-builder/wiki/Code-Signing). MAS installer identity is specified in the [.build.mas](#MasBuildOptions-identity).

| entitlements |

The path to entitlements file for signing the app. build/osx.entitlements will be used if exists (it is a recommended way to set). MAS entitlements is specified in the [.build.mas](#MasBuildOptions-entitlements).

diff --git a/package.json b/package.json index 06cd5037760..08c045bc438 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "dependencies": { "7zip-bin": "^1.0.5", "asar": "^0.11.0", - "bluebird": "^3.3.5", + "bluebird": "^3.4.0", "chalk": "^1.1.3", "command-line-args": "^2.1.6", "compare-versions": "^2.0.1", @@ -66,10 +66,10 @@ "deep-assign": "^2.0.0", "electron-osx-sign-tf": "0.4.0-beta.0", "electron-packager-tf": "~7.1.0", - "electron-winstaller-fixed": "~2.8.2", + "electron-winstaller-fixed": "~2.8.3", "fs-extra-p": "^1.0.1", "globby": "^4.0.0", - "hosted-git-info": "^2.1.4", + "hosted-git-info": "^2.1.5", "image-size": "^0.5.0", "lodash.template": "^4.2.5", "mime": "^1.3.4", @@ -81,7 +81,7 @@ "tmp": "0.0.28" }, "optionalDependencies": { - "appdmg": "^0.4.2" + "appdmg": "^0.4.3" }, "config": { "pre-git": { @@ -94,7 +94,7 @@ "devDependencies": { "ava-tf": "^0.12.4-beta.6", "babel-plugin-array-includes": "^2.0.3", - "babel-plugin-transform-es2015-parameters": "^6.8.0", + "babel-plugin-transform-es2015-parameters": "^6.9.0", "babel-plugin-transform-es2015-spread": "^6.8.0", "decompress-zip": "^0.3.0", "electron-download": "^2.1.2", @@ -106,7 +106,7 @@ "should": "^8.3.1", "ts-babel": "^0.8.6", "tsconfig-glob": "^0.4.3", - "tslint": "3.10.0-dev.1", + "tslint": "3.10.2", "typescript": "1.9.0-dev.20160515", "whitespace": "^2.0.0" }, diff --git a/src/winPackager.ts b/src/winPackager.ts index cd5cb858a44..5e0070b950e 100644 --- a/src/winPackager.ts +++ b/src/winPackager.ts @@ -103,7 +103,7 @@ export class WinPackager extends PlatformPackager { } } - protected async computeEffectiveDistOptions(appOutDir: string, installerOutDir: string, packOptions: ElectronPackagerOptions, setupExeName: string): 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) { @@ -171,10 +171,16 @@ export class WinPackager extends PlatformPackager { const archSuffix = arch === "x64" ? "" : ("-" + arch) const setupExeName = `${this.appName} Setup ${version}${archSuffix}.exe` - await winstaller.createWindowsInstaller(await this.computeEffectiveDistOptions(appOutDir, installerOutDir, packOptions, setupExeName)) - + const distOptions = await this.computeEffectiveDistOptions(appOutDir, installerOutDir, packOptions, setupExeName) + await winstaller.createWindowsInstaller(distOptions) 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`)) + + const packagePrefix = `${this.metadata.name}-${winstaller.convertVersion(version)}-` + this.dispatchArtifactCreated(path.join(installerOutDir, `${packagePrefix}full.nupkg`)) + if (distOptions.remoteReleases != null) { + this.dispatchArtifactCreated(path.join(installerOutDir, `${packagePrefix}delta.nupkg`)) + } + this.dispatchArtifactCreated(path.join(installerOutDir, "RELEASES")) } } diff --git a/test/src/winPackagerTest.ts b/test/src/winPackagerTest.ts index daa3fdd4722..a6c398de45f 100755 --- a/test/src/winPackagerTest.ts +++ b/test/src/winPackagerTest.ts @@ -14,20 +14,33 @@ const __awaiter = require("out/awaiter") test.ifNotCiOsx("win", () => assertPack("test-app-one", signed({ platform: [Platform.WINDOWS], - arch: "all", + arch: "x64", }), { - tempDirCreated: process.env.TEST_DELTA ? it => modifyPackageJson(it, data => { - data.build.win = { - remoteReleases: "https://github.com/develar/__test-app-releases", - } - }) : null, expectedArtifacts: [ "RELEASES", + "TestApp Setup 1.1.0.exe", + "TestApp-1.1.0-full.nupkg" + ], + } +)) + +test.ifNotCiOsx("delta", () => assertPack("test-app-one", { + platform: [Platform.WINDOWS], + arch: "ia32", + devMetadata: { + build: { + win: { + remoteReleases: "https://github.com/develar/__test-app-releases", + } + } + }, + }, + { + expectedArtifacts: [ "RELEASES", "TestApp Setup 1.1.0-ia32.exe", - "TestApp Setup 1.1.0.exe", - "TestApp-1.1.0-full.nupkg", + "TestApp-1.1.0-delta.nupkg", "TestApp-1.1.0-full.nupkg" ], }