Skip to content

Commit

Permalink
test: tiffutil error #69
Browse files Browse the repository at this point in the history
prepare to fix #69 — but it requires fix ds-store as well, not only appdmg
  • Loading branch information
develar committed Apr 1, 2016
1 parent a71a979 commit de216b1
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 28 deletions.
18 changes: 9 additions & 9 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ See [OS X options](https://www.npmjs.com/package/appdmg#json-specification) and
Here documented only `electron-builder` specific options:

<!-- do not edit. start of generated block -->
<a class="anchor" href="#AppMetadata" aria-hidden="true"></a>
<a class="anchor" id="user-content-AppMetadata" href="#AppMetadata" aria-hidden="true"></a>
# Application `package.json`
| Name | Description
| --- | ---
| <a class="anchor" href="#AppMetadata-name" aria-hidden="true"></a>name | The application name.
| <a class="anchor" href="#AppMetadata-productName" aria-hidden="true"></a>productName | <p>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}).</p>
<a class="anchor" href="#DevMetadata" aria-hidden="true"></a>
| <a class="anchor" id="user-content-AppMetadata-name" href="#AppMetadata-name" aria-hidden="true"></a>name | The application name.
| <a class="anchor" id="user-content-AppMetadata-productName" href="#AppMetadata-productName" aria-hidden="true"></a>productName | <p>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}).</p>
<a class="anchor" id="user-content-DevMetadata" href="#DevMetadata" aria-hidden="true"></a>
# Development `package.json`
| Name | Description
| --- | ---
| <a class="anchor" href="#DevMetadata-build" aria-hidden="true"></a>build | See [BuildMetadata](#BuildMetadata).
<a class="anchor" href="#BuildMetadata" aria-hidden="true"></a>
| <a class="anchor" id="user-content-DevMetadata-build" href="#DevMetadata-build" aria-hidden="true"></a>build | See [BuildMetadata](#BuildMetadata).
<a class="anchor" id="user-content-BuildMetadata" href="#BuildMetadata" aria-hidden="true"></a>
## `.build`
| Name | Description
| --- | ---
| <a class="anchor" href="#BuildMetadata-iconUrl" aria-hidden="true"></a>iconUrl | <p>*windows-only.* A URL to an ICO file to use as the application icon (displayed in Control Panel &gt; Programs and Features). Defaults to the Atom icon.</p> <p>Please note — [local icon file url is not accepted](https://github.com/atom/grunt-electron-installer/issues/73), must be https/http.</p> <ul> <li>If you don’t plan to build windows installer, you can omit it.</li> <li>If your project repository is public on GitHub, it will be <code>https://raw.githubusercontent.com/${info.user}/${info.project}/master/build/icon.ico</code> by default.</li> </ul>
| <a class="anchor" href="#BuildMetadata-productName" aria-hidden="true"></a>productName | See [AppMetadata.productName](#AppMetadata-productName).
| <a class="anchor" href="#BuildMetadata-extraResources" aria-hidden="true"></a>extraResources | <p>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 (<code>Contents/Resources</code> for OS X).</p> <p>You can use <code>${os}</code> (expanded to osx, linux or win according to current platform) and <code>${arch}</code> in the pattern.</p> <p>If directory matched, all contents are copied. So, you can just specify <code>foo</code> to copy <code>&lt;project_dir&gt;/foo</code> directory.</p> <p>May be specified in the platform options (i.e. in the <code>build.osx</code>).</p>
| <a class="anchor" id="user-content-BuildMetadata-iconUrl" href="#BuildMetadata-iconUrl" aria-hidden="true"></a>iconUrl | <p>*windows-only.* A URL to an ICO file to use as the application icon (displayed in Control Panel &gt; Programs and Features). Defaults to the Atom icon.</p> <p>Please note — [local icon file url is not accepted](https://github.com/atom/grunt-electron-installer/issues/73), must be https/http.</p> <ul> <li>If you don’t plan to build windows installer, you can omit it.</li> <li>If your project repository is public on GitHub, it will be <code>https://raw.githubusercontent.com/${info.user}/${info.project}/master/build/icon.ico</code> by default.</li> </ul>
| <a class="anchor" id="user-content-BuildMetadata-productName" href="#BuildMetadata-productName" aria-hidden="true"></a>productName | See [AppMetadata.productName](#AppMetadata-productName).
| <a class="anchor" id="user-content-BuildMetadata-extraResources" href="#BuildMetadata-extraResources" aria-hidden="true"></a>extraResources | <p>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 (<code>Contents/Resources</code> for OS X).</p> <p>You can use <code>${os}</code> (expanded to osx, linux or win according to current platform) and <code>${arch}</code> in the pattern.</p> <p>If directory matched, all contents are copied. So, you can just specify <code>foo</code> to copy <code>&lt;project_dir&gt;/foo</code> directory.</p> <p>May be specified in the platform options (i.e. in the <code>build.osx</code>).</p>

<!-- end of generated block -->
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
"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",
"globby": "^4.0.0",
"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",
Expand All @@ -77,19 +77,19 @@
"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",
"plist": "^1.2.0",
"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": [
Expand Down
16 changes: 14 additions & 2 deletions src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -55,14 +56,13 @@ export default class MacPackager extends PlatformPackager<OsXBuildOptions> {
packageInDistributableFormat(outDir: string, appOutDir: string): Promise<any> {
const artifactPath = path.join(appOutDir, `${this.appName}-${this.metadata.version}.dmg`)
return BluebirdPromise.all([
new BluebirdPromise<any>((resolve, reject) => {
new BluebirdPromise<any>(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"
Expand All @@ -73,6 +73,18 @@ export default class MacPackager extends PlatformPackager<OsXBuildOptions> {
]
}, 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")({
Expand Down
2 changes: 1 addition & 1 deletion src/platformPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
20 changes: 11 additions & 9 deletions test/src/osxPackagerTest.ts
Original file line number Diff line number Diff line change
@@ -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"))
})
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"))
// }))
2 changes: 1 addition & 1 deletion typings/electron-packager.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ declare namespace ElectronPackager {
}
}

declare module "electron-packager-tf" {
declare module "electron-packager" {
const packager: ElectronPackager.Packager;
export = packager;
}
Expand Down

0 comments on commit de216b1

Please sign in to comment.