![]() ![]() There are a lot of options which pretty granular control. All nw-builder options are available to Grunt users too. Then running grunt nwjs will produce your executables. Let's say you create a simple file called build.js var NwBuilder = require ( 'nw-builder' ) var nw = new NwBuilder ( ) That way I can have a build script which passes all of the options and so on. I personally prefer to use it programmatically though. Ignoring my bias, that was surprisingly simple. nwbuild appDirectory -v 0.12.2 -o dest -p linu圆4. By default it builds 32-bit and 64-bit Windows and Mac executables, but Linux 32-bit and 64-bit executables can also be generated. Yes, you can build for multiple platforms. You can specify a lot of options here via flags too the NW.js version you'd like, which platforms to build for, etc. Nw-builder will go and grab the latest NW.js version and generate self-contained executables for you. Once you install it globally by running npm install -g nw-builder, then you could run the following command to generate executables: nwbuild your/app/files/directory -o destination/directory Either from the command-line or programmatically, it makes building executables light work. The nw-builder module will handle all of that for you, and more. There are a few downsides to all of that it's platform-specific, very manual, and is very limited. Other noteworthy files which you could edit are Contents/Resources/nw.icns which is your app's icon and Contents/ist, Apple's app package description file. You could create an Contents/Resources/app.nw directory and add your raw app files there. nw archive to app.nw, put it in the Contents/Resources inner directory, and you're done. app executables are just directories on Mac OS X, you could just copy the offical nwjs executable and edit it. On Linux, the command would be cat path/to/nw myapp.nw > myapp & chmod +x myapp (where nw is the NW.js executable). This is expected to be fixed in NW.js 0.13.0 when NW.js will come with a nw.dll (along with nw.exe) which modules will link to instead. You could rename nw.exe to something nicer but it's not advised as native modules will not work if the executable isn't named nw.exe. ![]() Even though we now have a single executable, it still requires the DLLs and everything else which comes with the official builds to be in the same directory as the. On Windows, you need to run copy /b nw.exe+myapp.nw nw.exe on the command-line. This is achieved differently per platform though. nw archive together to produce a single executable. One way to do this is to mash the NW.js executable and your. Think of your potential end users, they deserve better. Ideally though, you want as few files as possible. Just use the official executable to open your. If you wanted, you could keep things really simple and leave it at that. usr/local/lib/node_modules/nw on Mac OS X), the executable can be found in the nwjs directorty. If you already have the nw module, then if you go to where it's installed on your machine (e.g. You could download a ZIP from the NW.js site containing an executable ( nw.exe for example) and a few other bits and pieces. You could substitute one of the official NW.js executables in for the nw module. Unless you're making an app for NW.js users, that's not a great idea. Anyone looking to use it would have to have nw installed globally too. Let's say you wanted to put your app out there as a download. ![]() nw and then launching it using the official npm module like this: nw myapp.nw. It's possible to run your app by creating a ZIP archive containing your app code, changing the file extension to. Let's start with the simplest approach with the least amount of code or configuration. How hard can it be to package up your NW.js app into real executables? To be a true desktop app, it should be a self-contained. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |