Easily call local NPM binaries
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
index.js
package.json

README.md

npmBin

Easily call local NPM binaries

When using ShellJS, you can write:

var npmBin = require('npm-bin');
var config = 'karma.conf.js';

npmBin('karma', [config, 'start']);

instead of:

var config = 'karma.conf.js';
exec('node_modules/.bin/karma ' + config + ' start');

You can also pass in environment variables:

var npmBin = require('npm-bin');

var config = 'karma.conf.js';
var envs = {
    'PHANTOMJS_BIN': '/opt/phantomjs/bin/phantomjs'
}

npmBin('karma', [config, 'start'], { envs: envs });