From bb1627a69bbe57473688e31d00dae620a15adfd6 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sat, 12 Aug 2017 01:04:25 +0200 Subject: [PATCH 01/21] Added guide for updates --- docs/tutorial/updates.md | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 docs/tutorial/updates.md diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md new file mode 100644 index 000000000000..740503fe1d57 --- /dev/null +++ b/docs/tutorial/updates.md @@ -0,0 +1,42 @@ +# Updating Applications + +There are several ways to update an Electron application. The easiest and officially supported one is taking advantage of the built-in [Squirrel](https://github.com/Squirrel) framework and the [autoUpdater](../api/auto-updater.md) module that comes with it. + +## Deploying an Update Server + +To get started, you firstly need to deploy an update server (that's where the [autoUpdater](../api/auto-updater.md) module will download new updates from). + +Depending on your needs, you can choose from one of these: + +- [Hazel](https://github.com/zeit/hazel) – Pulls new releases from [GitHub Releases](https://help.github.com/articles/creating-releases/) and is **perfect for getting started** +- [Nuts](https://github.com/GitbookIO/nuts) – Also uses [GitHub Releases](https://help.github.com/articles/creating-releases/), but caches app updates on disk +- [electron-release-server](https://github.com/ArekSredzki/electron-release-server) – Provides you with a dashboard for handling releases + +## Implemeting Updates into Your App + +Once you've deployed your update server, continue with importing the required modules in your code (please ensure that the code below will only be executed in production - you can use [electron-is-dev](https://github.com/sindresorhus/electron-is-dev) for that): + +```js +const { app, autoUpdater } = require('electron') +``` + +Next, put together the URL of the update server: + +```js +const server = +const feed = `${server}/update/${process.platform}/${app.getVersion()}` +``` + +As the final step, tell [autoUpdater](../api/auto-updater.md) where to ask for updates: + +```js +autoUpdater.setFeedURL(feed) +``` + +That's all. Once [built](../tutorial/application-distribution.md), your application will receive an update for each new [GitHub Release](https://help.github.com/articles/creating-releases/) that you create. + +## Further Steps + +Now that you've configured the basic update mechanism for your application, you need to ensure that the user will get notified when there's an update (this can be achieved using [events](../api/auto-updater.md#events)). + +Also make sure that potential errors are [being handled](../api/auto-updater.md#event-error). From c1a40fbd981792b9e3f4f6e84584bb845084315b Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sat, 12 Aug 2017 01:10:20 +0200 Subject: [PATCH 02/21] Linked guide about implementing updates --- docs/api/auto-updater.md | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/docs/api/auto-updater.md b/docs/api/auto-updater.md index 075f0bf93382..432ad3fefd32 100644 --- a/docs/api/auto-updater.md +++ b/docs/api/auto-updater.md @@ -4,24 +4,12 @@ Process: [Main](../glossary.md#main-process) -The `autoUpdater` module provides an interface for the -[Squirrel](https://github.com/Squirrel) framework. - -You can quickly launch a multi-platform release server for distributing your -application by using one of these projects: - -- [nuts][nuts]: *A smart release server for your applications, using GitHub as a backend. Auto-updates with Squirrel (Mac & Windows)* -- [electron-release-server][electron-release-server]: *A fully featured, - self-hosted release server for electron applications, compatible with - auto-updater* -- [squirrel-updates-server][squirrel-updates-server]: *A simple node.js server - for Squirrel.Mac and Squirrel.Windows which uses GitHub releases* -- [squirrel-release-server][squirrel-release-server]: *A simple PHP application for Squirrel.Windows which reads updates from a folder. Supports delta updates.* +**You can find a detailed guide about how to implement updates into your application [here](../tutorial/updates.md).** ## Platform notices -Though `autoUpdater` provides a uniform API for different platforms, there are -still some subtle differences on each platform. +Although `autoUpdater` provides a uniform API for different platforms, there are +still some subtle differences on each platform: ### macOS @@ -134,7 +122,3 @@ from the normal quit event sequence. [installer-lib]: https://github.com/electron/windows-installer [electron-forge-lib]: https://github.com/electron-userland/electron-forge [app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx -[electron-release-server]: https://github.com/ArekSredzki/electron-release-server -[squirrel-updates-server]: https://github.com/Aluxian/squirrel-updates-server -[nuts]: https://github.com/GitbookIO/nuts -[squirrel-release-server]: https://github.com/Arcath/squirrel-release-server From 3815ed8af4082e48eaeed5b59f0b9ac3e0e3ab03 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sat, 12 Aug 2017 01:18:34 +0200 Subject: [PATCH 03/21] Fixed a typo --- docs/tutorial/updates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index 740503fe1d57..11550c636963 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -12,7 +12,7 @@ Depending on your needs, you can choose from one of these: - [Nuts](https://github.com/GitbookIO/nuts) – Also uses [GitHub Releases](https://help.github.com/articles/creating-releases/), but caches app updates on disk - [electron-release-server](https://github.com/ArekSredzki/electron-release-server) – Provides you with a dashboard for handling releases -## Implemeting Updates into Your App +## Implementing Updates into Your App Once you've deployed your update server, continue with importing the required modules in your code (please ensure that the code below will only be executed in production - you can use [electron-is-dev](https://github.com/sindresorhus/electron-is-dev) for that): From 06f4c1b3372483a0978dcd17f43aa00684ea0a35 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sat, 12 Aug 2017 01:23:54 +0200 Subject: [PATCH 04/21] Be clear about the usage example --- docs/tutorial/updates.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index 11550c636963..60862ddc56d3 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -14,7 +14,9 @@ Depending on your needs, you can choose from one of these: ## Implementing Updates into Your App -Once you've deployed your update server, continue with importing the required modules in your code (please ensure that the code below will only be executed in production - you can use [electron-is-dev](https://github.com/sindresorhus/electron-is-dev) for that): +Once you've deployed your update server, continue with importing the required modules in your code. The following code might vary for a different update server, but it works like described when using [Hazel](https://github.com/zeit/hazel). + +**Important:** Please ensure that the code below will only be executed in production - you can use [electron-is-dev](https://github.com/sindresorhus/electron-is-dev) to check for the environment). ```js const { app, autoUpdater } = require('electron') From cfe914ff8323afcd5131e562aacbf696c3d70625 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sat, 12 Aug 2017 01:24:56 +0200 Subject: [PATCH 05/21] Fixed wording --- docs/tutorial/updates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index 60862ddc56d3..bd3d5d345a7d 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -14,7 +14,7 @@ Depending on your needs, you can choose from one of these: ## Implementing Updates into Your App -Once you've deployed your update server, continue with importing the required modules in your code. The following code might vary for a different update server, but it works like described when using [Hazel](https://github.com/zeit/hazel). +Once you've deployed your update server, continue with importing the required modules in your code (the following code might vary for different server software, but it works like described when using [Hazel](https://github.com/zeit/hazel)). **Important:** Please ensure that the code below will only be executed in production - you can use [electron-is-dev](https://github.com/sindresorhus/electron-is-dev) to check for the environment). From 01f31edb95f7658e57fb5fd8f9e3522583f1a287 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sat, 12 Aug 2017 01:30:29 +0200 Subject: [PATCH 06/21] Cut down platform notices a little --- docs/api/auto-updater.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/docs/api/auto-updater.md b/docs/api/auto-updater.md index 432ad3fefd32..4cfce603a016 100644 --- a/docs/api/auto-updater.md +++ b/docs/api/auto-updater.md @@ -6,10 +6,13 @@ Process: [Main](../glossary.md#main-process) **You can find a detailed guide about how to implement updates into your application [here](../tutorial/updates.md).** -## Platform notices +## Platform Notices -Although `autoUpdater` provides a uniform API for different platforms, there are -still some subtle differences on each platform: +Currently, only macOS and Windows are supported. There is no built-in support +for auto-updater on Linux, so it is recommended to use the +distribution's package manager to update your app. + +In addition, there are some subtle differences on each platform: ### macOS @@ -38,15 +41,6 @@ The installer generated with Squirrel will create a shortcut icon with an same ID for your app with `app.setAppUserModelId` API, otherwise Windows will not be able to pin your app properly in task bar. -Unlike Squirrel.Mac, Windows can host updates on S3 or any other static file host. -You can read the documents of [Squirrel.Windows][squirrel-windows] to get more details -about how Squirrel.Windows works. - -### Linux - -There is no built-in support for auto-updater on Linux, so it is recommended to -use the distribution's package manager to update your app. - ## Events The `autoUpdater` object emits the following events: From 837a34cf71ee7eb2c4c2e758cefd6ddfef2bb554 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sat, 12 Aug 2017 12:44:21 +0200 Subject: [PATCH 07/21] Indicate that Nuts supports private repositories --- docs/tutorial/updates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index bd3d5d345a7d..48a6b0fb4693 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -9,7 +9,7 @@ To get started, you firstly need to deploy an update server (that's where the [a Depending on your needs, you can choose from one of these: - [Hazel](https://github.com/zeit/hazel) – Pulls new releases from [GitHub Releases](https://help.github.com/articles/creating-releases/) and is **perfect for getting started** -- [Nuts](https://github.com/GitbookIO/nuts) – Also uses [GitHub Releases](https://help.github.com/articles/creating-releases/), but caches app updates on disk +- [Nuts](https://github.com/GitbookIO/nuts) – Also uses [GitHub Releases](https://help.github.com/articles/creating-releases/), but caches app updates on disk and supports private repositories - [electron-release-server](https://github.com/ArekSredzki/electron-release-server) – Provides you with a dashboard for handling releases ## Implementing Updates into Your App From 235ae0989fb143be15eb413577e76b15bb6d90a4 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sat, 12 Aug 2017 12:48:49 +0200 Subject: [PATCH 08/21] Mention that the app needs to check for updates --- docs/tutorial/updates.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index 48a6b0fb4693..6235d5cbea87 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -22,17 +22,21 @@ Once you've deployed your update server, continue with importing the required mo const { app, autoUpdater } = require('electron') ``` -Next, put together the URL of the update server: +Next, put together the URL of the update server and tell [autoUpdater](../api/auto-updater.md) about it: ```js const server = const feed = `${server}/update/${process.platform}/${app.getVersion()}` + +autoUpdater.setFeedURL(feed) ``` -As the final step, tell [autoUpdater](../api/auto-updater.md) where to ask for updates: +As the final step, check for updates (the example below will check every minute): ```js -autoUpdater.setFeedURL(feed) +setInterval(() => { + autoUpdater.checkForUpdates() +}, 60000) ``` That's all. Once [built](../tutorial/application-distribution.md), your application will receive an update for each new [GitHub Release](https://help.github.com/articles/creating-releases/) that you create. From 6a872dd938412b5371ab5ef27bd1c5ecc2dd0260 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Mon, 14 Aug 2017 13:26:33 -0700 Subject: [PATCH 09/21] update the updates doc --- docs/tutorial/updates.md | 52 ++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index 6235d5cbea87..3303d2482297 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -1,31 +1,47 @@ # Updating Applications -There are several ways to update an Electron application. The easiest and officially supported one is taking advantage of the built-in [Squirrel](https://github.com/Squirrel) framework and the [autoUpdater](../api/auto-updater.md) module that comes with it. +There are several ways to update an Electron application. The easiest and +officially supported one is taking advantage of the built-in +[Squirrel](https://github.com/Squirrel) framework and +Electron's [autoUpdater](../api/auto-updater.md) module. -## Deploying an Update Server +## Deploying an update server -To get started, you firstly need to deploy an update server (that's where the [autoUpdater](../api/auto-updater.md) module will download new updates from). +To get started, you first need to deploy a server that the +[autoUpdater](../api/auto-updater.md) module will download new updates from. Depending on your needs, you can choose from one of these: -- [Hazel](https://github.com/zeit/hazel) – Pulls new releases from [GitHub Releases](https://help.github.com/articles/creating-releases/) and is **perfect for getting started** -- [Nuts](https://github.com/GitbookIO/nuts) – Also uses [GitHub Releases](https://help.github.com/articles/creating-releases/), but caches app updates on disk and supports private repositories -- [electron-release-server](https://github.com/ArekSredzki/electron-release-server) – Provides you with a dashboard for handling releases +- [Hazel](https://github.com/zeit/hazel) – Pulls new releases from +[GitHub Releases](https://help.github.com/articles/creating-releases/) and can +be deployed for free on the [Now](https://zeit.co/now) hosting platform. +- [Nuts](https://github.com/GitbookIO/nuts) – Also uses +[GitHub Releases](https://help.github.com/articles/creating-releases/), +but caches app updates on disk and supports private repositories. +- [electron-release-server](https://github.com/ArekSredzki/electron-release-server) – +Provides a dashboard for handling releases -## Implementing Updates into Your App +## Implementing updates in your app -Once you've deployed your update server, continue with importing the required modules in your code (the following code might vary for different server software, but it works like described when using [Hazel](https://github.com/zeit/hazel)). +Once you've deployed your update server, continue with importing the required +modules in your code. The following code might vary for different server +software, but it works like described when using +[Hazel](https://github.com/zeit/hazel). -**Important:** Please ensure that the code below will only be executed in production - you can use [electron-is-dev](https://github.com/sindresorhus/electron-is-dev) to check for the environment). +**Important:** Please ensure that the code below will only be executed in +your packaged app. You can use +[electron-is-dev](https://github.com/sindresorhus/electron-is-dev) to check for +the environment. ```js const { app, autoUpdater } = require('electron') ``` -Next, put together the URL of the update server and tell [autoUpdater](../api/auto-updater.md) about it: +Next, construct the URL of the update server and tell +[autoUpdater](../api/auto-updater.md) about it: ```js -const server = +const server = 'https://your-deployment-url.com' const feed = `${server}/update/${process.platform}/${app.getVersion()}` autoUpdater.setFeedURL(feed) @@ -39,10 +55,16 @@ setInterval(() => { }, 60000) ``` -That's all. Once [built](../tutorial/application-distribution.md), your application will receive an update for each new [GitHub Release](https://help.github.com/articles/creating-releases/) that you create. +That's all. Once [built](../tutorial/application-distribution.md), your +application will receive an update for each new +[GitHub Release](https://help.github.com/articles/creating-releases/) that you +create. -## Further Steps +## Further steps -Now that you've configured the basic update mechanism for your application, you need to ensure that the user will get notified when there's an update (this can be achieved using [events](../api/auto-updater.md#events)). +Now that you've configured the basic update mechanism for your application, you +need to ensure that the user will get notified when there's an update +(this can be achieved using [events](../api/auto-updater.md#events)). -Also make sure that potential errors are [being handled](../api/auto-updater.md#event-error). +Also make sure that potential errors are +[being handled](../api/auto-updater.md#event-error). From 3405596983ab7e78b229fba2cf16cc040549a367 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Tue, 15 Aug 2017 11:24:59 +0200 Subject: [PATCH 10/21] Brought back Windows section --- docs/api/auto-updater.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api/auto-updater.md b/docs/api/auto-updater.md index 4cfce603a016..aeb375e0aa05 100644 --- a/docs/api/auto-updater.md +++ b/docs/api/auto-updater.md @@ -41,6 +41,8 @@ The installer generated with Squirrel will create a shortcut icon with an same ID for your app with `app.setAppUserModelId` API, otherwise Windows will not be able to pin your app properly in task bar. +Unlike Squirrel.Mac, Windows can host updates on S3 or any other static file host. + ## Events The `autoUpdater` object emits the following events: From 78f11df6e410aac960c05916859f04ad2b262595 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Tue, 15 Aug 2017 11:27:33 +0200 Subject: [PATCH 11/21] Full Windows section is back --- docs/api/auto-updater.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api/auto-updater.md b/docs/api/auto-updater.md index aeb375e0aa05..f007da9cd368 100644 --- a/docs/api/auto-updater.md +++ b/docs/api/auto-updater.md @@ -42,6 +42,8 @@ same ID for your app with `app.setAppUserModelId` API, otherwise Windows will not be able to pin your app properly in task bar. Unlike Squirrel.Mac, Windows can host updates on S3 or any other static file host. +You can read the documents of [Squirrel.Windows][squirrel-windows] to get more details +about how Squirrel.Windows works. ## Events From 3062027bab4b0f0491c5279afcd36d92246d26ce Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Tue, 15 Aug 2017 11:29:28 +0200 Subject: [PATCH 12/21] Better wording about Now deployment --- docs/tutorial/updates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index 3303d2482297..a284c5b95190 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -14,7 +14,7 @@ Depending on your needs, you can choose from one of these: - [Hazel](https://github.com/zeit/hazel) – Pulls new releases from [GitHub Releases](https://help.github.com/articles/creating-releases/) and can -be deployed for free on the [Now](https://zeit.co/now) hosting platform. +be deployed for free on [Now](https://zeit.co/now). - [Nuts](https://github.com/GitbookIO/nuts) – Also uses [GitHub Releases](https://help.github.com/articles/creating-releases/), but caches app updates on disk and supports private repositories. From 4ba4fe4f62231ccf8e880b23b7f8f1151778a02c Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Tue, 15 Aug 2017 11:38:54 +0200 Subject: [PATCH 13/21] Examples for events --- docs/tutorial/updates.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index a284c5b95190..f0108b60cc6e 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -63,8 +63,19 @@ create. ## Further steps Now that you've configured the basic update mechanism for your application, you -need to ensure that the user will get notified when there's an update -(this can be achieved using [events](../api/auto-updater.md#events)). +need to ensure that the user will get notified when there's an update. This +can be achieved using [events](../api/auto-updater.md#events): -Also make sure that potential errors are -[being handled](../api/auto-updater.md#event-error). +```js +autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => { + // Show a notification banner to the user that allows triggering the update +}) +``` + +Also make sure that errors are +[being handled](../api/auto-updater.md#event-error). Here's an example +for logging them to `stderr`: + +```js +autoUpdater.on('error', console.error) +``` From 68250d80cd756f17c33b869bc2b5826af8e95732 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Tue, 15 Aug 2017 21:38:31 +0200 Subject: [PATCH 14/21] Improved error logging --- docs/tutorial/updates.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index f0108b60cc6e..5f448e329c60 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -77,5 +77,8 @@ Also make sure that errors are for logging them to `stderr`: ```js -autoUpdater.on('error', console.error) +autoUpdater.on('error', message => { + console.error('There was a problem updating the application') + console.error(message) +}) ``` From 35b2bc6b513041e81ef51a91f0a2645b0d99d0eb Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Tue, 15 Aug 2017 12:53:46 -0700 Subject: [PATCH 15/21] implement a dialog in the download handler --- docs/tutorial/updates.md | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index 5f448e329c60..6cc16b172311 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -29,12 +29,12 @@ software, but it works like described when using [Hazel](https://github.com/zeit/hazel). **Important:** Please ensure that the code below will only be executed in -your packaged app. You can use +your packaged app, and not in development. You can use [electron-is-dev](https://github.com/sindresorhus/electron-is-dev) to check for the environment. ```js -const { app, autoUpdater } = require('electron') +const { app, autoUpdater, dialog } = require('electron') ``` Next, construct the URL of the update server and tell @@ -55,20 +55,30 @@ setInterval(() => { }, 60000) ``` -That's all. Once [built](../tutorial/application-distribution.md), your -application will receive an update for each new +Once your application is [packaged](../tutorial/application-distribution.md), +it will receive an update for each new [GitHub Release](https://help.github.com/articles/creating-releases/) that you -create. +publish. -## Further steps +## Applying updates Now that you've configured the basic update mechanism for your application, you need to ensure that the user will get notified when there's an update. This -can be achieved using [events](../api/auto-updater.md#events): +can be achieved using the autoUpdater API +[events](../api/auto-updater.md#events): ```js autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => { - // Show a notification banner to the user that allows triggering the update + const dialogOpts = { + type: 'info', + buttons: ['Restart', 'Later'], + title: 'Application Update', + message: 'A new version has been downloaded. Restart the application to apply the updates.', + detail: releaseName + '\n\n' + releaseNotes + } + dialog.showMessageBox(dialogOpts, function(response) { + if (response === 0) autoUpdater.quitAndInstall() + }) }) ``` @@ -81,4 +91,4 @@ autoUpdater.on('error', message => { console.error('There was a problem updating the application') console.error(message) }) -``` +``` \ No newline at end of file From 2ec223ba11cb5b14de0b28ed3a28d0f9f473f53c Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Tue, 15 Aug 2017 13:04:52 -0700 Subject: [PATCH 16/21] use an arrow function --- docs/tutorial/updates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index 6cc16b172311..d9ba2bc262dc 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -76,7 +76,7 @@ autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => { message: 'A new version has been downloaded. Restart the application to apply the updates.', detail: releaseName + '\n\n' + releaseNotes } - dialog.showMessageBox(dialogOpts, function(response) { + dialog.showMessageBox(dialogOpts, (response) => { if (response === 0) autoUpdater.quitAndInstall() }) }) From a84d49fe5cc67f6c322facfab320bacc4e47a708 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Tue, 15 Aug 2017 13:06:45 -0700 Subject: [PATCH 17/21] add newline --- docs/tutorial/updates.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index d9ba2bc262dc..1698fdc13258 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -76,6 +76,7 @@ autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => { message: 'A new version has been downloaded. Restart the application to apply the updates.', detail: releaseName + '\n\n' + releaseNotes } + dialog.showMessageBox(dialogOpts, (response) => { if (response === 0) autoUpdater.quitAndInstall() }) From 5f821682133f77a5b965f4a9f7ba50400799f3c9 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Tue, 15 Aug 2017 13:09:06 -0700 Subject: [PATCH 18/21] lint --- docs/tutorial/updates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index 1698fdc13258..a09676b41766 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -76,7 +76,7 @@ autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => { message: 'A new version has been downloaded. Restart the application to apply the updates.', detail: releaseName + '\n\n' + releaseNotes } - + dialog.showMessageBox(dialogOpts, (response) => { if (response === 0) autoUpdater.quitAndInstall() }) From 78c87d4bd3bf8be55ed1fbb7f7011ff8c56a1e9a Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Tue, 15 Aug 2017 22:55:55 +0200 Subject: [PATCH 19/21] Made dialog message clear --- docs/tutorial/updates.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index a09676b41766..579c3702f6f7 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -73,8 +73,8 @@ autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => { type: 'info', buttons: ['Restart', 'Later'], title: 'Application Update', - message: 'A new version has been downloaded. Restart the application to apply the updates.', - detail: releaseName + '\n\n' + releaseNotes + message: process.platform === 'win32' ? releaseNotes : releaseName, + detail: 'A new version has been downloaded. Restart the application to apply the updates.' } dialog.showMessageBox(dialogOpts, (response) => { @@ -92,4 +92,4 @@ autoUpdater.on('error', message => { console.error('There was a problem updating the application') console.error(message) }) -``` \ No newline at end of file +``` From 1731359a1745b47ff97f97b9dccd2050ce3479bb Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Mon, 21 Aug 2017 15:19:59 -0700 Subject: [PATCH 20/21] tweak the updates guide --- docs/tutorial/updates.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/tutorial/updates.md b/docs/tutorial/updates.md index 579c3702f6f7..8dd97b6bf98f 100644 --- a/docs/tutorial/updates.md +++ b/docs/tutorial/updates.md @@ -12,9 +12,10 @@ To get started, you first need to deploy a server that the Depending on your needs, you can choose from one of these: -- [Hazel](https://github.com/zeit/hazel) – Pulls new releases from -[GitHub Releases](https://help.github.com/articles/creating-releases/) and can -be deployed for free on [Now](https://zeit.co/now). +- [Hazel](https://github.com/zeit/hazel) – Simple update server for open-source +apps. Pulls from +[GitHub Releases](https://help.github.com/articles/creating-releases/) +and can be deployed for free on [Now](https://zeit.co/now). - [Nuts](https://github.com/GitbookIO/nuts) – Also uses [GitHub Releases](https://help.github.com/articles/creating-releases/), but caches app updates on disk and supports private repositories. @@ -34,7 +35,7 @@ your packaged app, and not in development. You can use the environment. ```js -const { app, autoUpdater, dialog } = require('electron') +const {app, autoUpdater, dialog} = require('electron') ``` Next, construct the URL of the update server and tell @@ -47,7 +48,7 @@ const feed = `${server}/update/${process.platform}/${app.getVersion()}` autoUpdater.setFeedURL(feed) ``` -As the final step, check for updates (the example below will check every minute): +As the final step, check for updates. The example below will check every minute: ```js setInterval(() => { From b6787dbbb3c3cd634a0119d838943278d09d29ad Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Mon, 21 Aug 2017 15:22:13 -0700 Subject: [PATCH 21/21] link to updates guide from docs readme --- docs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/README.md b/docs/README.md index a82edbffd974..92bccccbd8f4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -33,6 +33,7 @@ an issue: * [Testing on Headless CI Systems (Travis, Jenkins)](tutorial/testing-on-headless-ci.md) * [Offscreen Rendering](tutorial/offscreen-rendering.md) * [Keyboard Shortcuts](tutorial/keyboard-shortcuts.md) +* [Updating Applications](tutorial/updates.md) ## Tutorials