I am reading the instructions for how to package a NW.js app and the wording is a confusing mess and makes no sense. I highlighted the contradictory word-salad parts.
nw-builder does not support the NW.js newest versions (version > 0.12) before the 02/July/2016 release, it has support now, but stills in alpha/beta state.
You can try using nwjs-builder, easy and powerfull (with ffmpeg prebuilt support via withFFmpeg
option), you can use from command line and as a module, if you want to use it as a module and automate builds with (for example) using gulp
, you can do something like this:
var gulp = require('gulp'),
glp = require('gulp-load-plugins')(),
del = require('del'),
nwb = require('nwjs-builder'),
argv = require('yargs').alias('p', 'platforms').argv,
paths = {
build: './build',
src: './src',
images: './src/images'
},
detectCurrentPlatform = function () {
switch (process.platform) {
case 'darwin':
return process.arch === 'x64' ? 'osx64' : 'osx32';
case 'win32':
return (process.arch === 'x64' || process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432')) ? 'win64' : 'win32';
case 'linux':
return process.arch === 'x64' ? 'linux64' : 'linux32';
}
};
gulp.task('build', ['clean:build'], function () {
return new Promise(function (resolve, reject) {
nwb.commands.nwbuild(paths.src, {
version: '0.15.4',
platforms: argv.p ? argv.p : detectCurrentPlatform(),
withFFmpeg: true,
production: true,
macIcns: paths.images + '/icon.icns',
winIco: paths.images + '/icon.ico',
sideBySide: false,
//outputFormat: 'ZIP',
outputDir: paths.build
}, function (err) {
if (err) {
reject(err);
}
return resolve();
});
});
});
gulp.task('clean:build', function () {
return gulp.src(paths.build, {
read: false
}).pipe(glp.clean());
});
required dependencies in your manifest (adjust your desired versions):
"devDependencies": {
"del": "^2.2.1",
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-load-plugins": "^1.2.4",
"nwjs-builder": "latest",
"yargs": "^4.7.1"
}
You can get a lot of more documentation about use and args on the main GitHub repo.