|
1 | | -To benefit from auto updates, you have to implement and configure Electron's [`autoUpdater`](http://electron.atom.io/docs/latest/api/auto-updater/) module ([example](https://github.com/develar/onshape-desktop-shell/blob/master/src/AppUpdater.ts)). |
2 | | - |
3 | 1 | See the [Publishing Artifacts](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts) section of the [Wiki](https://github.com/electron-userland/electron-builder/wiki) for more information on how to configure your CI environment for automated deployments. |
4 | 2 |
|
5 | | - |
6 | | -**NOTICE**: [macOS auto-update](https://github.com/electron/electron/blob/master/docs/api/auto-updater.md#macos) is not yet simplified. Update providers supported only on Windows. |
| 3 | +Real project [example](https://github.com/develar/onshape-desktop-shell/blob/master/src/AppUpdater.ts). |
7 | 4 |
|
8 | 5 | ## Quick Setup Guide |
9 | 6 |
|
10 | | -1. Install `electron-auto-updater` as app dependency. |
| 7 | +1. Install `electron-auto-updater` as an app dependency. |
11 | 8 |
|
12 | 9 | 2. [Configure publish](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#PublishConfiguration). |
13 | 10 |
|
14 | 11 | 3. Use `autoUpdater` from `electron-auto-updater` instead of `electron`, e.g. (ES 6): |
15 | 12 |
|
16 | 13 | ```js |
17 | 14 | import {autoUpdater} from "electron-auto-updater" |
18 | | - ``` |
19 | | - |
20 | | - `electron-auto-updater` works in the same way as electron bundled, it allows you to avoid conditional statements and use the same API across platforms. |
| 15 | + ``` |
21 | 16 |
|
22 | | -4. Do not call `setFeedURL` on Windows. electron-builder automatically creates `app-update.yml` file for you on build in the `resources` (this file is internal, you don't need to be aware of it). But if need, you can — for example, to explicitly set `BintrayOptions`: |
| 17 | +4. Do not call `setFeedURL`. electron-builder automatically creates `app-update.yml` file for you on build in the `resources` (this file is internal, you don't need to be aware of it). |
| 18 | + |
| 19 | + But if need, you can — for example, to explicitly configure Bintray provider: |
23 | 20 | ```js |
24 | 21 | { |
25 | 22 | provider: "bintray", |
26 | 23 | owner: "actperepo", |
27 | | - package: "no-versions", |
| 24 | + package: "no-versions" |
28 | 25 | } |
29 | 26 | ``` |
30 | 27 |
|
31 | | -Currently, `generic` (any HTTPS web server), `github` and `bintray` are supported. `latest.yml` will be generated in addition to installer for `generic` and `github` and must be uploaded also (in short: only `bintray` doesn't use `latest.yml` and this file must be not uploaded on Bintray). |
| 28 | +Currently, [generic](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#GenericServerOptions) (any HTTPS web server), [github](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#GithubOptions) and [bintray](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#BintrayOptions) are supported. |
| 29 | +`latest.yml` (or `latest-mac.json` for macOS) will be generated in addition to installer for `generic` and `github` and must be uploaded also (in short: only `bintray` doesn't use `latest.yml` and this file must be not uploaded on Bintray). |
| 30 | + |
| 31 | +**NOTICE**: Bintray provider doesn't support [macOS auto-update](https://github.com/electron/electron/blob/master/docs/api/auto-updater.md#macos) currently. If need, please file issue. |
| 32 | +
|
| 33 | +## Debugging |
| 34 | +
|
| 35 | +You don't need to listen all events to understand what's wrong. Just set `logger`. |
| 36 | +[electron-log](https://github.com/megahertz/electron-log) is recommended (it is an additional dependency that you can install if needed). |
| 37 | +
|
| 38 | +```js |
| 39 | +autoUpdater.logger = require("electron-log") |
| 40 | +autoUpdater.logger.transports.file.level = "info" |
| 41 | +``` |
32 | 42 |
|
33 | 43 | ## Options |
34 | 44 |
|
35 | 45 | Name | Default | Description |
36 | 46 | --------------------|-------------------------|------------ |
37 | | -autoDownload | true | Automatically download an update when it is found. |
| 47 | +autoDownload | `true` | Automatically download an update when it is found. |
| 48 | +logger | `console` | The logger. You can pass [electron-log](https://github.com/megahertz/electron-log), [winston](https://github.com/winstonjs/winston) or another logger with the following interface: `{ info(), warn(), error() }`. Set it to `null` if you would like to disable a logging feature. |
38 | 49 |
|
39 | 50 | ## Events |
40 | 51 |
|
|
0 commit comments