# webkit-builder

> 为 nw-builder 增加 sdk 版本

Latest version **2.2.1** (published 2016-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install webkit-builder
pnpm add webkit-builder
yarn add webkit-builder
bun add webkit-builder
```

Provides the command `wbuilder`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2016-06-08 |
| First published | 2016-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 21 |
| Known vulnerabilities | 0 (+15 in 6 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1712 |
| Maintainers | lmm0591 |
| Keywords | NW.js, node-webkit, desktop, application |

## Links

- npm: https://www.npmjs.com/package/webkit-builder
- Repository: https://github.com/mllrsohn/nw-builder
- Issues: https://github.com/mllrsohn/nw-builder/issues
- npm.io page: https://npm.io/package/webkit-builder

## Dependencies (21)

- [temp](https://npm.io/package/temp.md) ~0.7.0
- [plist](https://npm.io/package/plist.md) ^1.0.0
- [lodash](https://npm.io/package/lodash.md) ~2.4.1
- [rcedit](https://npm.io/package/rcedit.md) 0.2.0
- [rimraf](https://npm.io/package/rimraf.md) ^2.2.8
- [semver](https://npm.io/package/semver.md) ^2.3.1
- [tar-fs](https://npm.io/package/tar-fs.md) ^0.3.2
- [request](https://npm.io/package/request.md) ~2.40.0
- [archiver](https://npm.io/package/archiver.md) ^0.13.0
- [bluebird](https://npm.io/package/bluebird.md) ~1.2.2
- [inherits](https://npm.io/package/inherits.md) ~2.0.1
- [optimist](https://npm.io/package/optimist.md) ^0.6.1
- [progress](https://npm.io/package/progress.md) ~1.1.7
- [deprecate](https://npm.io/package/deprecate.md) ~0.1.0
- [simple-glob](https://npm.io/package/simple-glob.md) ~0.1.0
- [graceful-ncp](https://npm.io/package/graceful-ncp.md) ^2.0.0
- [winresourcer](https://npm.io/package/winresourcer.md) ^0.9.0
- [decompress-zip](https://npm.io/package/decompress-zip.md) 0.0.8
- [update-notifier](https://npm.io/package/update-notifier.md) ^0.1.8
- [graceful-fs-extra](https://npm.io/package/graceful-fs-extra.md) ^1.0.4
- [platform-overrides](https://npm.io/package/platform-overrides.md) ~1.0.1

## Recent versions

- 2.2.1 (latest) — 2016-06-08
- 2.2.0 — 2016-06-08

## README

# webkit-builder

> Lets you build your [NW.js](https://github.com/nwjs/nw.js) apps for mac, win and linux via cli. It will download the prebuilt binaries for a newest version, unpacks it, creates a release folder, create the app.nw file for a specified directory and copies the app.nw file where it belongs.


### Installation

##### Local
```shell
npm install webkit-builder --save-dev
```

##### Global
```shell
npm install webkit-builder -g
```

##### Grunt and Gulp Plugins
Yes, there is also a [Grunt Plugin](https://github.com/nwjs/grunt-nw-builder). For Gulp, just use the module :)


## Usage

```shell
Usage: wbuild [options] [path]

Options:
  -p, --platforms      Platforms to build, comma-sperated, can be: win32,win64,osx32,osx64,linux32,linux64   ['osx32', 'osx64', 'win32', 'win64']
  -v, --version        The nw version, eg. 0.8.4                                             [default: "latest"]
  -r, --run            Runs NW.js for the current platform                                   [default: false]
  -o, --buildDir       The build folder                                                      [default: "./build"]
  -f, --forceDownload  Force download of NW.js                                               [default: false]
  --cacheDir           The cache folder
  --quiet              Disables logging                                                      [default: false]

```
#### Run NW.js
During development you can run NW.js with `wbuild -r path/to/your/younwapp/`

Or use the module:

```js
var NwBuilder = require('webkit-builder');
var nw = new NwBuilder({
    files: './path/to/nwfiles/**/**', // use the glob format
    platforms: ['osx32', 'osx64', 'win32', 'win64'],
    version: '0.12.3'
});

//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:

```javascript
nw.build(function(err) {
    if(err) console.log(err);
})

```

### Options

#### options.files *Required*
Type: `String`  
Default value: `null`  

The path to your node webkit app. It supports [simple-glob](https://github.com/jedmao/simple-glob) so you can do stuff like `['foo/*.js', '!foo/bar.js', 'foo/bar.js']`.

#### options.isSDK
Type: `Boolean`
Default value: `false`

是否附加开发者工具打包

#### options.version
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.platforms
Type: `Array`  
Default value: `['osx32', 'osx64', 'win32', 'win64']`

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

The values `['win', 'osx', 'linux']` can also be used and will build both the 32 and 64 bit versions of the specified platforms.

#### options.appName
Type: `String`  
Default value: `false`  

The Name of your NW.js app. If this value is set to null, it will autodetect the `name` from your projects package.json. This will be used to generate a plist file for mac.

#### options.appVersion
Type: `String`  
Default value: `false`  

The version of your NW.js app. If this value is set to null, it will autodetect the `version` form your projects package.json. This will be used to generate a plist file for mac.

#### options.buildDir
Type: `String`  
Default value: `./build`  

This is where the releases are saved.

#### options.cacheDir
Type: `String`  
Default value: `./cache`  

This is where the cached NW.js downloads are

#### options.buildType
Type: `String` or `function`
Default value: `default`  

How you want to save your build.

* `default` [appName]
* `versioned` [appName] -v[appVersion]
* `timestamped` [appName] - [timestamp];
* A function with options as scope (e.g `function () {return this.appVersion;}` )

#### options.forceDownload
Type: `Boolean`  
Default value: `false`  

This will delete everything in your `build_dir` directory, including the cached downloaded prebuilt binaries

#### options.macCredits
Type: `String`  
Default value: `false`  

MAC ONLY: The path to your credits.html file. If your don't provide your own it will use the one provided by NW.js

#### options.macIcns
Type: `String`  
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`

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.macPlist
Type: `String` or `Object`  
Default value: `false`  

MAC ONLY: Pass a string containing the path to your own plist file. If a string isn't passed, a plist file will be generated from your package.json. Pass an object to overwrite or add properties to the generated plist file.

#### options.winIco
Type: `String`  
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`

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`.

### Manifest Options

#### platformOverrides

Allows you to specify platform-specific manifest values. Example manifest:

```json
{
    "name": "nw-demo",
    "version": "0.1.0",
    "main": "index.html",
    "window": {
        "frame": false,
        "toolbar": false
    },
    "platformOverrides": {
        "win": {
            "window": {
                "toolbar": true
            }
        },
        "win32": {
            "window": {
                "frame": true,
                "toolbar": false
            }
        },
        "win64": {
            "window": {
                "frame": true
            }
        },
        "osx": {
            ...
        },
        "osx32": {
            ...
        },
        "osx64": {
            ...
        },
        "linux": {
            ...
        },
        "linux32": {
            ...
        },
        "linux64": {
            ...
        },
    }

```

The platform-specific options will override the others only when building that platform only and the `platformOverrides` property will be removed.

For example, when building for Windows, the manifest generated and put into the end app (from the manifest above) would be:

```json
{
    "name": "nw-demo",
    "version": "0.1.0",
    "main": "index.html",
    "window": {
        "frame": true,
        "toolbar": false
    }
}
```

Additionally, when specifying multiple version of the same platform such as "win", "win32", and "win64", changes will be applied such that "win" applies to both "win32" and "win64", while "win32" and "win64" apply only to the specified version. Also note that "win32" and "win64" can further override changes made in "win".

See [#85](https://github.com/nwjs/nw-builder/issues/85) and [#94](https://github.com/nwjs/nw-builder/pull/94) for more information. If you need this during development too, see [platform-overrides](https://github.com/adam-lynch/platform-overrides) and [gulp-platform-overrides](https://github.com/adam-lynch/gulp-platform-overrides). There is no Grunt plugin, [yet](https://github.com/new).

## Troubleshooting

### OSX ulimit

Darwin (OS X kernel) has a low limit for file descriptors (256 per process) by default, so you might get an `EMFILE` error or an error mentioning "too many open files" if youtry to open more file descriptors than this.

To get around it, run `ulimit -n 1024` (or add it to your `~/.bash_profile`). For more information, see [henvic/osx-ulimit](https://github.com/henvic/osx-ulimit).


## License

[MIT License](https://en.wikipedia.org/wiki/MIT_License)

---
_Source: https://npm.io/package/webkit-builder · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
