npm-idempotent-rebuild

1.0.2 • Public • Published

npm-idempotent-rebuild

run npm rebuild only if cannot load native modules

npm js standard style Dependency Status build status

Rebuilding native modules can be slow. This module attempts loading all native modules in the dependency tree. If they fail, it runs npm rebuild. This is useful when switching between node versions or between operating systems with cached node_modules directories.

cli usage

$ npm-idempotent-rebuild

programmatic usage

const npmIdempotentRebuild = require('npm-idempotent-rebuild')
npmIdempotentRebuild({dir: __dirname}, function (err, rebuilt) {
  console.log(err, rebuilt ? : 'rebuilt node modules' : 'skipped rebuilding')
})

api

with jsig type annotation:

npmIdempotentRebuild(opt, callback : Callback<rebuilt: Boolean>) => void

Rebuilds node_modules if necessary. Takes a Node.js-style callback with error, if any, and rebuilt, which is true if npm rebuild was executed.

Options:

  • level: String - one of silent (default), info, or debug
  • dir: String - the cwd for running npm rebuild, defaults to current cwd.

installation

$ npm install npm-idempotent-rebuild

running the tests

From package root:

$ npm install
$ npm test

For debug information, set env var DEBUG=true

contributors

license

ISC. (c) MMXVI jden jason@denizac.org. See LICENSE.md

Package Sidebar

Install

npm i npm-idempotent-rebuild

Weekly Downloads

0

Version

1.0.2

License

ISC

Last publish

Collaborators