跳到内容

DMG

顶层 dmg 键包含一组选项,用于指示 electron-builder 如何构建 DMG

DMG 许可证

要向 DMG 添加许可证,请在构建资源中创建文件 license_LANG_CODE.txt。 支持多种语言的许可证文件 — 使用语言后缀(例如 _de_ru)。 例如,在构建资源中创建文件 license_de.txtlicense_en.txt。 如果操作系统语言是德语,将显示 license_de.txt。 请参阅 语言代码到名称 的映射。

您还可以通过传递一个名为 licenseButtons_LANG_CODE.json 的 json 文件来更改 DMG 的默认按钮标签。 德语文件将命名为:licenseButtons_de.json。 包含文件应具有以下格式

{
  "lang": "English",
  "agree": "Agree",
  "disagree": "Disagree",
  "print": "Print",
  "save": "Save",
  "description": "Here is my own description"
}

配置

Electron-Builder / app-builder-lib / DmgOptions

继承

属性

artifactName?

readonly optional artifactName: null | string

artifact 文件名模板

继承自

TargetSpecificOptions.artifactName


background?

optional background: null | string

背景图像的路径(默认值:如果存在 build/background.tiffbuild/background.png)。 此文件的分辨率决定安装程序窗口的分辨率。 如果未指定 background,则使用 window.size。 默认位置期望背景大小为 540x380。

参见

支持 Retina 背景的 DMG.


backgroundColor?

optional backgroundColor: null | string

背景颜色(接受 css 颜色)。 如果没有背景图像,则默认为 #ffffff(白色)。


contents?

optional contents: DmgContent[]

内容 — 用于自定义图标位置。 x 和 y 坐标是指图标中心的位置(在 1x 比例下),并且不考虑标签。


format?

optional format: "UDRW" | "UDRO" | "UDCO" | "UDZO" | "UDBZ" | "ULFO"

磁盘映像格式。 ULFO (lzfse 压缩图像 (仅限 OS X 10.11+))。

默认值
UDZO

icon?

optional icon: null | string

DMG 图标(卷标图标)的路径,将在挂载时显示,相对于 构建资源 或项目目录。 默认为应用程序图标 (build/icon.icns)。


iconSize?

readonly optional iconSize: null | number

DMG 内所有图标的大小。

默认值
80

iconTextSize?

readonly optional iconTextSize: null | number

DMG 内所有图标文本的大小。

默认值
12

internetEnabled?

readonly optional internetEnabled: boolean

是否创建启用互联网的磁盘映像(当使用浏览器下载时,它将自动解压缩映像,将应用程序放在桌面上,卸载并删除磁盘映像文件)。

默认值
false

publish?

optional publish: Publish

继承自

TargetSpecificOptions.publish


sign?

readonly optional sign: boolean

是否对 DMG 进行签名。 签名不是必需的,并且与公证要求结合使用时会导致不必要的错误。

默认值
false

title?

readonly optional title: null | string

生成的 DMG 的标题,将在挂载时显示(卷名)。

支持宏 ${productName}${version}${name}

默认值
${productName} ${version}

window?

optional window: DmgWindow

DMG 窗口的位置和大小。 y 坐标从底部到顶部运行。

Finder 确保窗口将位于用户的显示器上,因此如果您希望窗口位于显示器的左上角,则可以使用 "x": 0, "y": 100000 作为 x, y 坐标。 不可能将窗口相对于左上角或相对于用户屏幕的中心定位。