madge icon indicating copy to clipboard operation
madge copied to clipboard

Group by folder

Open goodmind opened this issue 6 years ago • 5 comments

Can it group files by parent folder in generated image?

goodmind avatar Feb 03 '19 11:02 goodmind

Similar to #181 ?

I wrote a filter that does that:

https://github.com/pahen/madge/issues/181#issuecomment-436449386

joebowbeer avatar Feb 03 '19 17:02 joebowbeer

@joebowbeer I mean with --image option

goodmind avatar Feb 03 '19 18:02 goodmind

@goodmind pipe the results through a transformer (such as mine) and then back into madge via the --stdin option:

madge --json app.js | repdeps -x '([^\/]*).*' -r '$1' | madge --stdin --image graph.svg

joebowbeer avatar Feb 03 '19 20:02 joebowbeer

@joebowbeer Yeah, similar to this, but actually show files in folder as subgraph

goodmind avatar Feb 04 '19 18:02 goodmind

This would be very useful -- for projects larger than a dozen files the graph becomes unreadable, because the nodes are placed chaotically, so it's hard for a human to follow the links. Files in a folder are naturally grouped together, and it would greatly increase "at a glance" readability of the generated image.

For example, dependency-cruiser uses graphviz's clusters to do that, see examples here.

quezak avatar Mar 25 '19 13:03 quezak