r/angularjs • • Nov 27 '14

[Show] Automatically generate diagrams of your AngularJS code structure

https://github.com/lucalanca/grunt-angular-architecture-graph
44 Upvotes

8 comments sorted by

2

u/Crashthatch Nov 27 '14

Looks nice. I have a hand-drawn version of my angular service dependencies alongside my DB structure diagram - a way of generating a version automatically would be nice.

To simplify the setup, avoid needing to install graphviz, grunt, etc, is there any way we could turn this into a hosted service? ie. a website where you enter your git URL and it generates & shows you the graphs for your repo immediately in your browser? Is there any reason this would be difficult / wouldn't work?

1

u/lucalanca Nov 28 '14

I think that is perfectly possible and very useful (never though about it before). Not on my plans on the short term though. I might do it when I have a little bit of free time, if someone didn't do it before :)

1

u/Rhinexheart Dec 01 '14 edited Dec 01 '14

Hello,

stupid question: where do I specify my 'PATH/TO/YOUR/DIST/FILE.JS'?

Is this the path to gruntfile.js?

Edit:

Also, I'm using Mean stack so the angular files are scattered everywhere. Do I need to specify the path to every one of them?

1

u/lucalanca Dec 03 '14

"PATH/TO/YOUR/DIST/FILE.JS" is the path from the project root (where Gruntfile.js is) to your dist file. It only works with ONE js file right now (usually your production file, if you concatenate all your javascript files into a single file).

1

u/T-rex_with_a_gun Nov 27 '14

This is lovely! 2 things though:

  1. the graphiz link doesnt seem to work,

  2. Can this be done w/o grunt?

1

u/lucalanca Nov 27 '14
  1. Thanks for reporting, it is now fixed :)

  2. Yes, the "magic" is powered up by https://github.com/lucalanca/angular-architecture-graph

I made this grunt task that uses the data processed by angular-architecture-graph, and generated the diagrams out of it. However, one could use the same data to generate the diagrams using other tools (I just feel more comfortable with grunt).

1

u/sittingprettyin Nov 28 '14

oh god this feels like looking behind the refrigerator. :|

Cool project!

1

u/ctanga Dec 03 '14

neat. can I customize the layout algorithm?