npm-idempotent-rebuild
v1.0.2
Published
run npm rebuild only if cannot load native modules
Downloads
14
Maintainers
Readme
npm-idempotent-rebuild
run npm rebuild only if cannot load native modules
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 ofsilent
(default),info
, ordebug
dir
: String - the cwd for runningnpm 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
- jden [email protected]
license
ISC. (c) MMXVI jden [email protected]. See LICENSE.md