Skip to content

Commit

Permalink
feat(electron-updater): isSilent param of quitAndInstall method elect…
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed May 20, 2017
1 parent 9fce636 commit daeefa6
Show file tree
Hide file tree
Showing 13 changed files with 385 additions and 182 deletions.
118 changes: 118 additions & 0 deletions docs/Auto Update.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ Emitted on progress. Only supported over Windows build, since `Squirrel.Mac` [do
* [`.warn(message)`](#module_electron-updater.Logger+warn)
* [`.UpdateCheckResult`](#UpdateCheckResult)
* [.AppUpdater](#AppUpdater) ⇐ <code>internal:EventEmitter</code>
* [`.checkForUpdates()`](#module_electron-updater.AppUpdater+checkForUpdates) ⇒ <code>Promise&lt;[UpdateCheckResult](#UpdateCheckResult)&gt;</code>
* [`.downloadUpdate(cancellationToken)`](#module_electron-updater.AppUpdater+downloadUpdate) ⇒ <code>Promise&lt;any&gt;</code>
* [`.getFeedURL()`](#module_electron-updater.AppUpdater+getFeedURL) ⇒ <code>undefined</code> \| <code>null</code> \| <code>string</code>
* [`.setFeedURL(options)`](#module_electron-updater.AppUpdater+setFeedURL)
* [`.loadUpdateConfig()`](#module_electron-updater.AppUpdater+loadUpdateConfig) ⇒ <code>Promise&lt;any&gt;</code>
* [`.quitAndInstall(isSilent)`](#module_electron-updater.AppUpdater+quitAndInstall)
* [`.computeRequestHeaders(fileInfo)`](#module_electron-updater.AppUpdater+computeRequestHeaders) ⇒ <code>null</code> \| <code>[RequestHeaders](electron-builder-http#RequestHeaders)</code>
* [`.dispatchError(e)`](#module_electron-updater.AppUpdater+dispatchError)
* [`.doDownloadUpdate(versionInfo, fileInfo, cancellationToken)`](#module_electron-updater.AppUpdater+doDownloadUpdate) ⇒ <code>Promise&lt;any&gt;</code>
* [`.onUpdateAvailable(versionInfo, fileInfo)`](#module_electron-updater.AppUpdater+onUpdateAvailable)
* [.Provider](#Provider)
* [`.getLatestVersion()`](#module_electron-updater.Provider+getLatestVersion) ⇒ <code>Promise&lt;module:electron-updater.T&gt;</code>
* [`.setRequestHeaders(value)`](#module_electron-updater.Provider+setRequestHeaders)
Expand Down Expand Up @@ -201,6 +211,114 @@ Emitted on progress. Only supported over Windows build, since `Squirrel.Mac` [do
| app| <code>Electron:App</code> | <a name="AppUpdater-app"></a> |
| versionInfo| <code>[VersionInfo](Publishing-Artifacts#VersionInfo)</code> \| <code>null</code> | <a name="AppUpdater-versionInfo"></a> |


* [.AppUpdater](#AppUpdater) ⇐ <code>internal:EventEmitter</code>
* [`.checkForUpdates()`](#module_electron-updater.AppUpdater+checkForUpdates) ⇒ <code>Promise&lt;[UpdateCheckResult](#UpdateCheckResult)&gt;</code>
* [`.downloadUpdate(cancellationToken)`](#module_electron-updater.AppUpdater+downloadUpdate) ⇒ <code>Promise&lt;any&gt;</code>
* [`.getFeedURL()`](#module_electron-updater.AppUpdater+getFeedURL) ⇒ <code>undefined</code> \| <code>null</code> \| <code>string</code>
* [`.setFeedURL(options)`](#module_electron-updater.AppUpdater+setFeedURL)
* [`.loadUpdateConfig()`](#module_electron-updater.AppUpdater+loadUpdateConfig) ⇒ <code>Promise&lt;any&gt;</code>
* [`.quitAndInstall(isSilent)`](#module_electron-updater.AppUpdater+quitAndInstall)
* [`.computeRequestHeaders(fileInfo)`](#module_electron-updater.AppUpdater+computeRequestHeaders) ⇒ <code>null</code> \| <code>[RequestHeaders](electron-builder-http#RequestHeaders)</code>
* [`.dispatchError(e)`](#module_electron-updater.AppUpdater+dispatchError)
* [`.doDownloadUpdate(versionInfo, fileInfo, cancellationToken)`](#module_electron-updater.AppUpdater+doDownloadUpdate) ⇒ <code>Promise&lt;any&gt;</code>
* [`.onUpdateAvailable(versionInfo, fileInfo)`](#module_electron-updater.AppUpdater+onUpdateAvailable)

<a name="module_electron-updater.AppUpdater+checkForUpdates"></a>

#### `appUpdater.checkForUpdates()`<code>Promise&lt;[UpdateCheckResult](#UpdateCheckResult)&gt;</code>
Asks the server whether there is an update.

**Kind**: instance method of [<code>AppUpdater</code>](#AppUpdater)
<a name="module_electron-updater.AppUpdater+downloadUpdate"></a>

#### `appUpdater.downloadUpdate(cancellationToken)`<code>Promise&lt;any&gt;</code>
Start downloading update manually. You can use this method if `autoDownload` option is set to `false`.

**Kind**: instance method of [<code>AppUpdater</code>](#AppUpdater)
**Returns**: <code>Promise&lt;any&gt;</code> - Path to downloaded file.

| Param | Type |
| --- | --- |
| cancellationToken | <code>[CancellationToken](electron-builder-http#CancellationToken)</code> |

<a name="module_electron-updater.AppUpdater+getFeedURL"></a>

#### `appUpdater.getFeedURL()`<code>undefined</code> \| <code>null</code> \| <code>string</code>
**Kind**: instance method of [<code>AppUpdater</code>](#AppUpdater)
<a name="module_electron-updater.AppUpdater+setFeedURL"></a>

#### `appUpdater.setFeedURL(options)`
Configure update provider. If value is `string`, [module:electron-builder-http/out/publishOptions.GenericServerOptions](module:electron-builder-http/out/publishOptions.GenericServerOptions) will be set with value as `url`.

**Kind**: instance method of [<code>AppUpdater</code>](#AppUpdater)

| Param | Type | Description |
| --- | --- | --- |
| options | <code>[PublishConfiguration](Publishing-Artifacts#PublishConfiguration)</code> \| <code>[GenericServerOptions](Publishing-Artifacts#GenericServerOptions)</code> \| <code>[S3Options](Publishing-Artifacts#S3Options)</code> \| <code>[BintrayOptions](Publishing-Artifacts#BintrayOptions)</code> \| <code>[GithubOptions](Publishing-Artifacts#GithubOptions)</code> \| <code>string</code> | If you want to override configuration in the `app-update.yml`. |

<a name="module_electron-updater.AppUpdater+loadUpdateConfig"></a>

#### `appUpdater.loadUpdateConfig()`<code>Promise&lt;any&gt;</code>
**Kind**: instance method of [<code>AppUpdater</code>](#AppUpdater)
<a name="module_electron-updater.AppUpdater+quitAndInstall"></a>

#### `appUpdater.quitAndInstall(isSilent)`
Restarts the app and installs the update after it has been downloaded.
It should only be called after `update-downloaded` has been emitted.

**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.

**Kind**: instance method of [<code>AppUpdater</code>](#AppUpdater)

| Param | Type | Description |
| --- | --- | --- |
| isSilent | <code>boolean</code> | *windows-only* Runs the installer in silent mode. |

<a name="module_electron-updater.AppUpdater+computeRequestHeaders"></a>

#### `appUpdater.computeRequestHeaders(fileInfo)`<code>null</code> \| <code>[RequestHeaders](electron-builder-http#RequestHeaders)</code>
**Kind**: instance method of [<code>AppUpdater</code>](#AppUpdater)
**Access**: protected

| Param | Type |
| --- | --- |
| fileInfo | <code>[FileInfo](#FileInfo)</code> |

<a name="module_electron-updater.AppUpdater+dispatchError"></a>

#### `appUpdater.dispatchError(e)`
**Kind**: instance method of [<code>AppUpdater</code>](#AppUpdater)
**Access**: protected

| Param | Type |
| --- | --- |
| e | <code>Error</code> |

<a name="module_electron-updater.AppUpdater+doDownloadUpdate"></a>

#### `appUpdater.doDownloadUpdate(versionInfo, fileInfo, cancellationToken)`<code>Promise&lt;any&gt;</code>
**Kind**: instance method of [<code>AppUpdater</code>](#AppUpdater)
**Access**: protected

| Param | Type |
| --- | --- |
| versionInfo | <code>[VersionInfo](Publishing-Artifacts#VersionInfo)</code> |
| fileInfo | <code>[FileInfo](#FileInfo)</code> |
| cancellationToken | <code>[CancellationToken](electron-builder-http#CancellationToken)</code> |

<a name="module_electron-updater.AppUpdater+onUpdateAvailable"></a>

#### `appUpdater.onUpdateAvailable(versionInfo, fileInfo)`
**Kind**: instance method of [<code>AppUpdater</code>](#AppUpdater)
**Access**: protected

| Param | Type |
| --- | --- |
| versionInfo | <code>[VersionInfo](Publishing-Artifacts#VersionInfo)</code> |
| fileInfo | <code>[FileInfo](#FileInfo)</code> |

<a name="Provider"></a>

### Provider
Expand Down
80 changes: 80 additions & 0 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ You can use [file macros](#file-macros) in the `from` and `to` fields as well.
* [`.AppXOptions`](#AppXOptions)
* [`.ArtifactCreated`](#ArtifactCreated)
* [`.BuildInfo`](#BuildInfo)
* [`.afterPack(context)`](#module_electron-builder.BuildInfo+afterPack) ⇒ <code>Promise&lt;void&gt;</code>
* [`.dispatchArtifactCreated(event)`](#module_electron-builder.BuildInfo+dispatchArtifactCreated)
* [`.BuildOptions`](#BuildOptions) ⇐ <code>[PublishOptions](electron-publish#PublishOptions)</code>
* [`.BuildResult`](#BuildResult)
* [`.CliOptions`](#CliOptions) ⇐ <code>[PublishOptions](electron-publish#PublishOptions)</code>
Expand All @@ -122,6 +124,11 @@ You can use [file macros](#file-macros) in the `from` and `to` fields as well.
* [`.SquirrelWindowsOptions`](#SquirrelWindowsOptions) ⇐ <code>[WinBuildOptions](#WinBuildOptions)</code>
* [`.WinBuildOptions`](#WinBuildOptions) ⇐ <code>[PlatformSpecificBuildOptions](electron-builder-core#PlatformSpecificBuildOptions)</code>
* [.Packager](#Packager) ⇐ <code>[BuildInfo](#BuildInfo)</code>
* [`.addAfterPackHandler(handler)`](#module_electron-builder.Packager+addAfterPackHandler)
* [`.afterPack(context)`](#module_electron-builder.Packager+afterPack) ⇒ <code>Promise&lt;void&gt;</code>
* [`.artifactCreated(handler)`](#module_electron-builder.Packager+artifactCreated) ⇒ <code>[Packager](#Packager)</code>
* [`.build()`](#module_electron-builder.Packager+build) ⇒ <code>Promise&lt;[BuildResult](#BuildResult)&gt;</code>
* [`.dispatchArtifactCreated(event)`](#module_electron-builder.Packager+dispatchArtifactCreated)
* [`.build(rawOptions)`](#module_electron-builder.build) ⇒ <code>Promise&lt;Array&lt;string&gt;&gt;</code>
* [`.buildForge(forgeOptions, options)`](#module_electron-builder.buildForge) ⇒ <code>Promise&lt;Array&lt;string&gt;&gt;</code>
* [`.createTargets(platforms, type, arch)`](#module_electron-builder.createTargets) ⇒ <code>Map&lt;[Platform](electron-builder-core#Platform) \| Map&lt;[Arch](electron-builder-core#Arch) \| Array&lt;string&gt;&gt;&gt;</code>
Expand Down Expand Up @@ -197,6 +204,29 @@ AppX Options ([appx](#Config-appx)).
| prepackaged| <code>string</code> \| <code>null</code> |
| **cancellationToken**| <code>[CancellationToken](electron-builder-http#CancellationToken)</code> |


* [`.BuildInfo`](#BuildInfo)
* [`.afterPack(context)`](#module_electron-builder.BuildInfo+afterPack) ⇒ <code>Promise&lt;void&gt;</code>
* [`.dispatchArtifactCreated(event)`](#module_electron-builder.BuildInfo+dispatchArtifactCreated)

<a name="module_electron-builder.BuildInfo+afterPack"></a>

#### `buildInfo.afterPack(context)` ⇒ <code>Promise&lt;void&gt;</code>
**Kind**: instance method of [<code>BuildInfo</code>](#BuildInfo)

| Param | Type |
| --- | --- |
| context | <code>[AfterPackContext](#AfterPackContext)</code> |

<a name="module_electron-builder.BuildInfo+dispatchArtifactCreated"></a>

#### `buildInfo.dispatchArtifactCreated(event)`
**Kind**: instance method of [<code>BuildInfo</code>](#BuildInfo)

| Param | Type |
| --- | --- |
| event | <code>[ArtifactCreated](#ArtifactCreated)</code> |

<a name="BuildOptions"></a>

### `BuildOptions` ⇐ <code>[PublishOptions](electron-publish#PublishOptions)</code>
Expand Down Expand Up @@ -641,6 +671,56 @@ Windows Specific Options ([win](#Config-win)).
| tempDirManager = <code>new TmpDir()</code>| <code>[TmpDir](electron-builder-util#TmpDir)</code> |
| prepackaged| <code>string</code> \| <code>null</code> |


* [.Packager](#Packager) ⇐ <code>[BuildInfo](#BuildInfo)</code>
* [`.addAfterPackHandler(handler)`](#module_electron-builder.Packager+addAfterPackHandler)
* [`.afterPack(context)`](#module_electron-builder.Packager+afterPack) ⇒ <code>Promise&lt;void&gt;</code>
* [`.artifactCreated(handler)`](#module_electron-builder.Packager+artifactCreated) ⇒ <code>[Packager](#Packager)</code>
* [`.build()`](#module_electron-builder.Packager+build) ⇒ <code>Promise&lt;[BuildResult](#BuildResult)&gt;</code>
* [`.dispatchArtifactCreated(event)`](#module_electron-builder.Packager+dispatchArtifactCreated)

<a name="module_electron-builder.Packager+addAfterPackHandler"></a>

#### `packager.addAfterPackHandler(handler)`
**Kind**: instance method of [<code>Packager</code>](#Packager)

| Param | Type |
| --- | --- |
| handler | <code>callback</code> |

<a name="module_electron-builder.Packager+afterPack"></a>

#### `packager.afterPack(context)` ⇒ <code>Promise&lt;void&gt;</code>
**Kind**: instance method of [<code>Packager</code>](#Packager)
**Overrides**: [<code>afterPack</code>](#module_electron-builder.BuildInfo+afterPack)

| Param | Type |
| --- | --- |
| context | <code>[AfterPackContext](#AfterPackContext)</code> |

<a name="module_electron-builder.Packager+artifactCreated"></a>

#### `packager.artifactCreated(handler)` ⇒ <code>[Packager](#Packager)</code>
**Kind**: instance method of [<code>Packager</code>](#Packager)

| Param | Type |
| --- | --- |
| handler | <code>callback</code> |

<a name="module_electron-builder.Packager+build"></a>

#### `packager.build()` ⇒ <code>Promise&lt;[BuildResult](#BuildResult)&gt;</code>
**Kind**: instance method of [<code>Packager</code>](#Packager)
<a name="module_electron-builder.Packager+dispatchArtifactCreated"></a>

#### `packager.dispatchArtifactCreated(event)`
**Kind**: instance method of [<code>Packager</code>](#Packager)
**Overrides**: [<code>dispatchArtifactCreated</code>](#module_electron-builder.BuildInfo+dispatchArtifactCreated)

| Param | Type |
| --- | --- |
| event | <code>[ArtifactCreated](#ArtifactCreated)</code> |

<a name="module_electron-builder.build"></a>

### `electron-builder.build(rawOptions)` ⇒ <code>Promise&lt;Array&lt;string&gt;&gt;</code>
Expand Down
11 changes: 8 additions & 3 deletions docs/api/electron-updater.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Developer API only. See [[Auto Update]] for user documentation.

* [electron-updater/out/NsisUpdater](#module_electron-updater/out/NsisUpdater)
* [.NsisUpdater](#NsisUpdater) ⇐ <code>[AppUpdater](Auto-Update#AppUpdater)</code>
* [`.quitAndInstall()`](#module_electron-updater/out/NsisUpdater.NsisUpdater+quitAndInstall)
* [`.quitAndInstall(isSilent)`](#module_electron-updater/out/NsisUpdater.NsisUpdater+quitAndInstall)
* [`.doDownloadUpdate(versionInfo, fileInfo, cancellationToken)`](#module_electron-updater/out/NsisUpdater.NsisUpdater+doDownloadUpdate) ⇒ <code>Promise&lt;string&gt;</code>

<a name="NsisUpdater"></a>
Expand All @@ -257,13 +257,18 @@ Developer API only. See [[Auto Update]] for user documentation.
**Extends**: <code>[AppUpdater](Auto-Update#AppUpdater)</code>

* [.NsisUpdater](#NsisUpdater) ⇐ <code>[AppUpdater](Auto-Update#AppUpdater)</code>
* [`.quitAndInstall()`](#module_electron-updater/out/NsisUpdater.NsisUpdater+quitAndInstall)
* [`.quitAndInstall(isSilent)`](#module_electron-updater/out/NsisUpdater.NsisUpdater+quitAndInstall)
* [`.doDownloadUpdate(versionInfo, fileInfo, cancellationToken)`](#module_electron-updater/out/NsisUpdater.NsisUpdater+doDownloadUpdate) ⇒ <code>Promise&lt;string&gt;</code>

<a name="module_electron-updater/out/NsisUpdater.NsisUpdater+quitAndInstall"></a>

#### `nsisUpdater.quitAndInstall()`
#### `nsisUpdater.quitAndInstall(isSilent)`
**Kind**: instance method of [<code>NsisUpdater</code>](#NsisUpdater)

| Param | Type |
| --- | --- |
| isSilent | <code>boolean</code> |

<a name="module_electron-updater/out/NsisUpdater.NsisUpdater+doDownloadUpdate"></a>

#### `nsisUpdater.doDownloadUpdate(versionInfo, fileInfo, cancellationToken)` ⇒ <code>Promise&lt;string&gt;</code>
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
"///": "all dependencies for all packages (hoisted)",
"dependencies": {
"7zip-bin": "^2.0.4",
"ajv": "^5.1.1",
"ajv": "^5.1.2",
"ajv-keywords": "^2.0.0",
"archiver": "^1.3.0",
"aws-sdk": "^2.50.0",
"aws-sdk": "^2.54.0",
"bluebird-lst": "^1.0.2",
"chalk": "^1.1.3",
"chromium-pickle-js": "^0.2.0",
"cuint": "^0.2.2",
"debug": "^2.6.6",
"debug": "^2.6.8",
"electron-download-tf": "4.3.1",
"electron-is-dev": "^0.1.2",
"electron-osx-sign": "0.4.4",
Expand All @@ -56,15 +56,15 @@
"sanitize-filename": "^1.6.1",
"semver": "^5.3.0",
"stat-mode": "^0.2.2",
"ts-jsdoc": "^1.2.2",
"ts-jsdoc": "^1.2.3",
"tunnel-agent": "^0.6.0",
"update-notifier": "^2.1.0",
"uuid-1345": "^0.99.6",
"xelement": "^1.0.14",
"yargs": "^8.0.1"
},
"devDependencies": {
"@types/electron": "^1.4.37",
"@types/electron": "^1.4.38",
"@types/ini": "^1.3.29",
"@types/jest": "^19.2.3",
"@types/js-yaml": "^3.5.30",
Expand All @@ -84,7 +84,7 @@
"develar-typescript-json-schema": "0.11.0",
"env-paths": "^1.0.0",
"globby": "^6.1.0",
"jest-cli": "^20.0.1",
"jest-cli": "^20.0.3",
"jest-environment-node-debug": "^2.0.0",
"jest-junit": "^1.5.1",
"jsdoc-to-markdown": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"//": "client can also install js-yaml to load yaml",
"dependencies": {
"debug": "2.6.6",
"debug": "2.6.8",
"fs-extra-p": "^4.3.0"
},
"typings": "./out/electron-builder-http.d.ts"
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"stat-mode": "^0.2.2",
"bluebird-lst": "^1.0.2",
"chalk": "^1.1.3",
"debug": "2.6.6",
"debug": "2.6.8",
"node-emoji": "^1.5.1",
"electron-builder-http": "~0.0.0-semantic-release",
"source-map-support": "^0.4.15",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"homepage": "https://github.com/electron-userland/electron-builder",
"dependencies": {
"7zip-bin": "^2.0.4",
"ajv": "^5.1.1",
"ajv": "^5.1.2",
"ajv-keywords": "^2.0.0",
"bluebird-lst": "^1.0.2",
"chalk": "^1.1.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publisher-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"dependencies": {
"fs-extra-p": "^4.3.0",
"aws-sdk": "^2.50.0",
"aws-sdk": "^2.54.0",
"mime": "^1.3.6",
"electron-publish": "~0.0.0-semantic-release",
"electron-builder-util": "~0.0.0-semantic-release"
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"electron-builder-http": "~0.0.0-semantic-release",
"electron-is-dev": "^0.1.2",
"xelement": "^1.0.14",
"debug": "^2.6.6"
"debug": "^2.6.8"
},
"typings": "./out/electron-updater.d.ts"
}
4 changes: 3 additions & 1 deletion packages/electron-updater/src/AppUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,10 @@ 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.
*/
abstract quitAndInstall(): void
abstract quitAndInstall(isSilent: boolean): void

async loadUpdateConfig() {
if (this._appUpdateConfigPath == null) {
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-updater/src/NsisUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ export class NsisUpdater extends AppUpdater {
})
}

quitAndInstall(): void {
if (this.install(false)) {
quitAndInstall(isSilent: boolean = false): void {
if (this.install(isSilent)) {
this.app.quit()
}
}
Expand Down
2 changes: 0 additions & 2 deletions packages/jsdoc2md.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ async function main() {
"!updater/electron-updater-out-electronHttpExecutor.js",
"!updater/electron-updater-out-*Updater.js",
"!updater/electron-updater-out-*Provider.js",
"updater/electron-updater-out-AppUpdater.js",
"",
], {cwd: source})

const publishOptionsFiles = await globby([
Expand Down
Loading

0 comments on commit daeefa6

Please sign in to comment.