Skip to content

Commit

Permalink
CLI: Reuse module paths when looking up cli dependencies, see #648
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Jan 18, 2017
1 parent 6302655 commit 9719fd2
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions cli/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,10 @@ exports.inspect = function inspect(object, indent) {
return sb.join("\n");
};

var paths = [
path.resolve(__dirname, "..", "node_modules"),
path.resolve(__dirname, "node_modules")
];

function modExists(name, version) {
for (var i = 0; i < paths.length; ++i) {
for (var i = 0; i < module.paths.length; ++i) {
try {
var pkg = JSON.parse(fs.readFileSync(path.join(paths[i], name, "package.json")));
var pkg = JSON.parse(fs.readFileSync(path.join(module.paths[i], name, "package.json")));
return semver
? semver.satisfies(pkg.version, version)
: parseInt(pkg.version, 10) === parseInt(version.replace(/^[\^~]/, ""), 10); // used for semver only
Expand Down

0 comments on commit 9719fd2

Please sign in to comment.