Package to rebuild native Node.js modules against the currently installed Electron version
Перейти к файлу
Paul Betts 1858c9748f spawn returns an object, not stdout 2015-05-27 14:23:02 -07:00
src spawn returns an object, not stdout 2015-05-27 14:23:02 -07:00
test babelllllllll 2015-05-04 22:09:31 -07:00
.gitignore Ignore stuff 2015-05-04 00:01:46 -07:00
.jshintrc Initial import 2015-05-04 00:01:56 -07:00
.npmignore Add npmignore so we'll end up shipping lib/ 2015-05-04 22:01:45 -07:00
README.md Come Correct with README 2015-05-04 22:28:55 -07:00
package.json Bump npm to latest 2015-05-27 14:21:55 -07:00

README.md

Electron-Rebuild

This executable rebuilds native io.js modules against the version of io.js that your Electron project is using. This allows you to use native io.js modules in Electron apps without your system version of io.js matching exactly (which is often not the case, and sometimes not even possible).

How does it work?

Install the package with --save-dev:

npm install --save-dev electron-rebuild

Then, whenever you install a new npm package, rerun electron-rebuild:

./node_modules/.bin/electron-rebuild

How can I integrate this into Grunt / Gulp / Whatever?

electron-rebuild is also a library that you can just require into your app or build process. It has two main methods:

import { installNodeHeaders, rebuildNativeModules } from 'electron-rebuild';

// Public: Downloads and installs the header / lib files required to build
// native modules.
//
// nodeVersion - the version of Electron to download headers for
// nodeDistUrl (optional) - the URL to download the distribution from
// headersDir (optional) - where to put the headers
//
// Returns a Promise indicating whether the operation succeeded or not
let headerResult = installNodeHeaders('v0.25.0');

// Public: Rebuilds a node_modules directory with the given Electron version.
//
// nodeVersion - the version of Electron to download headers for
// nodeModulesPath - the path to a node_modules directory
// headersDir (optional) - where to find the headers
// Returns a Promise indicating whether the operation succeeded or not
headerResult.then(() => rebuildNativeModules('v0.25.0', './node_modules'));