From 12473d0e72234140f7bef40763c1e693bfb607fb Mon Sep 17 00:00:00 2001 From: develar Date: Wed, 7 Jun 2017 09:24:52 +0200 Subject: [PATCH] fix(electron-updater): isSilent is optional --- docs/Options.md | 2 +- docs/api/electron-builder.md | 8 ++++---- packages/electron-updater/src/AppUpdater.ts | 4 ++-- packages/electron-updater/src/MacUpdater.ts | 4 ++-- packages/electron-updater/src/NsisUpdater.ts | 4 ++-- packages/electron-updater/src/main.ts | 3 ++- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/Options.md b/docs/Options.md index 626a5488e5c..4eacea38232 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -196,7 +196,7 @@ Configuration Options | directories| [MetadataDirectories](#MetadataDirectories) \| null | | | electronVersion| string \| null | The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency. | | muonVersion| string \| null | The version of muon you are packaging for. | -| artifactName| string \| null | The [artifact file name pattern](https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern). Defaults to `${productName}-${version}.${ext}` (some target can have another defaults, see corresponding options).

Currently supported only for `mas`, `pkg`, `dmg` and `nsis`. | +| artifactName| string \| null | The [artifact file name pattern](https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern). Defaults to `${productName}-${version}.${ext}` (some target can have another defaults, see corresponding options). | | buildVersion| string \| null | The build version. Maps to the `CFBundleVersion` on macOS, and `FileVersion` metadata property on Windows. Defaults to the `version`. If `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_NUMBER` or `bamboo.buildNumber` env defined, it will be used as a build version (`version.build_number`). | | electronCompile| boolean | Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified. | | detectUpdateChannel = true| boolean | Whether to infer update channel from application version prerelease components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`. | diff --git a/docs/api/electron-builder.md b/docs/api/electron-builder.md index ec56397d323..041ef966e3f 100644 --- a/docs/api/electron-builder.md +++ b/docs/api/electron-builder.md @@ -553,7 +553,7 @@ Developer API only. See [[Options]] for user documentation. | Param | Type | | --- | --- | | pattern | string | -| arch | [Arch](electron-builder-core#Arch) \| undefined \| null | +| arch | string \| undefined \| null | | extra | any | @@ -885,7 +885,7 @@ Developer API only. See [[Options]] for user documentation. | Param | Type | | --- | --- | | pattern | string | -| arch | [Arch](electron-builder-core#Arch) \| undefined \| null | +| arch | string \| undefined \| null | | extra | any | @@ -1240,7 +1240,7 @@ Developer API only. See [[Options]] for user documentation. | Param | Type | | --- | --- | | pattern | string | -| arch | [Arch](electron-builder-core#Arch) \| undefined \| null | +| arch | string \| undefined \| null | | extra | any | @@ -2349,7 +2349,7 @@ Developer API only. See [[Options]] for user documentation. | Param | Type | | --- | --- | | pattern | string | -| arch | [Arch](electron-builder-core#Arch) \| undefined \| null | +| arch | string \| undefined \| null | | extra | any | diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts index cc3c58698b3..cb6b678b908 100644 --- a/packages/electron-updater/src/AppUpdater.ts +++ b/packages/electron-updater/src/AppUpdater.ts @@ -271,9 +271,9 @@ export abstract class AppUpdater extends EventEmitter { * **Note:** `autoUpdater.quitAndInstall()` will close all application windows first and only emit `before-quit` event on `app` after that. * This is different from the normal quit event sequence. * - * @param isSilent *windows-only* Runs the installer in silent mode. + * @param [isSilent] *windows-only* Runs the installer in silent mode. */ - abstract quitAndInstall(isSilent: boolean): void + abstract quitAndInstall(isSilent?: boolean): void async loadUpdateConfig() { if (this._appUpdateConfigPath == null) { diff --git a/packages/electron-updater/src/MacUpdater.ts b/packages/electron-updater/src/MacUpdater.ts index f21c90f6026..7863e1a7a4c 100644 --- a/packages/electron-updater/src/MacUpdater.ts +++ b/packages/electron-updater/src/MacUpdater.ts @@ -6,7 +6,7 @@ import { PublishConfiguration, VersionInfo } from "electron-builder-http/out/pub import { createServer, IncomingMessage, ServerResponse } from "http" import { parse as parseUrl } from "url" import { AppUpdater } from "./AppUpdater" -import { DOWNLOAD_PROGRESS, FileInfo } from "./main" +import { DOWNLOAD_PROGRESS, FileInfo, UPDATE_DOWNLOADED } from "./main" import AutoUpdater = Electron.AutoUpdater export class MacUpdater extends AppUpdater { @@ -25,7 +25,7 @@ export class MacUpdater extends AppUpdater { if (this.logger != null) { this.logger.info(`New version ${this.versionInfo!.version} has been downloaded`) } - this.emit("update-downloaded", this.versionInfo) + this.emit(UPDATE_DOWNLOADED, this.versionInfo) }) } diff --git a/packages/electron-updater/src/NsisUpdater.ts b/packages/electron-updater/src/NsisUpdater.ts index be90773d0b7..07cbf935551 100644 --- a/packages/electron-updater/src/NsisUpdater.ts +++ b/packages/electron-updater/src/NsisUpdater.ts @@ -8,7 +8,7 @@ import { tmpdir } from "os" import * as path from "path" import "source-map-support/register" import { AppUpdater } from "./AppUpdater" -import { DOWNLOAD_PROGRESS, FileInfo } from "./main" +import { DOWNLOAD_PROGRESS, FileInfo, UPDATE_DOWNLOADED } from "./main" export class NsisUpdater extends AppUpdater { private setupPath: string | null @@ -72,7 +72,7 @@ export class NsisUpdater extends AppUpdater { this.setupPath = tempFile this.addQuitHandler() - this.emit("update-downloaded", this.versionInfo) + this.emit(UPDATE_DOWNLOADED, this.versionInfo) return tempFile } diff --git a/packages/electron-updater/src/main.ts b/packages/electron-updater/src/main.ts index 94e9a25d5e9..d09123fcbd4 100644 --- a/packages/electron-updater/src/main.ts +++ b/packages/electron-updater/src/main.ts @@ -108,6 +108,7 @@ export interface UpdateCheckResult { } export const DOWNLOAD_PROGRESS = "download-progress" +export const UPDATE_DOWNLOADED = "update-downloaded" export type LoginHandler = (authInfo: any, callback: LoginCallback) => void @@ -128,7 +129,7 @@ export class UpdaterSignal { } updateDownloaded(handler: (info: VersionInfo) => void) { - addHandler(this.emitter, "update-downloaded", handler) + addHandler(this.emitter, UPDATE_DOWNLOADED, handler) } updateCancelled(handler: (info: VersionInfo) => void) {