🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

grunt-dependencygraph

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-dependencygraph

Visualize your CommonJS or AMD module dependencies.

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

grunt-dependencygraph

Visualize your CommonJS or AMD module dependencies in a force directed graph using D3.js.

Introduction

You can read the full introduction to the project in my blog post.

Features

  • Draw a graph of nodes, where each module is represented as a node.
  • Google Maps's like zooming, dragging and panning.
  • Connect nodes with it's dependencies via lines.
  • Hovering a node will highlight it's direct dependencies.
  • It's possible to drag a node to a specific position, to re-layout the graph.

Example

The best way to show something is by example, so here I generated a dependencygraph of the offical RequireJS multipage-example

Example

http://auchenberg.github.com/grunt-dependencygraph/example

Installation

From the same directory as your Gruntfile, run

npm install grunt-dependencygraph

Then add some configuration for the plugin like so:

grunt.initConfig({
    ...
    dependencygraph: {
      targetPath: './app/assets/javascript',
      outputPath: './public/graph',
      format: 'amd'
    },
    ...
});

Then add the following line to your Gruntfile after the initConfig-section:

grunt.loadNpmTasks('grunt-dependencygraph');

Then just run grunt dependencygraph, go to your outputPath-folder, and open index.html.

Enjoy.

Options

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

Roadmap

grunt-dependencygraph is still very much in progress, so here is the todo-list:

  • Proper label positioning: Avoid label collisions and make the graph more readable.
  • Testing! Unit tests of D3 render logic, and the grunt-task itself

Inspiration

http://bl.ocks.org/1153292

Keywords

AMD

FAQs

Package last updated on 03 Mar 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts