Skip to content

Commit

Permalink
fix(dmg): cannot build DMG on macOS 10.15
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Jul 19, 2019
1 parent f6b6e23 commit 74f72eb
Show file tree
Hide file tree
Showing 32 changed files with 896 additions and 3,519 deletions.
7 changes: 7 additions & 0 deletions .idea/codeStyles/Project.xml

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

1 change: 1 addition & 0 deletions .idea/dictionaries/develar.xml

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@types/debug": "^4.1.4",
"@types/is-ci": "^2.0.0",
"@types/semver": "^6.0.1",
"app-builder-bin": "3.4.0",
"app-builder-bin": "3.4.1",
"archiver": "^3.0.0",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.9",
Expand All @@ -55,10 +55,10 @@
"minimatch": "^3.0.4",
"normalize-package-data": "^2.5.0",
"pako": "^1.0.10",
"parse-color": "^1.0.0",
"read-config-file": "4.0.1",
"read-config-file": "5.0.0",
"sanitize-filename": "^1.6.1",
"sax": "^1.2.4",
"schema-utils": "^2.0.1",
"semver": "^6.2.0",
"source-map-support": "^0.5.12",
"stat-mode": "^0.3.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/app-builder-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"out",
"templates",
"scheme.json",
"electron-osx-sign",
"certs/root_certs.keychain",
"electron-osx-sign"
],
Expand Down Expand Up @@ -54,7 +55,7 @@
"is-ci": "^2.0.0",
"isbinaryfile": "^4.0.2",
"js-yaml": "^3.13.1",
"read-config-file": "4.0.1",
"read-config-file": "5.0.0",
"minimatch": "^3.0.4",
"normalize-package-data": "^2.5.0",
"sanitize-filename": "^1.6.1",
Expand Down
6 changes: 5 additions & 1 deletion packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -794,12 +794,16 @@
},
"window": {
"$ref": "#/definitions/DmgWindow",
"description": "The DMG windows position and size."
"description": "The DMG windows position and size. With y co-ordinates running from bottom to top.\nThe Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `\"x\": 0, \"y\": 100000` as the x, y co-ordinates.\nIt is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen."
},
"sign": {
"default": false,
"description": "Disable signing of the DMG when building. This can help solve issues with Gatekeeper disabling installation of your app.",
"type": "boolean"
},
"writeUpdateInfo": {
"default": true,
"type": "boolean"
}
},
"title": "DmgOptions",
Expand Down
6 changes: 0 additions & 6 deletions packages/app-builder-lib/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,6 @@ export interface Configuration extends PlatformSpecificBuildOptions {
*/
readonly launchUiVersion?: boolean | string | null

/**
* @private
* @deprecated Set framework and nodeVersion if need.
*/
readonly protonNodeVersion?: string | null

/**
* The framework name. One of `electron`, `proton-native`, `libui`. Defaults to `electron`.
*/
Expand Down
17 changes: 13 additions & 4 deletions packages/app-builder-lib/src/options/macOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export interface DmgOptions extends TargetSpecificOptions {
* The path to DMG icon (volume icon), which will be shown when mounted, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
* Defaults to the application icon (`build/icon.icns`).
*/
readonly icon?: string | null
icon?: string | null

/**
* The size of all the icons inside the DMG.
Expand Down Expand Up @@ -172,10 +172,13 @@ export interface DmgOptions extends TargetSpecificOptions {
* The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)).
* @default UDZO
*/
readonly format?: "UDRW" | "UDRO" | "UDCO" | "UDZO" | "UDBZ" | "ULFO"
format?: "UDRW" | "UDRO" | "UDCO" | "UDZO" | "UDBZ" | "ULFO"

/**
* The DMG windows position and size.
* The DMG window position and size. With y co-ordinates running from bottom to top.
*
* The Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `"x": 0, "y": 100000` as the x, y co-ordinates.
* It is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen.
*/
window?: DmgWindow

Expand All @@ -190,6 +193,12 @@ export interface DmgOptions extends TargetSpecificOptions {
* @default false
*/
readonly sign?: boolean

/**
* @private
* @default true
*/
writeUpdateInfo?: boolean
}

export interface DmgWindow {
Expand All @@ -200,7 +209,7 @@ export interface DmgWindow {
x?: number

/**
* The Y position relative to top of the screen.
* The Y position relative to bottom of the screen.
* @default 100
*/
y?: number
Expand Down
7 changes: 0 additions & 7 deletions packages/app-builder-lib/src/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ async function createFrameworkInfo(configuration: Configuration, packager: Packa
}

let nodeVersion = configuration.nodeVersion
// noinspection JSDeprecatedSymbols
if (framework == null && configuration.protonNodeVersion != null) {
framework = "proton"
// noinspection JSDeprecatedSymbols
nodeVersion = configuration.protonNodeVersion
}

if (framework === "electron" || framework == null) {
return await createElectronFrameworkSupport(configuration, packager)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/publish/PublishManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ async function resolvePublishConfigurations(publishers: any, platformPackager: P
}

if (serviceName != null) {
log.debug(null, `Detect ${serviceName} as publish provider`)
log.debug(null, `detect ${serviceName} as publish provider`)
return [(await getResolvedPublishConfig(platformPackager, packager, {provider: serviceName}, arch, errorIfCannot))!]
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/targets/nsis/nsisOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
readonly deleteAppDataOnUninstall?: boolean

/**
* Defaults to `true` for web installer (`nsis-web`)
* @private
*/
differentialPackage?: boolean

Expand Down
4 changes: 4 additions & 0 deletions packages/app-builder-lib/src/util/appBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { SpawnOptions } from "child_process"
export function executeAppBuilderAsJson<T>(args: Array<string>): Promise<T> {
return executeAppBuilder(args)
.then(rawResult => {
if (rawResult === "") {
return Object.create(null) as T
}

try {
return JSON.parse(rawResult) as T
}
Expand Down
39 changes: 27 additions & 12 deletions packages/app-builder-lib/src/util/config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { DebugLogger, deepAssign, InvalidConfigurationError, log } from "builder-util"
import { DebugLogger, deepAssign, InvalidConfigurationError, log, safeStringifyJson } from "builder-util"
import { statOrNull } from "builder-util/out/fs"
import { readJson } from "fs-extra"
import { Lazy } from "lazy-val"
import * as path from "path"
import { getConfig as _getConfig, loadParentConfig, orNullIfFileNotExist, ReadConfigRequest, validateConfig as _validateConfig } from "read-config-file"
import { getConfig as _getConfig, loadParentConfig, orNullIfFileNotExist, ReadConfigRequest } from "read-config-file"
import { FileSet } from ".."
import { Configuration } from "../configuration"
import { reactCra } from "../presets/rectCra"
const validateSchema = require("schema-utils")

declare const PACKAGE_VERSION: string

// https://github.com/electron-userland/electron-builder/issues/1847
function mergePublish(config: Configuration, configFromOptions: Configuration) {
Expand Down Expand Up @@ -222,19 +225,31 @@ export async function validateConfig(config: Configuration, debugLogger: DebugLo
throw new InvalidConfigurationError(`appImage.systemIntegration is deprecated, https://github.com/TheAssassin/AppImageLauncher is used for desktop integration"`)
}

await _validateConfig(config, schemeDataPromise, (message, errors) => {
if (debugLogger.isEnabled) {
debugLogger.add("invalidConfig", JSON.stringify(errors, null, 2))
}
validateSchema(await schemeDataPromise.value, config, {
name: `electron-builder ${PACKAGE_VERSION}`,
postFormatter: (formattedError: string, error: any): string => {
if (debugLogger.isEnabled) {
debugLogger.add("invalidConfig", safeStringifyJson(error))
}

return `${message}
const site = "https://www.electron.build"
let url = `${site}/configuration/configuration`
const targets = new Set(["mac", "dmg", "pkg", "mas", "win", "nsis", "appx", "linux", "appimage", "snap"])
const dataPath: string = error.dataPath == null ? null : error.dataPath
const targetPath = dataPath.startsWith(".") ? dataPath.substr(1).toLowerCase() : null
if (targetPath != null && targets.has(targetPath)) {
url = `${site}/configuration/${targetPath}`
}

How to fix:
1. Open https://electron.build/configuration/configuration
2. Search the option name on the page.
* Not found? The option was deprecated or not exists (check spelling).
* Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", not in the root.
return `${formattedError}
How to fix:
1. Open ${url}
2. Search the option name on the page (or type in into Search to find across the docs).
* Not found? The option was deprecated or not exists (check spelling).
* Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", not in the root.
`
},
})
}

Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"out"
],
"dependencies": {
"app-builder-bin": "3.4.0",
"app-builder-bin": "3.4.1",
"temp-file": "^3.3.4",
"fs-extra": "^8.1.0",
"is-ci": "^2.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/dmg-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"dependencies": {
"fs-extra": "^8.1.0",
"bluebird-lst": "^1.0.9",
"parse-color": "^1.0.0",
"builder-util": "~0.0.0-semantic-release",
"iconv-lite": "^0.5.0",
"js-yaml": "^3.13.1",
Expand Down
Loading

0 comments on commit 74f72eb

Please sign in to comment.