Skip to content

Commit

Permalink
feat(osx): Optional DMG background
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed May 17, 2016
1 parent f657155 commit 4088b13
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 deletions.
8 changes: 8 additions & 0 deletions .idea/dictionaries/develar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ See all [appdmg options](https://www.npmjs.com/package/appdmg#json-specification
| Name | Description
| --- | ---
| icon | <a name="OsXBuildOptions-icon"></a>The path to icon, which will be shown when mounted (default: `build/icon.icns`).
| background | <a name="OsXBuildOptions-background"></a>The path to background (default: `build/background.png`). The resolution of this file determines the resolution of the installer window.
| background | <a name="OsXBuildOptions-background"></a><p>The path to background (default: <code>build/background.png</code> if exists). The resolution of this file determines the resolution of the installer window. If background is not specified, use <code>window.size</code>, see [specification](https://github.com/LinusU/node-appdmg#json-specification)).</p>
| target | <a name="OsXBuildOptions-target"></a>Target package type: list of `default`, `dmg`, `zip`, `mas`, `7z`. Defaults to `default` (dmg and zip for Squirrel.Mac).
| identity | <a name="OsXBuildOptions-identity"></a><p>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).</p>
| entitlements | <a name="OsXBuildOptions-entitlements"></a><p>The path to entitlements file for signing the app. <code>build/osx.entitlements</code> will be used if exists (it is a recommended way to set). MAS entitlements is specified in the [.build.mas](#MasBuildOptions-entitlements).</p>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"tmp": "0.0.28"
},
"optionalDependencies": {
"appdmg-tf": "^0.3.11"
"appdmg": "^0.4.2"
},
"config": {
"pre-git": {
Expand Down
3 changes: 2 additions & 1 deletion src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export interface OsXBuildOptions extends PlatformSpecificBuildOptions {
readonly icon?: string | null

/*
The path to background (default: `build/background.png`). The resolution of this file determines the resolution of the installer window.
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).
*/
readonly background?: string | null

Expand Down
6 changes: 3 additions & 3 deletions src/osxPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ export default class OsXPackager extends PlatformPackager<OsXBuildOptions> {
{
"x": 130, "y": 220, "type": "file"
}
]
],
format: this.devMetadata.build.compression === "store" ? "UDRO" : "UDBZ",
}, this.customBuildOptions)

if (!("background" in this.customBuildOptions)) {
Expand All @@ -190,14 +191,13 @@ export default class OsXPackager extends PlatformPackager<OsXBuildOptions> {
target: artifactPath,
basepath: this.projectDir,
specification: await this.computeEffectiveDistOptions(appOutDir),
compression: this.devMetadata.build.compression === "store" ? "NONE" : "UDBZ"
}

if (debug.enabled) {
debug(`appdmg: ${JSON.stringify(dmgOptions, <any>null, 2)}`)
}

const emitter = require("appdmg-tf")(dmgOptions)
const emitter = require("appdmg")(dmgOptions)
emitter.on("error", reject)
emitter.on("finish", () => resolve())
if (debug.enabled) {
Expand Down
8 changes: 4 additions & 4 deletions test/src/osxPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from "./helpers/avaEx"
import { assertPack, platform, modifyPackageJson, signed } from "./helpers/packTester"
import { Platform } from "out"
import OsXPackager from "out/osxPackager"
import { move, writeFile } from "fs-extra-p"
import { move, writeFile, deleteFile } from "fs-extra-p"
import * as path from "path"
import { BuildInfo, PackagerOptions } from "out/platformPackager"
import { Promise as BluebirdPromise } from "bluebird"
Expand Down Expand Up @@ -135,9 +135,9 @@ test.ifOsx("entitlements in build dir", () => {
})
})

// test.ifOsx("no background", (t: any) => assertPack("test-app-one", platform(Platform.OSX), {
// tempDirCreated: projectDir => deleteFile(path.join(projectDir, "build", "background.png"))
// }))
test.ifOsx("no background", (t: any) => assertPack("test-app-one", platform(Platform.OSX), {
tempDirCreated: projectDir => deleteFile(path.join(projectDir, "build", "background.png"))
}))

test.ifOsx("custom background", () => {
let platformPackager: CheckingOsXPackager = null
Expand Down
2 changes: 1 addition & 1 deletion typings/appdmg.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare namespace appdmg {
}
}

declare module "appdmg-tf" {
declare module "appdmg" {
import { EventEmitter } from "events"

function appdmg(options: appdmg.Options): EventEmitter
Expand Down

0 comments on commit 4088b13

Please sign in to comment.