How do you distribute Node-WebKit application now? The Problems.
To distribute a node-webkit application you have to copy a lot of files: application's sources (*.html, *js, images and other resources), and node-webkit binaries.
Look at the typical set of files, there are nw.js runtime files and application files:
(This directory should be copied to 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.
- Application files are available for anyone for extraction and modifications.
- It's impossible to change the exe's icon and add a splashscreen.
- 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 on the disk. They are totally in memory.
Prepare a 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 32-bit version of nw.js runtime to be sure the packed exe will run on both 32-bit and 64-bit Windows.
Using 64-bit nw.js runtime files, BoxedApp Packer prepares a 64-bit executable that doesn't run on 32-bit Windows.
At the same time if you use 32-bit nw.js runtime files, a 32-bit executable will be prepared that can run on both 32-bit and 64-bit Windows.
Download BoxedApp Packer, launch it. Select nw.exe as input exe, set 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 into packed exe! Click to "Override command line" and 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 to Add Files..., select runtime files (except nw.exe) and add the files.
Then click to Import Directory... and select "locales" (this folder is a part of the runtime).
Now it's time to import application files. Again click to Import Directory and select "show-image-app".
Build it and run. It works!