Skip to content

Commit 6dfa35f

Browse files
oaleynikrogerwang
authored andcommitted
[doc] Added "Autoupdates.md"
1 parent ff403d0 commit 6dfa35f

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

docs/For Developers/Contributors of Documents.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
---
33

44
* Roger Wang <roger.wang@intel.com>
5-
* Cong Liu <cong.liu@intel.com>
5+
* Cong Liu <cong.liu@intel.com>
6+
* Oleg Aleynik <oleg.aleynik@gmail.com>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Autoupdates
2+
---
3+
4+
[TOC]
5+
6+
NWJS tend to support the update solution made by community, not a built-in one. Below is the list of existing soutions, which worth checking.
7+
- [node-webkit-updater](https://github.com/edjafarov/node-webkit-updater) (by [@edjafarov](https://github.com/edjafarov))
8+
- [nwjs-autoupdater](https://github.com/oaleynik/nwjs-autoupdater) (by [@oaleynik](https://github.com/oaleynik))
9+
10+
## node-webkit-updater
11+
12+
NPM module which gives you the low-level API to:
13+
14+
- Check the manifest for version (from your running "old" app).
15+
- If the version is different from the running one, download new package to a temp directory.
16+
- Unpack the package in temp.
17+
- Run new app from temp and kill the old one (i.e. still all from the running app).
18+
- The new app (in temp) will copy itself to the original folder, overwriting the old app.
19+
- The new app will run itself from original folder and exit the process.
20+
21+
You should build this logic by yourself though ([basic example](https://github.com/edjafarov/node-webkit-updater/blob/master/examples/basic.js)).
22+
23+
## nwjs-autoupdater
24+
25+
The tiny golang application (when built it is just ~2MB), which can be bundled with NWJS application and then used to unpack updates.
26+
To update target application updater needs to know two things - where zip archive with the new version is located and where is the app's executable to restart application after update. These can be passed to updater via command line arguments `--bundle` and `--inst-dir`, where `--bundle` is the path to the zip archive with the new app version and `--inst-dir` is the path to app's executable.
27+
28+
There are multiple advantages over `node-webkit-updater`:
29+
30+
- It can update the updater itself.
31+
- Doesn't require elevated privilegies (unless application itself has been installed in the folder which require elevated privilegies).
32+
- Updater's executalbe has way smaller size as it doesn't require bundling the whole new NWJS application with the main application.
33+
34+
The logic to check for updates needs to be built on your own too. The [example](https://github.com/oaleynik/nwjs-autoupdater/blob/master/examples/index.js) shows the way how to use javascript module as an entry point for NWJS application and check for updates in background.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pages:
4343
- 'Use Flash Plugin': 'For Users/Advanced/Use Flash Plugin.md'
4444
- 'Use NaCl in NW.js': 'For Users/Advanced/Use NaCl in NW.js.md'
4545
- 'Use Native Node Modules': 'For Users/Advanced/Use Native Node Modules.md'
46+
- 'Autoupdates': 'For Users/Advanced/Autoupdates.md'
4647
- 'References':
4748
- 'App': 'References/App.md'
4849
- 'Changes to DOM': 'References/Changes to DOM.md'

0 commit comments

Comments
 (0)