You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is [node-webkit](https://github.com/rogerwang/node-webkit)-updater.
4
-
5
-
```
6
-
npm install node-webkit-updater
7
-
```
8
-
9
-
It gives you low-level API to:
10
-
11
-
1. Check the manifest for version (from your running "old" app).
12
-
2. If the version is different from the running one, download new package to a temp directory.
13
-
3. Unpack the package in temp.
14
-
4. Run new app from temp and kill the old one (i.e. still all from the running app).
15
-
5. The new app (in temp) will copy itself to the original folder, overriding the old app.
16
-
6. The new app will run itself from original folder and exit the process.
17
-
18
-
You should build this logic by yourself though. As a reference you can use [example](app/index.html).
19
-
20
-
Covered by tests and works for [linux](http://screencast.com/t/Je2ptbHhP), [windows](http://screencast.com/t/MSTKqVS3) and [mac](http://screencast.com/t/OXyC5xoA).
21
-
### How to run the tests
22
-
```
23
-
git clone git@github.com:edjafarov/updater.git
24
-
npm run deps
25
-
npm test
26
-
```
27
-
28
-
## Quick Start
29
-
```javascript
30
-
var gui =require('nw.gui');
31
-
var pkg =require('../package.json'); // Insert your app's manifest here
32
-
var updater =require('node-webkit-updater');
33
-
var upd =newupdater(pkg);
34
-
35
-
/* Checks the remote manifest for latest available version and calls the autoupgrading function */
This is [node-webkit](https://github.com/rogerwang/node-webkit)-updater.
4
+
5
+
```
6
+
npm install node-webkit-updater
7
+
```
8
+
9
+
It gives you low-level API to:
10
+
11
+
1. Check the manifest for version (from your running "old" app).
12
+
2. If the version is different from the running one, download new package to a temp directory.
13
+
3. Unpack the package in temp.
14
+
4. Run new app from temp and kill the old one (i.e. still all from the running app).
15
+
5. The new app (in temp) will copy itself to the original folder, overriding the old app.
16
+
6. The new app will run itself from original folder and exit the process.
17
+
18
+
You should build this logic by yourself though. As a reference you can use [example](app/index.html).
19
+
20
+
Covered by tests and works for [linux](http://screencast.com/t/Je2ptbHhP), [windows](http://screencast.com/t/MSTKqVS3) and [mac](http://screencast.com/t/OXyC5xoA).
21
+
### How to run the tests
22
+
```
23
+
git clone git@github.com:edjafarov/updater.git
24
+
npm run deps
25
+
npm test
26
+
```
27
+
28
+
## Quick Start
29
+
```javascript
30
+
var gui =require('nw.gui');
31
+
var pkg =require('../package.json'); // Insert your app's manifest here
32
+
var updater =require('node-webkit-updater');
33
+
var upd =newupdater(pkg);
34
+
35
+
/* Checks the remote manifest for latest available version and calls the autoupgrading function */
As a reference you can use the [example](https://github.com/edjafarov/updater/blob/master/app/index.html).
61
+
62
62
<aname="new_updater"></a>
63
63
###new updater(manifest)
64
-
Creates new instance of updater. Manifest could be a `package.json` of project.```json{ "name": "updapp", "version": "0.0.2", "author": "Eldar Djafarov <djkojb@gmail.com>", "manifestUrl": "http://localhost:3000/package.json", "packages": { "mac": "http://localhost:3000/releases/updapp/mac/updapp.zip", "win": "http://localhost:3000/releases/updapp/win/updapp.zip", "linux32": "http://localhost:3000/releases/updapp/linux32/updapp.tar.gz" }}```Inside the app manifest, you need to specify where to download packages from for all supported OS'es, a manifest url where this manifest can be found and the current version of the app.Note that compressed apps are assumed to be downloaded in the format produced by [node-webkit-builder](https://github.com/mllrsohn/node-webkit-builder) (or [grunt-node-webkit-builder](https://github.com/mllrsohn/grunt-node-webkit-builder)).
64
+
Creates new instance of updater. Manifest could be a `package.json` of project.
65
+
66
+
Note that compressed apps are assumed to be downloaded in the format produced by [node-webkit-builder](https://github.com/mllrsohn/node-webkit-builder) (or [grunt-node-webkit-builder](https://github.com/mllrsohn/grunt-node-webkit-builder)).
65
67
66
68
**Params**
67
69
68
-
- manifest `object`
70
+
- manifest `object`- See the [manifest schema](#manifest-schema) below.
69
71
70
72
<aname="updater#checkNewVersion"></a>
71
73
###updater.checkNewVersion(cb)
72
-
Will check the latest available version of the application by requesting the manifest specified in `manufestUrl`.The callback will always be called; the second paramter indicates whether or not there's a newer version.This function assumes you use [Semantic Versioning](http://semver.org) and enforces it; if your local version is `0.2.0` and the remote one is `0.1.23456` then the callback will be called with `false` as the second paramter. If on the off chance you don't use semantic versioning, you could manually download the remote manifest and call `download` if you're happy that the remote version is newer.
74
+
Will check the latest available version of the application by requesting the manifest specified in `manifestUrl`.
75
+
76
+
The callback will always be called; the second parameter indicates whether or not there's a newer version.
77
+
This function assumes you use [Semantic Versioning](http://semver.org) and enforces it; if your local version is `0.2.0` and the remote one is `0.1.23456` then the callback will be called with `false` as the second paramter. If on the off chance you don't use semantic versioning, you could manually download the remote manifest and call `download` if you're happy that the remote version is newer.
It's assumed your app is stored at the root of your package, use this to override that and specify a path (relative to the root of your package).
198
+
199
+
This can also be used to override `manifest.name`; e.g. if your `manifest.name` is `helloWorld` (therefore `helloWorld.app` on Mac) but your Windows executable is named `nw.exe`. Then you'd set `execPath` to `nw.exe`
200
+
201
+
---
202
+
203
+
## Troubleshooting
204
+
205
+
If you get an error on Mac about too many files being open, run `ulimit -n 10240`
206
+
207
+
## Contributing
208
+
209
+
See [CONTRIBUTING.md](CONTRIBUTING.md)
136
210
137
-
---
138
-
139
-
## Troubleshooting
140
-
141
-
If you get an error on Mac about too many files being open, run `ulimit -n 10240`
0 commit comments