npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mimosa-dependency-graph

v0.2.0

Published

A module for visualizing AMD/RequireJS dependencies in Mimosa projects

Downloads

7

Readme

mimosa-dependency-graph

This module will generate a d3 visualization of your application dependency graph.

~ Screenshot ~

Overview

mimosa-dependency-graph utilizes the dependency information that Mimosa already exposes via its mimosa-require module to construct a force layout graph in d3.

For more information regarding Mimosa, see http://mimosa.io.

Usage

  • Add 'dependency-graph' to the list of modules in your project's mimosa-config file.
  • Run mimosa build or mimosa watch. Mimosa will automatically install the new module for you.
  • Open the following file in a browser: <your_project>/.mimosa/dependency_graph/index.html.
  • Explore!

Note: It is recommended to use Chrome to view the graph, as the SVG rendering becomes considerably slower in Firefox the larger your app gets.

Functionality

When you initially run mimosa build or mimosa watch, the following directory structure will be created at the root of your project, if it does not already exist: .mimosa/dependency_graph. The module will then drop a series of assets into that directory:

.mimosa/dependency_graph
|_ jquery.min.js
|_ bootstrap.min.css
|_ bootstrap.min.js
|_ d3.min.js
|_ d3.chart.min.js
|_ dependency_graph.js
|_ main.css
|_ main.js
|_ index.html

It will also create a data.js file with the dependency data to feed to the graph.

During mimosa watch, if the dependencyGraph.watch.enabled option is set to true, any changes that you make to your scripts will trigger an update of data.js.

Configuration

Default

dependencyGraph:
  assetFolder: ".mimosa/dependency_graph"
  safeAssets: []
  watch:
    enabled: false
  • assetFolder: This is the folder that Mimosa will place all the dependency graph assets in.
  • safeAssets: You may customize any of the assets by providing your own version. To ensure that Mimosa does not override them, list them out in this array. You only need to list filenames, not paths.
  • watch.enabled: Set this to true if you would like Mimosa to regenerate the data.js file as necessary during a watch.

Example

The following is an example of a project's mimosa-config.coffee in which the dependency-graph module was tossed into the workflow, and custom versions of d3.min.js and main.css were given.

exports.config =
  modules: ['lint', 'server', 'require', 'minify', 'live-reload', 'dependency-graph']
  dependencyGraph:
    safeAssets: ['d3.min.js', 'main.css']

Customization

Feeling the itch to personalize the graph with your own color scheme? As mentioned above, Mimosa gives you the flexibility to override any of the assets that it provides by listing their filenames in the safeAssets config property.

You technically can customize any parts of the graph that you would like. This module uses d3.Chart to define a DependencyGraph chart type, so you can easily change or extend the chart's functionality. See https://github.com/misoproject/d3.chart/wiki/chart-extend for details.

However, this module makes no guarantee that future versions will be backward-compatible. If there's a feature you'd really like to see baked into mimosa-dependency-graph, it may be best to contribute back to the project itself!