From e700b78a50ac17b2c791ba768c65921821499a90 Mon Sep 17 00:00:00 2001 From: develar Date: Thu, 8 Jun 2017 14:25:29 +0200 Subject: [PATCH] feat: do not require "author" --- docs/Options.md | 47 ++++++++-------- docs/api/electron-builder-core.md | 13 ----- docs/api/electron-builder.md | 4 +- jsdoc/helpers.js | 16 ++++-- packages/electron-builder-core/src/core.ts | 6 --- .../src/squirrelPack.ts | 4 +- .../src/squirrelWindows.ts | 3 +- packages/electron-builder/src/appInfo.ts | 5 +- packages/electron-builder/src/fileMatcher.ts | 3 +- packages/electron-builder/src/index.ts | 2 +- packages/electron-builder/src/metadata.ts | 34 +++++++++++- packages/electron-builder/src/packager.ts | 54 ++++--------------- packages/electron-builder/src/targets/appx.ts | 6 ++- packages/electron-builder/src/targets/nsis.ts | 15 ++++-- .../src/util/readPackageJson.ts | 10 +++- packages/electron-builder/src/winPackager.ts | 2 +- .../templates/nsis/installSection.nsh | 4 +- packages/jsdoc2md.js | 2 +- test/out/__snapshots__/ExtraBuildTest.js.snap | 18 ++++++- .../mac/__snapshots__/macArchiveTest.js.snap | 9 +++- test/src/ArtifactPublisherTest.ts | 2 +- test/src/BuildTest.ts | 2 +- test/src/globTest.ts | 2 +- test/src/helpers/packTester.ts | 8 +-- 24 files changed, 153 insertions(+), 118 deletions(-) diff --git a/docs/Options.md b/docs/Options.md index b302c8467a0..5bc9e0c682e 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -75,25 +75,6 @@ You can use macros in the file patterns, artifact file name patterns and publish * `${env.ENV_NAME}` — any environment variable. * Any property of [AppInfo](https://github.com/electron-userland/electron-builder/wiki/electron-builder#AppInfo) (e.g. `buildVersion`, `buildNumber`). -## Source and Destination Directories -You may also specify custom source and destination directories by using JSON objects instead of simple glob patterns. -Note this only works for [extraFiles](#Config-extraFiles) and [extraResources](#Config-extraResources). - ```js - [ - { - "from": "path/to/source", - "to": "path/to/destination", - "filter": ["**/*", "!foo/*.js"] - } - ] - ``` -If `from` is given as a relative path, it is relative to the project directory. -If `to` is given as a relative path, it is relative to the app's content directory for `extraFiles` and the app's resource directory for `extraResources`. - -`from` and `to` can be files and you can use this to [rename](https://github.com/electron-userland/electron-builder/issues/1119) a file while packaging. - -You can use [file macros](#file-macros) in the `from` and `to` fields as well. - ### Default File Pattern [files](#Config-files) defaults to: @@ -108,6 +89,11 @@ You can use [file macros](#file-macros) in the `from` and `to` fields as well. `${ext}` macro is supported in addition to [file macros](#file-macros). +## How to Read Docs + +* Name of optional property is normal, **required** is bold. +* Type is specified after property name: `Array | String`. Union like this means that you can specify or string (`**/*`), or array of strings (`["**/*", "!foo.js"]`). + @@ -121,10 +107,29 @@ Configuration Options * `copyright` = `Copyright © year ${author}` String - The human-readable copyright line for the app. * `productName` String - As [name](#Metadata-name), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name}). * `files` Array<String> | String - A [glob patterns](#file-patterns) relative to the [app directory](#MetadataDirectories-app), which specifies which files to include when copying files to create the package. -* `extraResources` Array<String | [FilePattern](electron-builder-core#FilePattern)> | [FilePattern](electron-builder-core#FilePattern) | String - A [glob patterns](#file-patterns) relative to the project directory, when specified, copy the file or directory with matching names directly into the app's resources directory (`Contents/Resources` for MacOS, `resources` for Linux/Windows). +* `extraResources` Array<String | [FilePattern](#FilePattern)> | [FilePattern](#FilePattern) | String - A [glob patterns](#file-patterns) relative to the project directory, when specified, copy the file or directory with matching names directly into the app's resources directory (`Contents/Resources` for MacOS, `resources` for Linux/Windows). Glob rules the same as for [files](#multiple-glob-patterns). -* `extraFiles` Array<String | [FilePattern](electron-builder-core#FilePattern)> | [FilePattern](electron-builder-core#FilePattern) | String - The same as [extraResources](#Config-extraResources) but copy into the app's content directory (`Contents` for MacOS, root directory for Linux/Windows). + + You may also specify custom source and destination directories by using JSON objects instead of simple glob patterns. Note this only works for [extraFiles](#Config-extraFiles) and [extraResources](#Config-extraResources). + + ```json + [ + { + "from": "path/to/source", + "to": "path/to/destination", + "filter": ["**/*", "!foo/*.js"] + } + ] + ``` + + `from` and `to` can be files and you can use this to [rename](https://github.com/electron-userland/electron-builder/issues/1119) a file while packaging. + + You can use [file macros](#file-macros) in the `from` and `to` fields as well. + * `from` String - The source path relative to the project directory. + * `to` String - The destination path relative to the app's content directory for `extraFiles` and the app's resource directory for `extraResources`. + * `filter` Array<String> | String - The [glob patterns](#file-patterns). +* `extraFiles` Array<String | [FilePattern](#FilePattern)> | [FilePattern](#FilePattern) | String - The same as [extraResources](#Config-extraResources) but copy into the app's content directory (`Contents` for MacOS, root directory for Linux/Windows). * `asar` = `true` Boolean | [AsarOptions](#AsarOptions) - Whether to package the application's source code into an archive, using [Electron's archive format](http://electron.atom.io/docs/tutorial/application-packaging/). Node modules, that must be unpacked, will be detected automatically, you don't need to explicitly set [asarUnpack](#Config-asarUnpack) - please file issue if this doesn't work. diff --git a/docs/api/electron-builder-core.md b/docs/api/electron-builder-core.md index fa6daa960b6..74685261df0 100644 --- a/docs/api/electron-builder-core.md +++ b/docs/api/electron-builder-core.md @@ -4,7 +4,6 @@ * [electron-builder-core](#module_electron-builder-core) * [`.BeforeBuildContext`](#BeforeBuildContext) - * [`.FilePattern`](#FilePattern) * [`.SourceRepositoryInfo`](#SourceRepositoryInfo) * [`.TargetConfig`](#TargetConfig) * [`.TargetSpecificOptions`](#TargetSpecificOptions) @@ -34,18 +33,6 @@ | **platform**| [Platform](#Platform) | | **arch**| String | - - -### `FilePattern` -**Kind**: interface of [electron-builder-core](#module_electron-builder-core) -**Properties** - -| Name | Type | -| --- | --- | -| from| String | -| to| String | -| filter| Array<String> \| String | - ### `SourceRepositoryInfo` diff --git a/docs/api/electron-builder.md b/docs/api/electron-builder.md index c7d9df3ac43..9f633026402 100644 --- a/docs/api/electron-builder.md +++ b/docs/api/electron-builder.md @@ -228,8 +228,8 @@ | Name | Type | | --- | --- | | files| Array<String> \| String \| null | -| extraFiles| Array<String \| [FilePattern](electron-builder-core#FilePattern)> \| [FilePattern](electron-builder-core#FilePattern) \| String \| null | -| extraResources| Array<String \| [FilePattern](electron-builder-core#FilePattern)> \| [FilePattern](electron-builder-core#FilePattern) \| String \| null | +| extraFiles| Array<String \| [FilePattern](Options#FilePattern)> \| [FilePattern](Options#FilePattern) \| String \| null | +| extraResources| Array<String \| [FilePattern](Options#FilePattern)> \| [FilePattern](Options#FilePattern) \| String \| null | | asarUnpack| Array<String> \| String \| null | | asar| [AsarOptions](Options#AsarOptions) \| Boolean \| null | | target| Array<String \| [TargetConfig](electron-builder-core#TargetConfig)> \| String \| [TargetConfig](electron-builder-core#TargetConfig) \| null | diff --git a/jsdoc/helpers.js b/jsdoc/helpers.js index 91a658fb189..fc31553b317 100644 --- a/jsdoc/helpers.js +++ b/jsdoc/helpers.js @@ -37,6 +37,7 @@ function renderMemberListDescription(text, indent) { return dmdHelper.inlineLinks(text) .replace(/
/g, "\n") .replace(/\n/g, "\n" + indent) + .replace('"**\\/*"', '"**/*"') } function getInlinedChild(types) { @@ -45,7 +46,16 @@ function getInlinedChild(types) { } const arrayTypePrefix = "Array.<" - types = types.filter(it => it !== "null" && !isPrimitiveType(it) && !(it.startsWith(arrayTypePrefix) && types.includes(it.substring(arrayTypePrefix.length, it.indexOf(">"))))) + types = types.filter(it => { + if (it === "null" || isPrimitiveType(it)) { + return false + } + if (it.startsWith(arrayTypePrefix)) { + it = it.replace("string|", "").replace("<(", "<").replace(")>", ">") + return !types.includes(it.substring(arrayTypePrefix.length, it.indexOf(">"))) + } + return true + }) return types.length === 1 ? resolveById(types[0]) : null } @@ -71,7 +81,7 @@ function renderProperties(object, root, level) { const types = member.type.names let child = getInlinedChild(types) - if (child != null && !child.inlined) { + if (child != null && (!child.inlined || child.rendered)) { child = null } @@ -93,7 +103,7 @@ function renderProperties(object, root, level) { } if (child != null) { - child.inlined = true + child.rendered = true result += "\n" result += renderProperties(child, root, level + 1) } diff --git a/packages/electron-builder-core/src/core.ts b/packages/electron-builder-core/src/core.ts index 41eb4c34e61..5f1a59fb0f5 100644 --- a/packages/electron-builder-core/src/core.ts +++ b/packages/electron-builder-core/src/core.ts @@ -127,12 +127,6 @@ export const DIR_TARGET = "dir" export type CompressionLevel = "store" | "normal" | "maximum" -export interface FilePattern { - from?: string - to?: string - filter?: Array | string -} - export interface BeforeBuildContext { readonly appDir: string readonly electronVersion: string diff --git a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts index 6540dfd0f40..6ee50f1241b 100644 --- a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts +++ b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts @@ -40,7 +40,6 @@ export interface SquirrelOptions { version: string msi?: any - owners?: string description?: string iconUrl?: string authors?: string @@ -112,7 +111,7 @@ async function pack(options: SquirrelOptions, directory: string, updateFile: str }) archive.pipe(archiveOut) - const author = options.authors || options.owners + const author = options.authors const copyright = options.copyright || `Copyright © ${new Date().getFullYear()} ${author}` const nuspecContent = ` @@ -121,7 +120,6 @@ async function pack(options: SquirrelOptions, directory: string, updateFile: str ${version} ${options.productName} ${author} - ${options.owners || options.authors} ${options.iconUrl} false ${options.description} diff --git a/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts b/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts index 064f6e37099..b187ffd29ea 100644 --- a/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts +++ b/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts @@ -71,7 +71,8 @@ export default class SquirrelWindowsTarget extends Target { appId: this.options.useAppIdAsId ? appInfo.id : appInfo.name, version: appInfo.version, description: appInfo.description, - authors: appInfo.companyName, + // better to explicitly set to empty string, to avoid any nugget errors + authors: appInfo.companyName || "", iconUrl: iconUrl, extraMetadataSpecs: projectUrl == null ? null : `\n ${projectUrl}`, copyright: appInfo.copyright, diff --git a/packages/electron-builder/src/appInfo.ts b/packages/electron-builder/src/appInfo.ts index 9e74b535aca..ccffe772c11 100644 --- a/packages/electron-builder/src/appInfo.ts +++ b/packages/electron-builder/src/appInfo.ts @@ -43,8 +43,9 @@ export class AppInfo { return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}.${this.buildNumber || "0"}` } - get companyName() { - return this.metadata.author!.name + get companyName(): string | null { + const author = this.metadata.author + return author == null ? null : author.name } get id(): string { diff --git a/packages/electron-builder/src/fileMatcher.ts b/packages/electron-builder/src/fileMatcher.ts index ce49c4a788d..9dcd39bf091 100644 --- a/packages/electron-builder/src/fileMatcher.ts +++ b/packages/electron-builder/src/fileMatcher.ts @@ -1,12 +1,11 @@ import BluebirdPromise from "bluebird-lst" -import { FilePattern } from "electron-builder-core" import { asArray, debug } from "electron-builder-util" import { copyDir, copyFile, Filter, statOrNull } from "electron-builder-util/out/fs" import { warn } from "electron-builder-util/out/log" import { mkdirs } from "fs-extra-p" import { Minimatch } from "minimatch" import * as path from "path" -import { Config, PlatformSpecificBuildOptions } from "./metadata" +import { Config, FilePattern, PlatformSpecificBuildOptions } from "./metadata" import { BuildInfo } from "./packagerApi" import { createFilter, hasMagic } from "./util/filter" diff --git a/packages/electron-builder/src/index.ts b/packages/electron-builder/src/index.ts index 9bb5f00769d..745254d37bb 100644 --- a/packages/electron-builder/src/index.ts +++ b/packages/electron-builder/src/index.ts @@ -2,7 +2,7 @@ export { Packager, BuildResult } from "./packager" export { PackagerOptions, ArtifactCreated, BuildInfo } from "./packagerApi" export { getArchSuffix, Platform, Arch, archFromString, Target, DIR_TARGET } from "electron-builder-core" export { BuildOptions, build, CliOptions, createTargets } from "./builder" -export { Metadata, Config, AfterPackContext, MetadataDirectories, Protocol, FileAssociation, PlatformSpecificBuildOptions, AuthorMetadata, RepositoryInfo, AsarOptions } from "./metadata" +export { Metadata, Config, AfterPackContext, MetadataDirectories, Protocol, FileAssociation, PlatformSpecificBuildOptions, AuthorMetadata, RepositoryInfo, AsarOptions, FilePattern } from "./metadata" export { MacOptions, DmgOptions, MasBuildOptions, MacOsTargetName, PkgOptions, DmgContent, DmgWindow } from "./options/macOptions" export { WinBuildOptions, NsisOptions, SquirrelWindowsOptions, AppXOptions, NsisWebOptions, PortableOptions, CommonNsisOptions } from "./options/winOptions" export { LinuxBuildOptions, DebOptions, SnapOptions, CommonLinuxOptions, LinuxTargetSpecificOptions } from "./options/linuxOptions" diff --git a/packages/electron-builder/src/metadata.ts b/packages/electron-builder/src/metadata.ts index 7d06514873e..f908cfba68b 100644 --- a/packages/electron-builder/src/metadata.ts +++ b/packages/electron-builder/src/metadata.ts @@ -1,5 +1,5 @@ import { AsarIntegrityOptions } from "asar-integrity" -import { Arch, BeforeBuildContext, CompressionLevel, FilePattern, Target, TargetConfig, TargetSpecificOptions } from "electron-builder-core" +import { Arch, BeforeBuildContext, CompressionLevel, Target, TargetConfig, TargetSpecificOptions } from "electron-builder-core" import { Publish } from "electron-builder-http/out/publishOptions" import { DebOptions, LinuxBuildOptions, LinuxTargetSpecificOptions, SnapOptions } from "./options/linuxOptions" import { DmgOptions, MacOptions, MasBuildOptions, PkgOptions } from "./options/macOptions" @@ -92,6 +92,23 @@ export interface Config extends PlatformSpecificBuildOptions { * A [glob patterns](#file-patterns) relative to the project directory, when specified, copy the file or directory with matching names directly into the app's resources directory (`Contents/Resources` for MacOS, `resources` for Linux/Windows). * * Glob rules the same as for [files](#multiple-glob-patterns). + * + * You may also specify custom source and destination directories by using JSON objects instead of simple glob patterns. + * Note this only works for [extraFiles](#Config-extraFiles) and [extraResources](#Config-extraResources). + * + *```json
+ * [
+ * {
+ * "from": "path/to/source",
+ * "to": "path/to/destination",
+ * "filter": ["**\/*", "!foo/*.js"]
+ * }
+ * ]
+ * ``` + * + * `from` and `to` can be files and you can use this to [rename](https://github.com/electron-userland/electron-builder/issues/1119) a file while packaging. + * + * You can use [file macros](#file-macros) in the `from` and `to` fields as well. */ readonly extraResources?: Array | FilePattern | string | null @@ -392,4 +409,19 @@ export interface AsarOptions extends AsarIntegrityOptions { smartUnpack?: boolean ordering?: string | null +} + +export interface FilePattern { + /** + * The source path relative to the project directory. + */ + from?: string + /** + * The destination path relative to the app's content directory for `extraFiles` and the app's resource directory for `extraResources`. + */ + to?: string + /** + * The [glob patterns](#file-patterns). + */ + filter?: Array | string } \ No newline at end of file diff --git a/packages/electron-builder/src/packager.ts b/packages/electron-builder/src/packager.ts index f67b8d6bdd5..400ee17b84c 100644 --- a/packages/electron-builder/src/packager.ts +++ b/packages/electron-builder/src/packager.ts @@ -172,8 +172,6 @@ export class Packager implements BuildInfo { debug(`Effective config: ${safeStringifyJson(this.config)}`) } - checkConflictingOptions(this.config) - this.electronVersion = await getElectronVersion(this.config, projectDir, this.isPrepackedAppAsar ? this.metadata : null) this.muonVersion = this.config.muonVersion @@ -332,51 +330,27 @@ export class Packager implements BuildInfo { } } - const appMetadata = this.metadata + const metadata = this.metadata - checkNotEmpty("name", appMetadata.name) + checkNotEmpty("name", metadata.name) - if (isEmptyOrSpaces(appMetadata.description)) { + if (isEmptyOrSpaces(metadata.description)) { warn(`description is missed in the package.json (${appPackageFile})`) } - checkNotEmpty("version", appMetadata.version) + if (!metadata.author) { + warn(`author is missed in the package.json (${appPackageFile})`) + } + checkNotEmpty("version", metadata.version) checkDependencies(this.devMetadata.dependencies, errors) - if ((appMetadata) !== this.devMetadata) { - checkDependencies(appMetadata.dependencies, errors) + if ((metadata) !== this.devMetadata) { + checkDependencies(metadata.dependencies, errors) - if ((appMetadata).build != null) { + if ((metadata).build != null) { errors.push(`'build' in the application package.json (${appPackageFile}) is not supported since 3.0 anymore. Please move 'build' into the development package.json (${devAppPackageFile})`) } } - const config = this.config - if (config["osx-sign"] != null) { - errors.push("osx-sign is deprecated and not supported — please see https://github.com/electron-userland/electron-builder/wiki/Code-Signing") - } - if (config["osx"] != null) { - errors.push(`osx is deprecated and not supported — please use mac instead`) - } - if (config["app-copyright"] != null) { - errors.push(`app-copyright is deprecated and not supported — please use copyright instead`) - } - if (config["app-category-type"] != null) { - errors.push(`app-category-type is deprecated and not supported — please use mac.category instead`) - } - - const author = appMetadata.author - if (author == null) { - errors.push(`Please specify "author" in the application package.json (${appPackageFile}) — it is used as company name and copyright owner.`) - } - - if (config.name != null) { - errors.push(`'name' in the config is forbidden. Please move 'name' into the package.json (${appPackageFile})`) - } - - if (config.prune != null) { - errors.push("prune is deprecated — development dependencies are never copied in any case") - } - if (errors.length > 0) { throw new Error(errors.join("\n")) } @@ -453,14 +427,6 @@ export function normalizePlatforms(rawPlatforms: Array | stri } } -function checkConflictingOptions(options: any) { - for (const name of ["all", "out", "tmpdir", "version", "platform", "dir", "arch", "name", "extra-resource"]) { - if (name in options) { - throw new Error(`Option ${name} is ignored, do not specify it.`) - } - } -} - /** * @private */ diff --git a/packages/electron-builder/src/targets/appx.ts b/packages/electron-builder/src/targets/appx.ts index 791dce35113..9897cd55853 100644 --- a/packages/electron-builder/src/targets/appx.ts +++ b/packages/electron-builder/src/targets/appx.ts @@ -83,7 +83,11 @@ export default class AppXTarget extends Target { return publisher case "publisherDisplayName": - return this.options.publisherDisplayName || appInfo.companyName + const name = this.options.publisherDisplayName || appInfo.companyName + if (name == null) { + throw new Error(`Please specify "author" in the application package.json — it is required because "appx.publisherDisplayName" is not set.`) + } + return name case "version": return appInfo.versionInWeirdWindowsForm diff --git a/packages/electron-builder/src/targets/nsis.ts b/packages/electron-builder/src/targets/nsis.ts index 41696f5a65b..2f68398bdf4 100644 --- a/packages/electron-builder/src/targets/nsis.ts +++ b/packages/electron-builder/src/targets/nsis.ts @@ -148,6 +148,7 @@ export class NsisTarget extends Target { const installerPath = path.join(this.outDir, installerFilename) const guid = options.guid || await BluebirdPromise.promisify(uuid5)({namespace: ELECTRON_BUILDER_NS_UUID, name: appInfo.id}) + const companyName = appInfo.companyName const defines: any = { APP_ID: appInfo.id, APP_GUID: guid, @@ -157,12 +158,14 @@ export class NsisTarget extends Target { APP_DESCRIPTION: appInfo.description, VERSION: version, - COMPANY_NAME: appInfo.companyName, - PROJECT_DIR: packager.projectDir, BUILD_RESOURCES_DIR: packager.buildResourcesDir, } + if (companyName != null) { + defines.COMPANY_NAME = companyName + } + // electron uses product file name as app data, define it as well to remove on uninstall if (defines.APP_FILENAME != appInfo.productFilename) { defines.APP_PRODUCT_FILENAME = appInfo.productFilename @@ -279,12 +282,12 @@ export class NsisTarget extends Target { const versionKey = [ `/LANG=${localeId} ProductName "${appInfo.productName}"`, `/LANG=${localeId} ProductVersion "${appInfo.version}"`, - `/LANG=${localeId} CompanyName "${appInfo.companyName}"`, `/LANG=${localeId} LegalCopyright "${appInfo.copyright}"`, `/LANG=${localeId} FileDescription "${appInfo.description}"`, `/LANG=${localeId} FileVersion "${appInfo.buildVersion}"`, ] use(this.packager.platformSpecificBuildOptions.legalTrademarks, it => versionKey.push(`/LANG=${localeId} LegalTrademarks "${it}"`)) + use(appInfo.companyName, it => versionKey.push(`/LANG=${localeId} CompanyName "${it}"`)) return versionKey } @@ -340,7 +343,11 @@ export class NsisTarget extends Target { if (options.menuCategory != null && options.menuCategory !== false) { let menu: string if (options.menuCategory === true) { - menu = sanitizeFileName(packager.appInfo.companyName) + const companyName = packager.appInfo.companyName + if (companyName == null) { + throw new Error(`Please specify "author" in the application package.json — it is required because "menuCategory" is set to true.`) + } + menu = sanitizeFileName(companyName) } else { menu = (options.menuCategory).split(/[\/\\]/).map(it => sanitizeFileName(it)).join("\\") diff --git a/packages/electron-builder/src/util/readPackageJson.ts b/packages/electron-builder/src/util/readPackageJson.ts index 72296ff1c5d..91ef3ae4f89 100644 --- a/packages/electron-builder/src/util/readPackageJson.ts +++ b/packages/electron-builder/src/util/readPackageJson.ts @@ -168,7 +168,15 @@ export async function validateConfig(config: Config) { const validator = await validatorPromise if (!validator(config)) { debug(JSON.stringify(validator.errors, null, 2)) - throw new Error("Config is invalid:\n" + JSON.stringify(normaliseErrorMessages(validator.errors!), null, 2)) + throw new Error(`Config is invalid: +${JSON.stringify(normaliseErrorMessages(validator.errors!), null, 2)} + +How to fix: + 1. Open https://github.com/electron-userland/electron-builder/wiki/Options + 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. +`) } } diff --git a/packages/electron-builder/src/winPackager.ts b/packages/electron-builder/src/winPackager.ts index 0c3af299657..1b5d45be09f 100644 --- a/packages/electron-builder/src/winPackager.ts +++ b/packages/electron-builder/src/winPackager.ts @@ -234,7 +234,6 @@ export class WinPackager extends PlatformPackager { const args = [ file, - "--set-version-string", "CompanyName", appInfo.companyName, "--set-version-string", "FileDescription", appInfo.productName, "--set-version-string", "ProductName", appInfo.productName, "--set-version-string", "InternalName", path.basename(appInfo.productFilename, ".exe"), @@ -244,6 +243,7 @@ export class WinPackager extends PlatformPackager { "--set-product-version", appInfo.versionInWeirdWindowsForm, ] + use(appInfo.companyName, it => args.push("--set-version-string", "CompanyName", it!)) use(this.platformSpecificBuildOptions.legalTrademarks, it => args.push("--set-version-string", "LegalTrademarks", it!)) use(await this.getIconPath(), it => args.push("--set-icon", it)) diff --git a/packages/electron-builder/templates/nsis/installSection.nsh b/packages/electron-builder/templates/nsis/installSection.nsh index 25c1c72ce5b..1ce1c9748c5 100644 --- a/packages/electron-builder/templates/nsis/installSection.nsh +++ b/packages/electron-builder/templates/nsis/installSection.nsh @@ -67,7 +67,9 @@ WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "DisplayIcon" "$appExe,0" !endif - WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "Publisher" "${COMPANY_NAME}" + !ifdef COMPANY_NAME + WriteRegStr SHCTX "${UNINSTALL_REGISTRY_KEY}" "Publisher" "${COMPANY_NAME}" + !endif WriteRegDWORD SHCTX "${UNINSTALL_REGISTRY_KEY}" NoModify 1 WriteRegDWORD SHCTX "${UNINSTALL_REGISTRY_KEY}" NoRepair 1 diff --git a/packages/jsdoc2md.js b/packages/jsdoc2md.js index 4e14cf9f73f..cd4763ef2ad 100644 --- a/packages/jsdoc2md.js +++ b/packages/jsdoc2md.js @@ -107,7 +107,7 @@ async function render(pages, jsdoc2MdOptions) { } function isOptionMember(member) { - return member.name.endsWith("Options") || member.name === "Protocol" || member.name === "FileAssociation" || member.name === "AuthorMetadata" || member.name === "RepositoryInfo" + return member.name.endsWith("Options") || member.name === "Protocol" || member.name === "FileAssociation" || member.name === "AuthorMetadata" || member.name === "RepositoryInfo" || member.name === "FilePattern" } const filtered = [] diff --git a/test/out/__snapshots__/ExtraBuildTest.js.snap b/test/out/__snapshots__/ExtraBuildTest.js.snap index 15122860db4..bde4d95e1d7 100644 --- a/test/out/__snapshots__/ExtraBuildTest.js.snap +++ b/test/out/__snapshots__/ExtraBuildTest.js.snap @@ -95,14 +95,28 @@ exports[`scheme validation 1`] = ` }, \\"Invalid option object\\" ] -}" +} + +How to fix: + 1. Open https://github.com/electron-userland/electron-builder/wiki/Options + 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. +" `; exports[`scheme validation 2 1`] = ` "Config is invalid: { \\"appId\\": \\"Should be null,string\\" -}" +} + +How to fix: + 1. Open https://github.com/electron-userland/electron-builder/wiki/Options + 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. +" `; exports[`scheme validation extraFiles 1`] = ` diff --git a/test/out/mac/__snapshots__/macArchiveTest.js.snap b/test/out/mac/__snapshots__/macArchiveTest.js.snap index cde3b376ae2..f130feea044 100644 --- a/test/out/mac/__snapshots__/macArchiveTest.js.snap +++ b/test/out/mac/__snapshots__/macArchiveTest.js.snap @@ -19,7 +19,14 @@ exports[`invalid target 1`] = ` }, \\"Invalid option object\\" ] -}" +} + +How to fix: + 1. Open https://github.com/electron-userland/electron-builder/wiki/Options + 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. +" `; exports[`only zip 1`] = ` diff --git a/test/src/ArtifactPublisherTest.ts b/test/src/ArtifactPublisherTest.ts index a2f85d7578f..22141373fe1 100644 --- a/test/src/ArtifactPublisherTest.ts +++ b/test/src/ArtifactPublisherTest.ts @@ -62,7 +62,7 @@ function isApiRateError(e: Error): boolean { } function testAndIgnoreApiRate(name: string, testFunction: () => Promise) { - test(name, async () => { + test.skip(name, async () => { try { await testFunction() } diff --git a/test/src/BuildTest.ts b/test/src/BuildTest.ts index f7b3a56eeec..ec6e50a2f90 100644 --- a/test/src/BuildTest.ts +++ b/test/src/BuildTest.ts @@ -153,7 +153,7 @@ test.ifLinuxOrDevMac("beforeBuild", () => { test.ifDevOrLinuxCi("smart unpack", app({ targets: linuxDirTarget, }, { - npmInstallBefore: true, + installDepsBefore: true, projectDirCreated: packageJson(it => { it.dependencies = { "debug": "^2.2.0", diff --git a/test/src/globTest.ts b/test/src/globTest.ts index aeee59b293c..7c26b77d89a 100644 --- a/test/src/globTest.ts +++ b/test/src/globTest.ts @@ -79,7 +79,7 @@ test.ifDevOrLinuxCi("failed peer dep", () => { return assertPack("test-app-one", { targets: Platform.LINUX.createTarget(DIR_TARGET), }, { - npmInstallBefore: true, + installDepsBefore: true, projectDirCreated: projectDir => modifyPackageJson(projectDir, data => { //noinspection SpellCheckingInspection data.dependencies = { diff --git a/test/src/helpers/packTester.ts b/test/src/helpers/packTester.ts index 67b3e3005be..217dedcc6b5 100644 --- a/test/src/helpers/packTester.ts +++ b/test/src/helpers/packTester.ts @@ -31,7 +31,7 @@ interface AssertPackOptions { readonly useTempDir?: boolean readonly signed?: boolean - readonly npmInstallBefore?: boolean + readonly installDepsBefore?: boolean } export interface PackedContext { @@ -95,9 +95,9 @@ export async function assertPack(fixtureName: string, packagerOptions: PackagerO try { if (projectDirCreated != null) { await projectDirCreated(projectDir) - if (checkOptions.npmInstallBefore) { - await spawn(process.platform === "win32" ? "npm.cmd" : "npm", ["install", "--production", "--cache-min", "999999999", "--no-bin-links"], { - cwd: projectDir + if (checkOptions.installDepsBefore) { + await spawn("node", [path.join(__dirname, "..", "..", "vendor", "yarn.js"), "install", "--production", "--no-bin-links"], { + cwd: projectDir, }) } }