Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/nwjs-community/nw-builder
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
adam-lynch committed Oct 19, 2017
2 parents 7c92f12 + 1977136 commit 1d12f8c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 27 deletions.
52 changes: 30 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ npm install nw-builder -g
Yes, there is also a [Grunt Plugin](https://github.com/nwjs/grunt-nw-builder). For Gulp, just use the module :)


## Usage
## CLI Usage

```shell
Usage: nwbuild [options] [path]
Expand All @@ -39,7 +39,7 @@ Options:
#### Run NW.js
During development you can run NW.js with `nwbuild -r path/to/your/younwapp/`

Or use the module:
## Module Usage

```js
var NwBuilder = require('nw-builder');
Expand All @@ -49,25 +49,33 @@ var nw = new NwBuilder({
version: '0.14.6'
});

//Log stuff you want

// Log stuff you want
nw.on('log', console.log);

// Build returns a promise
nw.build().then(function () {
console.log('all done!');
}).catch(function (error) {
console.error(error);
});
```

`build` also supports callbacks:
During development you can run NW.js with `run`:

```javascript
nw.build(function(err) {
if(err) console.log(err);
})
```js
nw.run().then(function () {
console.log('all done!');
}).catch(function (error) {
console.error(error);
});
```

`build` and `run` also supports callbacks:

```js
nw.build(function(err) {
if(err) return console.error(err);
console.log('all done!');
});
```

### Options
Expand All @@ -80,22 +88,22 @@ The path to your node webkit app. It supports [simple-glob](https://github.com/j


#### options.version
Type: `String`
Default value: `'latest'`
Type: `String`
Default value: `'latest'`

The version of NW.js you want to use. Per default it looks up the latest version. [Here is a list](https://github.com/nwjs/nw.js/wiki/Downloads-of-old-versions) of all available releases

#### options.flavor
Type: `String`
Default value: `'sdk'`
Type: `String`
Default value: `'sdk'`

The flavor of NW.js you want to use. Per default it will be `sdk`. [Here is a list](https://github.com/nwjs/nw.js/wiki/Build-Flavors) of all flavor available.

The value `sdk` is most used for development whereas `normal` for production.

#### options.platforms
Type: `Array`
Default value: `['osx64', 'win32', 'win64']`
Default value: `['osx64', 'win32', 'win64']`

The platforms you want to build. Can be `['win32', 'win64', 'osx32', 'osx64', 'linux32', 'linux64']`

Expand Down Expand Up @@ -157,14 +165,14 @@ Default value: `false`
MAC ONLY: The path to your ICNS icon file. If your don't provide your own it will use the one provided by NW.js

#### options.zip
Type: `Boolean`
Default value: `null`
Type: `Boolean`
Default value: `null`

WINDOW ONLY: Instead of zipping the application and merging it into the executable the application content is placed next to the application (which speed up the startup time for large apps). The default behaviour is platform specific. For `windows` and `linux`, the application is zipped and merged into the executable. For `mac`, the application is not zipped.

#### options.zipOptions
Type: `Object`
Default value: `null`
Type: `Object`
Default value: `null`

Allows to configure the underling zip library parameters, like store or compression ratio.

Expand Down Expand Up @@ -196,13 +204,13 @@ winVersionString: {

#### options.winIco
Type: `String`
Default value: `null`
Default value: `null`

WINDOWS ONLY: The path to your ICO icon file. If your don't provide your own it will use the one provided by NW.js. If you are building on MAC or LINUX you must have [Wine](https://www.winehq.org/) installed to use this option.

#### options.macZip (DEPRECATED)
Type: `Boolean`
Default value: `null`
Type: `Boolean`
Default value: `null`

MAC ONLY: Use a `app.nw` folder instead of `ZIP` file, this significantly improves the startup speed of applications on `mac`, since no decompressing is needed. Builds on other platforms will still use `ZIP` files. The default behaviour of node-webkit-builder is to not use `ZIP` files on the `mac` platform. In case of the `mac` platform the option `macZip` can override the option `zip`.

Expand Down
14 changes: 9 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ NwBuilder.prototype.preparePlatformSpecificManifests = function(){
}

var self = this;
var promises = [];

return new Promise(function(resolve, reject){
self._forEachPlatform(function (name, platform) {

self._forEachPlatform(function (name, platform) {
promises.push(new Promise(function(resolve, reject){
var overrides = self._appPkg.platformOverrides;
if (overrides[name] || overrides[name.substr(0, name.length-2)]) {

Expand All @@ -357,9 +357,13 @@ NwBuilder.prototype.preparePlatformSpecificManifests = function(){
platform.platformSpecificManifest = result;
resolve();
});
} else {
resolve();
}
});
})
}));
});

return Promise.all(promises);
};


Expand Down

0 comments on commit 1d12f8c

Please sign in to comment.