node-webkit autoupdate


Node-webkit allows you to build cross platform desktop application with node and JavaScript. Though building desktop application unlike pure online webapp means you got no control over the code after the app was installed. Thus releases are painful and bugs after the code was released are frustrating.

Right now desktop apps usually update themselves. Node-webkit do not have this functionality out of the box. Which is reasonable because such functionality would hardly rely on specific implementation.

So I created webkit-updater. It relies on suggestion that your app will be packaged with grunt-node-webkit-builder, compressed with grunt-contrib-compress and with windows package unzip.exe will be packaged. Basically the example of packaging app you can find here.

webkit-updater is working/tested under mac, win and linux(32/64).

how does it work

It gives you api to:

  1. Check the manifest for version.
  2. If the version is different from local one download new package to temp.
  3. Unpack the package to temp.
  4. Run new version from temp and exit the process.
  5. The new version from temp will copy itself to original folder.
  6. The new version 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.

what are the plans

There should be bugs, probably. Need to stabilize it and test it extensively in real world app.

It would also be great to have different rates of updates:

  • update assets only without page reload (..x)
  • update assets with page reload (.x.)
  • update assets and node-webkit engine - full cycle (x..)

There is a bug for newer versions of linux. Updater should resolve things like that. Also there should be some preInstall and postInstall scripts handling.

You are welcome to use and commit.