From de216b1b0c7f45cb52c9c50b41891ffaeb657301 Mon Sep 17 00:00:00 2001 From: develar Date: Tue, 29 Mar 2016 08:31:33 +0200 Subject: [PATCH] test: tiffutil error #69 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prepare to fix #69 — but it requires fix ds-store as well, not only appdmg --- docs/options.md | 18 +++++++++--------- package.json | 12 ++++++------ src/macPackager.ts | 16 ++++++++++++++-- src/platformPackager.ts | 2 +- test/src/osxPackagerTest.ts | 20 +++++++++++--------- typings/electron-packager.d.ts | 2 +- 6 files changed, 42 insertions(+), 28 deletions(-) diff --git a/docs/options.md b/docs/options.md index ad14251de5f..61da768939e 100644 --- a/docs/options.md +++ b/docs/options.md @@ -35,23 +35,23 @@ See [OS X options](https://www.npmjs.com/package/appdmg#json-specification) and Here documented only `electron-builder` specific options: - + # Application `package.json` | Name | Description | --- | --- -| name | The application name. -| productName |

As [name](#AppMetadata-name), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name}).

- +| name | The application name. +| productName |

As [name](#AppMetadata-name), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name}).

+ # Development `package.json` | Name | Description | --- | --- -| build | See [BuildMetadata](#BuildMetadata). - +| build | See [BuildMetadata](#BuildMetadata). + ## `.build` | Name | Description | --- | --- -| iconUrl |

*windows-only.* A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). Defaults to the Atom icon.

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

-| productName | See [AppMetadata.productName](#AppMetadata-productName). -| extraResources |

A [glob expression](https://www.npmjs.com/package/glob#glob-primer), when specified, copy the file or directory with matching names directly into the app’s directory (Contents/Resources for OS X).

You can use ${os} (expanded to osx, linux or win according to current platform) and ${arch} in the pattern.

If directory matched, all contents are copied. So, you can just specify foo to copy <project_dir>/foo directory.

May be specified in the platform options (i.e. in the build.osx).

+| iconUrl |

*windows-only.* A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). Defaults to the Atom icon.

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

+| productName | See [AppMetadata.productName](#AppMetadata-productName). +| extraResources |

A [glob expression](https://www.npmjs.com/package/glob#glob-primer), when specified, copy the file or directory with matching names directly into the app’s directory (Contents/Resources for OS X).

You can use ${os} (expanded to osx, linux or win according to current platform) and ${arch} in the pattern.

If directory matched, all contents are copied. So, you can just specify foo to copy <project_dir>/foo directory.

May be specified in the platform options (i.e. in the build.osx).

diff --git a/package.json b/package.json index 6d001c8dc99..59cc44bc0cd 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "dependencies": { "bluebird": "^3.3.4", "command-line-args": "^2.1.6", - "electron-packager-tf": "^5.2.4-beta.2", + "electron-packager": "^6.0.0", "electron-winstaller-fixed": "^2.0.6-beta.4", "fs-extra": "^0.26.7", "fs-extra-p": "^0.2.0", @@ -62,7 +62,7 @@ "gm": "^1.21.1", "hosted-git-info": "^2.1.4", "image-size": "^0.5.0", - "lodash.template": "^4.2.2", + "lodash.template": "^4.2.3", "mime": "^1.3.4", "progress": "^1.1.8", "progress-stream": "^1.2.0", @@ -77,7 +77,7 @@ "ava-tf": "^0.12.4-beta.6", "babel-plugin-array-includes": "^2.0.3", "babel-plugin-transform-es2015-parameters": "^6.7.0", - "decompress-zip": "^0.2.0", + "decompress-zip": "^0.3.0", "electron-download": "^2.1.0", "json-parse-helpfulerror": "^1.0.3", "path-sort": "^0.1.0", @@ -85,11 +85,11 @@ "pre-commit": "^1.1.2", "semantic-release": "^4.3.5", "should": "^8.3.0", - "ts-babel": "^0.6.4", - "tsconfig-glob": "^0.4.2", + "ts-babel": "^0.6.5", + "tsconfig-glob": "^0.4.3", "tslint": "next", "typescript": "^1.9.0-dev.20160325", - "validate-commit-msg": "^2.4.1" + "validate-commit-msg": "^2.5.0" }, "babel": { "plugins": [ diff --git a/src/macPackager.ts b/src/macPackager.ts index c9392c54155..b13a1d5b33b 100644 --- a/src/macPackager.ts +++ b/src/macPackager.ts @@ -4,6 +4,7 @@ import * as path from "path" import { Promise as BluebirdPromise } from "bluebird" import { log, spawn } from "./util" import { createKeychain, deleteKeychain, CodeSigningInfo, generateKeychainName, sign } from "./codeSign" +import { stat } from "fs-extra-p" const __awaiter = require("./awaiter") Array.isArray(__awaiter) @@ -55,14 +56,13 @@ export default class MacPackager extends PlatformPackager { packageInDistributableFormat(outDir: string, appOutDir: string): Promise { const artifactPath = path.join(appOutDir, `${this.appName}-${this.metadata.version}.dmg`) return BluebirdPromise.all([ - new BluebirdPromise((resolve, reject) => { + new BluebirdPromise(async (resolve, reject) => { log("Creating DMG") const specification: appdmg.Specification = Object.assign({ title: this.appName, icon: path.join(this.buildResourcesDir, "icon.icns"), "icon-size": 80, - background: path.join(this.buildResourcesDir, "background.png"), contents: [ { "x": 410, "y": 220, "type": "link", "path": "/Applications" @@ -73,6 +73,18 @@ export default class MacPackager extends PlatformPackager { ] }, this.customBuildOptions) + if (this.customBuildOptions == null || !("background" in this.customBuildOptions)) { + const background = path.join(this.buildResourcesDir, "background.png") + try { + if ((await stat(background)).isFile()) { + specification.background = background + } + } + catch (e) { + // ignored + } + } + specification.contents[1].path = path.join(appOutDir, this.appName + ".app") const emitter = require("appdmg")({ diff --git a/src/platformPackager.ts b/src/platformPackager.ts index a11e29f16bb..d721f37ff1d 100644 --- a/src/platformPackager.ts +++ b/src/platformPackager.ts @@ -3,7 +3,7 @@ import { AppMetadata, DevMetadata, Platform, PlatformSpecificBuildOptions, getPr import EventEmitter = NodeJS.EventEmitter import { Promise as BluebirdPromise } from "bluebird" import * as path from "path" -import packager = require("electron-packager-tf") +import packager = require("electron-packager") import globby = require("globby") import { copy } from "fs-extra-p" diff --git a/test/src/osxPackagerTest.ts b/test/src/osxPackagerTest.ts index 5b6e614d52c..15bb0e85498 100644 --- a/test/src/osxPackagerTest.ts +++ b/test/src/osxPackagerTest.ts @@ -1,16 +1,18 @@ import test from "./helpers/avaEx" import { assertPack, platform } from "./helpers/packTester" +// import { deleteFile } from "fs-extra-p" +// import * as path from "path" //noinspection JSUnusedLocalSymbols const __awaiter = require("out/awaiter") -test.ifOsx("mac: two-package.json", () => { - return assertPack("test-app", { - platform: ["darwin"], - arch: "all", - }) -}) +test.ifOsx("mac: two-package.json", () => assertPack("test-app", { + platform: ["darwin"], + arch: "all", +})) -test.ifOsx("mac: one-package.json", () => { - return assertPack("test-app-one", platform("darwin")) -}) \ No newline at end of file +test.ifOsx("mac: one-package.json", () => assertPack("test-app-one", platform("darwin"))) + +// test.ifOsx("no background", (t: any) => assertPack("test-app-one", platform("darwin"), { +// tempDirCreated: projectDir => deleteFile(path.join(projectDir, "build", "background.png")) +// })) \ No newline at end of file diff --git a/typings/electron-packager.d.ts b/typings/electron-packager.d.ts index b6a167332b9..a25e89fc8a7 100644 --- a/typings/electron-packager.d.ts +++ b/typings/electron-packager.d.ts @@ -105,7 +105,7 @@ declare namespace ElectronPackager { } } -declare module "electron-packager-tf" { +declare module "electron-packager" { const packager: ElectronPackager.Packager; export = packager; }