O'Reilly logo

Cross-platform Desktop Application Development: Electron, Node, NW.js, and React by Dmitry Sheiko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Packaging

Well, we have completed our application and that is the time to think about distribution. As you understand, asking our users to install Node.js and type npm start from the command line will not be friendly. Users will expect a package that can be started as simply as any other software. So, we have to bundle our application along with NW.js for every target platform. Here, nwjs-builder comes in handy (https://github.com/evshiron/nwjs-builder).

So, we install the npm i -D nwjs-builder tool and add a task to the manifest:

./package.json

//... "scripts": {     "package": "nwb nwbuild -v 0.21.3-sdk ./app -o ./dist  -p linux64, win32,osx64", 

    //...     }, //...

Here, we specified three target platforms (-p linux64, win32,osx64) at once and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required