Skip to content

Commit

Permalink
Take the json file as the 1st argument
Browse files Browse the repository at this point in the history
instead of via --deps
  • Loading branch information
Dean Radcliffe committed Apr 18, 2015
1 parent 64befee commit 294c40d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 3 additions & 5 deletions bin/dependo
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@ Commander
.usage('[options] <file|dir ...>')
.option('-f, --format <name>', 'format to parse (amd/cjs/es6/json)', 'amd')
.option('-x, --exclude <regex>', 'a regular expression for excluding modules')
.option('-d, --deps <filename>', 'when used with \'-f json\', a file to load deps from in {p1:[\'c1\',\'c2\']} format')
.parse(process.argv);


if (Commander.format !== "json" && !Commander.args.length) {
if (!Commander.args.length) {
console.log(Commander.helpInformation());
process.exit(1);
}

var src = Commander.args[0];

var directDeps = Commander.format==='json' &&
fs.existsSync(Commander.deps) &&
JSON.parse(fs.readFileSync(Commander.deps));
fs.existsSync(src) &&
JSON.parse(fs.readFileSync(src));

var dependo = new Dependo(src, {
format: Commander.format,
Expand Down
7 changes: 7 additions & 0 deletions example/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"a": ["sub/b"],
"d": [],
"fancy-main/not-index": [],
"sub/b": ["sub/c"],
"sub/c": ["d"]
}

0 comments on commit 294c40d

Please sign in to comment.