pkg-builder

A build service for modules that actually works

        __                     ___.         .__.__       .___            
______ |  | __  ____           \_ |__  __ __|__|  |    __| _/___________ 
\____ \|  |/ / / ___\   ______  | __ \|  |  \  |  |   / __ |/ __ \_  __ \
|  |_> >    < / /_/  > /_____/  | \_\ \  |  /  |  |__/ /_/ \  ___/|  | \/
|   __/|__|_ \\___  /           |___  /____/|__|____/\____ |\___  >__|   
|__|        \/_____/                \/                    \/    \/       

Install your app's NPM packages programatically.

First make sure you pkg-builder installed

npm install pkg-builder

When there's a package.json in the build folder

var pkgBuilder = require('pkg-builder'),
    dir        = '/path/to/app',
    util       = require('util');
 
pkgBuilder.install(dir, function(errdependencies) {
  if (err) { throw err; }
 
  // dependencies array, contains all the packages installed 
  // along with their versions & relevant info 
  console.log(util.inspect(dependencies, false, null));
});

Passing the dependencies manually

var pkgBuilder = require('./index'),
    dir        = '/path/to/app',
    util       = require('util');
 
var deps = {
  'pause-stream' : '*',
  'debug': '0.6.x'
};
 
pkgBuilder.install(dir, deps, function(errdependencies) {
  if (err) { throw err; }
 
  console.log(util.inspect(dependencies, false, null));
});
$ npm install
$ npm test

MIT