Skip to content

Commit 4088b13

Browse files
committed
feat(osx): Optional DMG background
1 parent f657155 commit 4088b13

File tree

7 files changed

+20
-11
lines changed

7 files changed

+20
-11
lines changed

.idea/dictionaries/develar.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ See all [appdmg options](https://www.npmjs.com/package/appdmg#json-specification
6969
| Name | Description
7070
| --- | ---
7171
| icon | <a name="OsXBuildOptions-icon"></a>The path to icon, which will be shown when mounted (default: `build/icon.icns`).
72-
| 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.
72+
| 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>
7373
| 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).
7474
| 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>
7575
| 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>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"tmp": "0.0.28"
8282
},
8383
"optionalDependencies": {
84-
"appdmg-tf": "^0.3.11"
84+
"appdmg": "^0.4.2"
8585
},
8686
"config": {
8787
"pre-git": {

src/metadata.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ export interface OsXBuildOptions extends PlatformSpecificBuildOptions {
153153
readonly icon?: string | null
154154

155155
/*
156-
The path to background (default: `build/background.png`). The resolution of this file determines the resolution of the installer window.
156+
The path to background (default: `build/background.png` if exists). The resolution of this file determines the resolution of the installer window.
157+
If background is not specified, use `window.size`, see [specification](https://github.com/LinusU/node-appdmg#json-specification).
157158
*/
158159
readonly background?: string | null
159160

src/osxPackager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ export default class OsXPackager extends PlatformPackager<OsXBuildOptions> {
164164
{
165165
"x": 130, "y": 220, "type": "file"
166166
}
167-
]
167+
],
168+
format: this.devMetadata.build.compression === "store" ? "UDRO" : "UDBZ",
168169
}, this.customBuildOptions)
169170

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

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

200-
const emitter = require("appdmg-tf")(dmgOptions)
200+
const emitter = require("appdmg")(dmgOptions)
201201
emitter.on("error", reject)
202202
emitter.on("finish", () => resolve())
203203
if (debug.enabled) {

test/src/osxPackagerTest.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import test from "./helpers/avaEx"
22
import { assertPack, platform, modifyPackageJson, signed } from "./helpers/packTester"
33
import { Platform } from "out"
44
import OsXPackager from "out/osxPackager"
5-
import { move, writeFile } from "fs-extra-p"
5+
import { move, writeFile, deleteFile } from "fs-extra-p"
66
import * as path from "path"
77
import { BuildInfo, PackagerOptions } from "out/platformPackager"
88
import { Promise as BluebirdPromise } from "bluebird"
@@ -135,9 +135,9 @@ test.ifOsx("entitlements in build dir", () => {
135135
})
136136
})
137137

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

142142
test.ifOsx("custom background", () => {
143143
let platformPackager: CheckingOsXPackager = null

typings/appdmg.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ declare namespace appdmg {
1515
}
1616
}
1717

18-
declare module "appdmg-tf" {
18+
declare module "appdmg" {
1919
import { EventEmitter } from "events"
2020

2121
function appdmg(options: appdmg.Options): EventEmitter

0 commit comments

Comments
 (0)