As you might have seen, I did some refactoring in the refactor branch. Mainly removing unused code, improving and abstracting some stuff and introducing two new public methods:
.findModulesDir now actually searches for a directory containing either a node_modules dir or a package.json file.
findit is no longer a dependency, as .path (which is an abstraction of .dir) can do the job.
Please have a look at the code, it's possible that I've missed something. (All tests pass at least.)
use console.log instead of util.puts
also fixed some linting errors (semicolons & equals)
added a analyzer.path method that calls the appropriate function for …
as it's mainly the code of .analyze, use it there
use .path inside .dir (replaces findit)
removed findit from dependencies
some minor changes
• use the `in` operator more frequently (it's much nicer than `typeof
foo !== "undefined"` + is more readable)
• removed some garbage
• added some comments
removed two unnecessary functions
in L54, err would have always be falsey (or the function had returned
[fix] still accessed property before checking it with `in`
[fix] passed filenames instead of paths to .path
forward errors from prerunners in runAnalyze
use Function#bind when it's appropriate, use single quotes
Revert "forward errors from prerunners in runAnalyze"
This reverts commit a7c35d1.
always return an object in npmAnalyze
also moved the creation of the find-dependencies path to the
[fix] move upwards in findModulesDir
this is the functionality that is described in the comments, but wasn't
removed senseless check in analyzer.dir
a folder should never contain a file that has the folder's path as it's
added analyzer.findNextDir function
the last change broke most tests, so .findNextDir is what's actually
wanted for .npmAnalyze
set 1 as the maxDepth of read-installed
we don't use more, so don't do anything fancy
[fix] call callback when a node_modules folder is present
simplified mergeDependencies & .package
• removed scanning scripts as they weren't implemented properly (they
just looped a couple of times without doing anything)
• simplified signature of mergeDependencies
• return errors in .package
• also updated some comments
removed some garbage in .package
[fix] call .findNextDir recursively
@mmalecki @AvianFlu We should look at this in the next week or two to evaluate it. No rush though.
Needs review. Is this depended upon anywhere?
Guessing not, as in the error we don't return any ee.
LGTM. Seems like great work by @fb55
Tests pass locally