diff --git a/src/appInfo.ts b/src/appInfo.ts index 289224d1b4c..dad7eea84ea 100644 --- a/src/appInfo.ts +++ b/src/appInfo.ts @@ -42,19 +42,26 @@ export class AppInfo { } get id(): string { - const appId = this.devMetadata.build["app-bundle-id"] + let appId = this.devMetadata.build["app-bundle-id"] if (appId != null) { warn("app-bundle-id is deprecated, please use appId") } if (this.devMetadata.build.appId != null) { - return this.devMetadata.build.appId + appId = this.devMetadata.build.appId } - if (appId == null) { + const generateDefaultAppId = () => { return `com.electron.${this.metadata.name.toLowerCase()}` } - return appId + + if (appId === "your.id" || isEmptyOrSpaces(appId)) { + const incorrectAppId = appId + appId = generateDefaultAppId() + warn(`Do not use "${incorrectAppId}" as appId, "${appId}" will be used instead`) + } + + return appId == null ? generateDefaultAppId() : appId } get name(): string { diff --git a/src/targets/dmg.ts b/src/targets/dmg.ts index c9ed42362af..3b8fce21829 100644 --- a/src/targets/dmg.ts +++ b/src/targets/dmg.ts @@ -4,7 +4,7 @@ import { log, warn } from "../util/log" import { Target, PlatformPackager } from "../platformPackager" import { MacOptions, DmgOptions, DmgContent } from "../options/macOptions" import { Promise as BluebirdPromise } from "bluebird" -import { debug, use, exec, statOrNull } from "../util/util" +import { debug, use, exec, statOrNull, isEmptyOrSpaces } from "../util/util" import { copy, unlink, outputFile, remove } from "fs-extra-p" import { executeFinally } from "../util/promise" @@ -79,7 +79,17 @@ export class DmgTarget extends Target { ] } - const location: DmgContent = contents.find(it => it.path == null && it.type !== "link")! + let location = contents.find(it => it.path == null && it.type !== "link") + if (location == null) { + location = contents.find(it => { + if (it.path != null && it.path.endsWith(".app") && it.type !== "link") { + warn(`Do not specify path for application: "${it.path}". Actual path to app will be used instead.`) + return true + } + return false + })! + } + const applicationsLocation: DmgContent = contents.find(it => it.type === "link" && (it.path === "/Applications" || it.path === "Applications"))! const window = specification.window! @@ -181,7 +191,12 @@ export class DmgTarget extends Target { } if (specification.title != null) { - warn("dmg.title is not supported, file issue if need") + if (specification.title === packager.appInfo.productName) { + warn(`Do not specify unnecessary dmg.title ("${specification.title}") — application name ("${packager.appInfo.productFilename}") is used by default`) + } + else { + warn("dmg.title is not supported, file issue if need") + } } if (!("icon" in specification)) { @@ -190,6 +205,10 @@ export class DmgTarget extends Target { }) } + if (specification.icon != null && isEmptyOrSpaces(specification.icon)) { + throw new Error("dmg.icon cannot be specified as empty string") + } + if (specification["background-color"] != null) { if (specification.backgroundColor == null) { specification.backgroundColor = specification["background-color"]