Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Commit

Permalink
add traversing of .local dependencies for installation
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Oct 31, 2012
1 parent 90cab52 commit a62bb16
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/component-install
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ if (local) {
if (conf.development && program.dev) {
pkgs = pkgs.concat(normalize(conf.development));
}

if (conf.local) {
conf.local.forEach(function(pkg){
var deps = component.dependenciesOf(pkg);
pkgs = pkgs.concat(normalize(deps));
});
}
}

// save to ./component.json
Expand Down
16 changes: 16 additions & 0 deletions lib/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var Package = require('./Package')
, fs = require('fs')
, path = require('path')
, join = path.join
, resolve = path.resolve
, exists = fs.existsSync
, request = require('superagent');

Expand Down Expand Up @@ -59,6 +60,21 @@ exports.lookup = function(pkg){
}
};

/**
* Return the dependencies of local `pkg`.
*
* @param {String} pkg
* @return {Object}
* @api public
*/

exports.dependenciesOf = function(pkg){
var path = exports.lookup(pkg);
if (!path) throw new Error('failed to lookup "' + pkg + '"');
var conf = require(resolve(path, 'component.json'));
return conf.dependencies || {};
};

/**
* Install the given `pkg` at `version`.
*
Expand Down

0 comments on commit a62bb16

Please sign in to comment.