Build tool and bindings loader for node-gyp that supports prebuilds
Clone or download
Latest commit 06f368c Dec 22, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore first commit Jan 25, 2017
LICENSE first commit Jan 25, 2017
README.md Enable building from source (#13) Dec 22, 2018
bin.js Enable building from source (#13) Dec 22, 2018
build-test.js allow injecting a prebuild using an env var (#6) Jun 24, 2018
index.js Enable building from source (#13) Dec 22, 2018
optional.js test prebuild in another process Jan 26, 2017
package.json 3.7.0 Dec 22, 2018

README.md

node-gyp-build

Build tool and bindings loader for node-gyp that supports prebuilds.

npm install node-gyp-build

Use together with prebuildify to easily support prebuilds for your native modules.

Usage

node-gyp-build works similar to node-gyp build except that it will check if a build or prebuild is present before rebuilding your project.

It's main intended use is as an npm install script and bindings loader for native modules that bundle prebuilds using prebuildify.

First add node-gyp-build as an install script to your native project

{
  ...
  "scripts": {
    "install": "node-gyp-build"
  }
}

Then in your index.js, instead of using the bindings module use node-gyp-build to load your binding.

var binding = require('node-gyp-build')(__dirname)

If you do these two things and bundle prebuilds prebuildify your native module will work for most platforms without having to compile on install time AND will work in both node and electron without the need to recompile between usage.

Users can override node-gyp-build and force compiling by doing npm install --build-from-source.

License

MIT