Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

look for modules in config.paths.modules #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions lib/timodule.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ exports.scopedDetect = function scopedDetect(searchPaths, config, logger, callba
* @param {Object} logger - A logger instance
* @param {Function} callback - A function to call when done
*/
exports.detect = function detect(searchPaths, logger, callback, bypassCache) {
exports.detect = function detect(searchPaths, config, logger, callback, bypassCache) {
if (moduleCache && !bypassCache) {
return callback(moduleCache);
}
Expand All @@ -85,12 +85,19 @@ exports.detect = function detect(searchPaths, logger, callback, bypassCache) {
project: function (next) {
detectModules(searchPaths.map(function (p) {
return path.join(p, 'modules');
}), null, logger, next);
}), config, logger, next);
},
user: function (next) {
if (config.paths && Array.isArray(config.paths.modules)) {
detectModules(config.paths.modules, config, logger, next);
} else {
next();
}
},
global: function (next) {
detectModules(sdkPaths.map(function (p) {
return path.join(p, 'modules');
}), null, logger, next);
}), config, logger, next);
}
}, function (err, results) {
callback(moduleCache = results);
Expand All @@ -110,7 +117,7 @@ exports.detect = function detect(searchPaths, logger, callback, bypassCache) {
* @param {Object} logger - A logger instance
* @param {Function} callback - A function to call when done
*/
exports.find = function find(modules, platforms, deployType, sdkVersion, searchPaths, logger, callback) {
exports.find = function find(modules, platforms, deployType, sdkVersion, searchPaths, config, logger, callback) {
var result = {
found: [],
missing: [],
Expand All @@ -126,10 +133,10 @@ exports.find = function find(modules, platforms, deployType, sdkVersion, searchP
Array.isArray(platforms) || (platforms = [platforms]);
platforms.push('commonjs'); // add commonjs to the list of valid module platforms

exports.detect(searchPaths, logger, function (installed) {
exports.detect(searchPaths, config, logger, function (installed) {
modules.forEach(function (module) {
var originalVersion = module.version || 'latest',
scopes = ['project', 'global'],
scopes = ['project', 'user', 'global'],
i, j, scope, info, platform, found, ver, tmp;

// make sure the module has a valid array of platforms
Expand Down