Skip to content

node module: run npm rebuild only if cannot load native modules

License

Notifications You must be signed in to change notification settings

junosuarez/node-npm-idempotent-rebuild

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

node module: run npm rebuild only if cannot load native modules

Resources

License

Stars

Watchers

Forks

Packages

No packages published