Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rude-bottles-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"dmg-builder": patch
---

fix(dmg): use APFS as default filesystem for DMG builds due to incompatibilities on latest MacOS w/ HFS+
8 changes: 8 additions & 0 deletions packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,14 @@
},
"type": "array"
},
"filesystem": {
"default": "APFS",
"description": "The filesystem for the DMG volume (e.g. `\"APFS\"` or `\"HFS+\"`). APFS is the default and recommended on macOS 10.13+.",
"type": [
"null",
"string"
]
},
"format": {
"default": "UDZO",
"description": "The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)).",
Expand Down
6 changes: 6 additions & 0 deletions packages/app-builder-lib/src/options/macOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ export interface DmgOptions extends TargetSpecificOptions {
*/
format?: "UDRW" | "UDRO" | "UDCO" | "UDZO" | "UDBZ" | "ULFO"

/**
* The filesystem for the DMG volume (e.g. `"APFS"` or `"HFS+"`). APFS is the default and recommended on macOS 10.13+.
* @default APFS
*/
readonly filesystem?: string | null

/**
* The initial size of the DMG filesystem. Accepts the same syntax as the `-size` argument to `hdiutil`, e.g. `"150m"`, `"4g"`.
* If not specified, the size is calculated automatically.
Expand Down
2 changes: 1 addition & 1 deletion packages/dmg-builder/src/dmg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class DmgTarget extends Target {
// public to test
async computeDmgOptions(appPath: string): Promise<DmgOptions> {
const packager = this.packager
const specification: DmgOptions = { ...this.options }
const specification: DmgOptions = { ...this.options, filesystem: this.options.filesystem ?? "APFS" }
if (specification.icon == null && specification.icon !== null) {
specification.icon = await packager.getIconPath()
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dmg-builder/src/dmgUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export async function customizeDmg({ appPath, artifactPath, volumeName, specific
"text-size": iconTextSize,

"compression-level": Number(process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL || "9"),
// filesystem: specification.filesystem || "HFS+",
Comment thread
mmaietta marked this conversation as resolved.
filesystem: specification.filesystem || "APFS",
format: specification.format,
size: specification.size,
shrink: specification.shrink,
Expand Down
4 changes: 1 addition & 3 deletions packages/electron-publish/src/gitlabPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ export class GitlabPublisher extends HttpPublisher {
const releaseName = this.releaseName || defaultName
const branchName = await this.getDefaultBranch()

const description = this.releaseBody
? trimStringWithWarn(this.releaseBody, 100000, "release body exceeds GitLab limit, truncating")
: `Release ${releaseName}`
const description = this.releaseBody ? trimStringWithWarn(this.releaseBody, 100000, "release body exceeds GitLab limit, truncating") : `Release ${releaseName}`

const releaseData = {
tag_name: this.tag,
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publish/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export const trimStringWithWarn = (str: string, maxLength: number, warnMessage:
}
log.warn({ length: str.length, maxLength }, warnMessage)
return str.substring(0, maxLength)
}
}
1 change: 1 addition & 0 deletions test/snapshots/mac/dmgTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ exports[`dmg > background color 1`] = `
"y": 220,
},
],
"filesystem": "APFS",
"format": "UDRO",
"title": "Bar",
"writeUpdateInfo": false,
Expand Down
5 changes: 3 additions & 2 deletions test/src/mac/dmgTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ describe.heavy.ifMac("dmg", { sequential: true }, () => {
const totalBytes = stats.bsize * stats.blocks

// 500m should give ~524,288,000 bytes (500 * 1024 * 1024)
// Allow margin for filesystem overhead (450MB to 600MB)
// Allow margin for filesystem overhead. APFS can report larger sizes than HFS+ due to
// different block sizing and allocation, so use a wide range (450MB–1GB).
const minBytes = 450 * 1024 * 1024
const maxBytes = 600 * 1024 * 1024
const maxBytes = 1024 * 1024 * 1024
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a huuuge new range for just changing filesystem. Is the dmg size being minimized?
Maybe we can do 2 tests, one for HFS and another for APFS

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be a good one. Let's try

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ur right, lemme see what I can do.


expect(totalBytes).toBeGreaterThan(minBytes)
expect(totalBytes).toBeLessThan(maxBytes)
Expand Down
Loading