Skip to content

Commit

Permalink
fix(mac): background image isn't displayed in macOS sierra
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Oct 5, 2016
1 parent 64937b2 commit c16ecad
Show file tree
Hide file tree
Showing 18 changed files with 2,521 additions and 99 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ vendor/**/* filter=lfs diff=lfs merge=lfs -text
*.keychain filter=lfs diff=lfs merge=lfs -text
*.bmp filter=lfs diff=lfs merge=lfs -text
*.asar filter=lfs diff=lfs merge=lfs -text
*.tiff filter=lfs diff=lfs merge=lfs -text
14 changes: 14 additions & 0 deletions .idea/dictionaries/develar.xml

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

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ A complete solution to package and build a ready for distribution Electron app f
* [Windows](https://github.com/electron-userland/electron-builder/wiki/Options#WinBuildOptions-target): NSIS, Squirrel.Windows.
* [Publishing artifacts](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts) to GitHub Releases and Bintray.

[appdmg](https://github.com/LinusU/node-appdmg) are used under the hood.

_Note: `appdmg` (and the platform specific `7zip-bin-*` packages) are `optionalDependencies`, which may require manual install if you have npm configured to [not install optional deps by default](https://docs.npmjs.com/misc/config#optional)._
_Note: Platform specific `7zip-bin-*` packages are `optionalDependencies`, which may require manual install if you have npm configured to [not install optional deps by default](https://docs.npmjs.com/misc/config#optional)._

Real project example — [onshape-desktop-shell](https://github.com/develar/onshape-desktop-shell).

Expand Down
25 changes: 21 additions & 4 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Don't customize paths to background and icon, — just follow conventions.
* [Development package.json](#DevMetadata)
* [.build](#BuildMetadata)
* [.build.dmg](#DmgOptions)
* [.build.dmg.window](#DmgWindow)
* [.build.fileAssociations](#FileAssociation)
* [.build.linux](#LinuxBuildOptions)
* [.build.mac](#MacOptions)
Expand Down Expand Up @@ -86,14 +87,30 @@ Don't customize paths to background and icon, — just follow conventions.
<a name="DmgOptions"></a>
### `.build.dmg`

MacOS DMG specific options.
macOS DMG specific options.

See all [appdmg options](https://www.npmjs.com/package/appdmg#json-specification).
| Name | Description
| --- | ---
| background | <a name="DmgOptions-background"></a><p>The path to background image (default: <code>build/background.tiff</code> or <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>. Default locations expected background size to be 540x380.</p> <p>See [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191).</p>
| backgroundColor | <a name="DmgOptions-backgroundColor"></a>The background color (accepts css colors). Defaults to `#ffffff` (white) if no background image.
| icon | <a name="DmgOptions-icon"></a>The path to DMG icon (volume icon), which will be shown when mounted. Defaults to application icon (`build/icon.icns`).
| iconSize | <a name="DmgOptions-iconSize"></a>The size of all the icons inside the DMG. Defaults to 80.
| iconTextSize | <a name="DmgOptions-iconTextSize"></a>The size of all the icon texts inside the DMG. Defaults to 12.
| contents | <a name="DmgOptions-contents"></a>The content — to customize icon locations.
| format | <a name="DmgOptions-format"></a>The disk image format, one of `UDRW`, `UDRO`, `UDCO`, `UDZO`, `UDBZ`, `ULFO` (lzfse-compressed image (OS X 10.11+ only)). Defaults to `UDBZ` (bzip2-compressed image).
| window | <a name="DmgOptions-window"></a>The DMG windows position and size. See [.build.dmg.window](#DmgWindow).

<a name="DmgWindow"></a>
### `.build.dmg.window`

The DMG windows position and size.

| Name | Description
| --- | ---
| icon | <a name="DmgOptions-icon"></a>The path to DMG icon, which will be shown when mounted. Defaults to `build/icon.icns`.
| background | <a name="DmgOptions-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>
| x | <a name="DmgWindow-x"></a>The X position relative to left of the screen. Defaults to 400.
| y | <a name="DmgWindow-y"></a>The Y position relative to top of the screen. Defaults to 100.
| width | <a name="DmgWindow-width"></a>* The width. Defaults to background image width or 540.
| height | <a name="DmgWindow-height"></a>* The height. Defaults to background image height or 380.

<a name="FileAssociation"></a>
### `.build.fileAssociations`
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"packager",
"pack",
"nsis",
"appdmg",
"app",
"dmg",
"msi",
Expand Down Expand Up @@ -84,6 +83,7 @@
"mime": "^1.3.4",
"minimatch": "^3.0.3",
"normalize-package-data": "^2.3.5",
"parse-color": "^1.0.0",
"plist": "^2.0.1",
"pretty-ms": "^2.1.0",
"progress": "^1.1.8",
Expand All @@ -97,9 +97,6 @@
"uuid-1345": "^0.99.6",
"yargs": "^6.0.0"
},
"optionalDependencies": {
"appdmg-tf": "0.4.9"
},
"config": {
"pre-git": {
"commit-msg": "conventional"
Expand Down Expand Up @@ -148,5 +145,8 @@
"release": {
"verifyConditions": []
},
"typings": "./out/electron-builder.d.ts"
"typings": "./out/electron-builder.d.ts",
"publishConfig": {
"tag": "next"
}
}
75 changes: 68 additions & 7 deletions src/options/macOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,82 @@ export interface MacOptions extends PlatformSpecificBuildOptions {
/*
### `.build.dmg`
MacOS DMG specific options.
See all [appdmg options](https://www.npmjs.com/package/appdmg#json-specification).
macOS DMG specific options.
*/
export interface DmgOptions {
/*
The path to DMG icon, which will be shown when mounted. Defaults to `build/icon.icns`.
The path to background image (default: `build/background.tiff` or `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`. Default locations expected background size to be 540x380.
See [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191).
*/
readonly background?: string | null

/*
The background color (accepts css colors). Defaults to `#ffffff` (white) if no background image.
*/
readonly backgroundColor?: string | null

/*
The path to DMG icon (volume icon), which will be shown when mounted. Defaults to application icon (`build/icon.icns`).
*/
readonly icon?: string | null

/*
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).
The size of all the icons inside the DMG. Defaults to 80.
*/
readonly background?: string | null
readonly iconSize?: number | null

/*
The size of all the icon texts inside the DMG. Defaults to 12.
*/
readonly iconTextSize?: number | null

/*
The content — to customize icon locations.
*/
readonly contents?: Array<DmgContent>

/*
The disk image format, one of `UDRW`, `UDRO`, `UDCO`, `UDZO`, `UDBZ`, `ULFO` (lzfse-compressed image (OS X 10.11+ only)). Defaults to `UDBZ` (bzip2-compressed image).
*/
readonly format?: string

/*
The DMG windows position and size. See [.build.dmg.window](#DmgWindow).
*/
window?: DmgWindow
}

/*
### `.build.dmg.window`
The DMG windows position and size.
*/
export interface DmgWindow {
/*
The X position relative to left of the screen. Defaults to 400.
*/
x?: number
/*
The Y position relative to top of the screen. Defaults to 100.
*/
y?: number
/**
* The width. Defaults to background image width or 540.
*/
width?: number
/**
* The height. Defaults to background image height or 380.
*/
height?: number
}

export interface DmgContent {
x: number
y: number
type?: "link" | "file"
path?: string
}

/*
Expand Down
Loading

0 comments on commit c16ecad

Please sign in to comment.