npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ionizer

v2.0.1

Published

rebuild native node modules against the electron runtime

Readme

ionizer

Build electron compatible modules while working in any version of nodejs.

Codeship Status for cdaringe/ionizer

about

your system's version of nodejs most likely does not match the version that electron runs behind the scenes. this can be problematic. dependencies commonly execute build process whilst installing them. perhaps you have seen node-gyp build addons when installing something via npm? For example, suppose

  • you are developing on nodejs 0.12.7
  • your electron application under the hood runs iojs 2.5.0
  • you install npm install --save node-sass
  • you require('node-sass') into you electron application and run it...
  • YOUR APP CRASHES! :( node-sass was built for 0.12.7 (module version 14), not for 2.5.0 (module version 44)
  • you run ionizer -q, which rebuilds your dependencies to work with your electron version.
  • reload your app. all is zen!

installation

This package is hosted on npm. See the ionizer package page.

npm install --save-dev ionizer

basic usage

i recommend installing electron-prebuilt into your package for no-brainer rebuilds. ionizer first tests for electron-prebuilt in your project and will rebuild with that if present (and if you don't explicitly specify an electron-path). npm install --save electron-prebuilt.

whenever you install a new npm package into your electron project, rerun ionizer:

// package.json
{
    ...
    scripts: {
        "postinstall": "ionizer -q", // or ...
        "postinstall": "ionizer -q --limit=leveldown,some-pkg",
    }
}

if you want to fine tune your rebuilds, try a rebuild script!

// inside your package.json
...
  "scripts": {
      "postinstall": "node .ionizer.js"
  }
...
// .ionizer.js
// advanced rebuilding (see simpler package.json example above)
var fs = require('fs');
var path = require('path');
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
var _ = require('lodash');
var electronVersion = _.get(pkg, 'dependencies.electron-prebuilt') || _.get(pkg, 'electron-version');
electronVersion = electronVersion.match(/\d+\.\d+\.\d+$/)[0];
var ionizer = require('ionizer');
ionizer.setLogLevel('verbose');

// test if rebuilding necessary
ionizer.shouldRebuild('/Users/username/ ... /Electron'); // electron path, see node_modules/electron-prebuilt/path.txt
.then(function(rslt) {
    if (!rslt.shouldRebuild) { process.exit(0); }
    return ionizer.installNodeHeaders(electronVersion)
    .then(function initRebuild() {
        return ionizer.rebuild({
            electronVersion: electronVersion,
            modulesDir: './node_modules',
            quick: true,
            ignore: ['webpack', 'babel', 'react', 'redux', 'pouchy']
        });
    });
})
.catch(function(err) {
    console.error(err.message);
});

options

as demonstrated above, this package supports two modes:

  1. cli mode
  2. package mode

the API when consumed as a package does not have a full doc set yet--please see the example above. the options to ionizer are the same to the cli as they are to ionizer.rebuild in the library. those may be found here.

note

beta

ionizer works, but it's in beta. despite the API not being published formally now, it will change in 2.0.0. expect at least new method names. the CLI options are not anticipated to change @2.0.0.

fork'n'h4ck3d

ionizer was initially a fork off of electron-rebuild, so make sure to give those guys a shout out. this package was created to improve performance, development experience, and add some features. some dependencies will build with ionizer that won't build with electron-rebuild, although windows support is still lacking in ionizer (help requested for add windows support to squish-squash). notable differences between the packages are:

  1. more reliable rebuilds. ionizer runs the actual electron node process when rebuilding packages
  2. faster rebuilds. rather than rebuilding your entire node_modules folder, you can limit the builds to certain packages. and keep a record/cache of those packages that have already been rebuilt (so as to not redundantly rebuild them)
  3. pure es5. no es6 compilation required for backwards compatibility
    1. improves testing, building, & distribution speed
  4. faster tests. network tests are mocked out. once basic resources are cached.

todo

  • [ ] windows support (squish-squash)
  • [ ] add doc blocks and gen API docs
  • [ ] fix test ECONN issue for connecting to local file server
  • [ ] support building against global electron (vs. electron-prebuilt or loose binary)
  • [ ] general API tidy!

changelog

1.x - release 2.0.0 - drop --verbose in favor of --log-level=[winston-log-levels]

cdaringe.com