Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/junosuarez/node-npm-idempotent-rebuild
node module: run npm rebuild only if cannot load native modules
https://github.com/junosuarez/node-npm-idempotent-rebuild
Last synced: 8 days ago
JSON representation
node module: run npm rebuild only if cannot load native modules
- Host: GitHub
- URL: https://github.com/junosuarez/node-npm-idempotent-rebuild
- Owner: junosuarez
- License: isc
- Created: 2016-03-02T09:54:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-05-28T06:01:54.000Z (over 8 years ago)
- Last Synced: 2024-10-07T02:30:46.053Z (about 1 month ago)
- Language: JavaScript
- Size: 200 KB
- Stars: 3
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# npm-idempotent-rebuild
run npm rebuild only if cannot load native modules[![npm](https://img.shields.io/npm/v/npm-idempotent-rebuild.svg)][npm]
[![js standard style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)][standard]
[![Dependency Status](https://david-dm.org/jden/node-npm-idempotent-rebuild.svg)][dependencies]
[![build status](https://circleci.com/gh/jden/node-npm-idempotent-rebuild.svg?&style=shield)][circleci][npm]: https://www.npmjs.com/package/npm-idempotent-rebuild
[standard]: http://standardjs.com/
[dependencies]: https://david-dm.org/jden/node-npm-idempotent-rebuild
[circleci]: https://circleci.com/gh/jden/node-npm-idempotent-rebuildRebuilding 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
```js
const npmIdempotentRebuild = require('npm-idempotent-rebuild')
npmIdempotentRebuild({dir: __dirname}, function (err, rebuilt) {
console.log(err, rebuilt ? : 'rebuilt node modules' : 'skipped rebuilding')
})
```## api
with [jsig](https://github.com/jsigbiz/spec) type annotation:### `npmIdempotentRebuild(opt, callback : Callback) => 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 testFor debug information, set env var DEBUG=true
## contributors
- jden
## license
ISC. (c) MMXVI jden . See LICENSE.md