Visualize your CommonJS or AMD module dependencies in a force directed graph using D3.js.
You can read the full introduction to the project in my blog post.
The best way to show something is by example, so here I generated a dependencygraph of the offical RequireJS multipage-example
From the same directory as your Gruntfile, run
npm install grunt-dependencygraph
Then add some configuration for the plugin like so:
Then add the following line to your Gruntfile after the initConfig-section:
Then just run
grunt dependencygraph, go to your
outputPath-folder, and open
grunt-dependencygraph supports a few options.
targetPath Path for the target source to extract dependencies (supports absolute/relative paths)outputPath Path for where to output the graph (supports absolute/relative paths)format Dependency-format to parse, either 'cjs' (common-js), or 'amd' (AMD)exclude A regular expression for excluding modules
grunt-dependencygraph is still very much in progress, so here is the todo-list: