auchenberg / dependo

Visualize your CommonJS or AMD module dependencies in a force directed graph report.
MIT License
484 stars 50 forks source link

Support passing in dependencies directly via -f json -d file.json #21

Closed deanrad closed 9 years ago

deanrad commented 9 years ago

With example.json containing: {"a":["sub/b"],"d":[],"fancy-main/not-index":[],"sub/b":["sub/c"],"sub/c":["d"]}

New feature: ./bin/dependo -f json -d example.json > example/index.html ; open example/index.html Regression tested with: ./bin/dependo -f cjs lib/ > example/index.html ; open example/index.html

auchenberg commented 9 years ago

Looks good. I'm a but unsure about the above if-condition, once resolved. I'll merge, and make a new release.

deanrad commented 9 years ago

Because in json format you pass the file containing the deps data, you don't need spider files, making the CLI arg required only for the previous use cases.

auchenberg commented 9 years ago

We agree that to pass the file you need to pass the file via --deps as dependo -f json --deeps <file>, right?

The above condition is to display a nice help message if no arguments are passed like dependo. What case does the current condition cover? If I pass -f json, Commander.args anyway has a length?

deanrad commented 9 years ago

If I pass -f json, Commander.args anyway has a length?

Not correct. Commander.args doesn't include switches/options/whatever they're called :)

But see the latest diff - I think it will satisfy us both, and be simpler.

> dependo              # prints help
> dependo -f cjs       # prints help
> dependo -f json      # prints help
> dependo -f json  file.json   # does good
> dependo -f cjs  dir/         # does good
auchenberg commented 9 years ago

Totally makes sense to use pass the file as the "input" in first argument. :+1:

deanrad commented 9 years ago

Cool- were on a roll !