Permalink
Browse files

[fix] move upwards in findModulesDir

this is the functionality that is described in the comments, but wasn't
implemented (yet)
  • Loading branch information...
1 parent 7ede462 commit b3e2bb92c3b42f300cd9aec499e5f5bfdffb3b01 @fb55 fb55 committed Sep 8, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/require-analyzer.js
View
@@ -579,12 +579,14 @@ analyzer.findModulesDir = function (target, callback) {
if (err) {
callback(err);
}
- //TODO behave differently when a node_modules dir is present
else if (files.indexOf('node_modules') !== -1 || files.indexOf('package.json') !== -1) {
callback(null, target);
}
+ else if (target === (target = path.dirname(target))){
+ callback(new Error('Couldn\'t find a node_modules directory.'));
+ }
else {
- callback(null, target);
+ analyzer.findModulesDir(target, callback);
}
});
}

0 comments on commit b3e2bb9

Please sign in to comment.