How do you distribute a Node-WebKit application now? The Problems.
To distribute a node-webkit application, you have to copy a lot of files: the application's sources (*.html, *js, images, and other resources), and the node-webkit binaries.
Look at a typical set of files; there are nw.js runtime files and application files:
(This directory should be copied to the client computer)
│ │ credits.html
│ │ d3dcompiler_47.dll
│ │ ffmpeg.dll
│ │ icudtl.dat
│ │ libEGL.dll
│ │ libGLESv2.dll
│ │ natives_blob.bin
│ │ node.dll
│ │ nw.dll
│ │ nw.exe
│ │ nw_100_percent.pak
│ │ nw_200_percent.pak
│ │ nw_elf.dll
│ │ resources.pak
│ │ snapshot_blob.bin
The standard approach has several serious problems:
- No ways to prepare a single executable file of a node.js-based application.
- The application's files are available for anyone for extraction and modifications.
- It's impossible to change the exe's icon and add a splashscreen.
- There's no ways to add a splashscreen.
BoxedApp Packer packs all the files together into a single exe file ("packed exe"). The packed exe doesn't unpack embedded files to the disk. They are totally in the memory.
Prepare the package
First of all, you need nw.js runtime; you can download it from the official nw.js website.
Important! Runtime files bitness: 32-bit vs. 64-bit.
Download the 32-bit version of nw.js runtime to ensure the packed exe will run on both 32-bit and 64-bit Windows.
Using the 64-bit nw.js runtime files, BoxedApp Packer will produce a 64-bit executable that won't run on 32-bit Windows.
At the same time, if you use the 32-bit nw.js runtime files, the 32-bit executable will be produced, which can run on both 32-bit and 64-bit Windows.
Download BoxedApp Packer, launch it. Select nw.exe as the input exe, specify the output exe path (you can select any name).
To run node-webkit based application, the folder name is passed to nw.exe, so the command line looks like:
> nw.exe show-image-app
Let's embed this command line in the packed exe! Click "Override command line" and then type:
The packed exe will run as if show-image-app
Then add nw.js runtime files: select Application Directory in the file tree, click Add Files..., select the runtime files (except nw.exe), and add the files.
Then click Import Directory... and select "locales" (this folder is a part of the runtime).
Now it's time to import the application files. Again, click Import Directory and then select "show-image-app".
Build it and run. It works!