forked from nwutils/nw-updater
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.hbs
94 lines (66 loc) · 3.08 KB
/
README.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
node-webkit-updater [![NPM version][npm-image]][npm-url]
=======
This is [node-webkit](https://github.com/rogerwang/node-webkit)-updater.
```
npm install node-webkit-updater
```
It gives you low-level API to:
1. Check the manifest for version (from your running "old" app).
2. If the version is different from the running one, download new package to a temp directory.
3. Unpack the package in temp.
4. Run new app from temp and kill the old one (i.e. still all from the running app).
5. The new app (in temp) will copy itself to the original folder, overwriting the old app.
6. The new app will run itself from original folder and exit the process.
You should build this logic by yourself though. As a reference you can use [example](app/index.html).
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).
## Examples
- [Basic](examples/basic.js)
## API
{{heading-depth-set 2~}}
{{#class name="updater"~}}
{{>body~}}
{{>members~}}
{{/class}}
---
## Manifest Schema
An example manifest:
```json
{
"name": "updapp",
"version": "0.0.2",
"author": "Eldar Djafarov <[email protected]>",
"manifestUrl": "http://localhost:3000/package.json",
"packages": {
"mac": {
"url": "http://localhost:3000/releases/updapp/mac/updapp.zip"
},
"win": {
"url": "http://localhost:3000/releases/updapp/win/updapp.zip"
},
"linux32": {
"url": "http://localhost:3000/releases/updapp/linux32/updapp.tar.gz"
}
}
}
```
The manifest could be a `package.json` of project, but doesn't have to be.
### manifest.name
The name of your app. From time, it is assumed your Mac app is called `<manifest.name>.app`, your Windows executable is `<manifest.name>.exe`, etc.
### manifest.version
[semver](http://semver.org) version of your app.
### manifest.manifestUrl
The URL where your latest manifest is hosted; where node-webkit-updater looks to check if there is a newer version of your app available.
### manifest.packages
An "object" containing an object for each OS your app (at least this version of your app) supports; `mac`, `win`, `linux32`, `linux64`.
### manifest.packages.{mac, win, linux32, linux64}.url
Each package has to contain a `url` property pointing to where the app (for the version & OS in question) can be downloaded.
### manifest.packages.{mac, win, linux32, linux64}.execPath (Optional)
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).
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`
---
## Troubleshooting
If you get an error on Mac about too many files being open, run `ulimit -n 10240`
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
[npm-url]: https://npmjs.org/package/node-webkit-updater
[npm-image]: https://badge.fury.io/js/node-webkit-updater.png