Coder Social home page Coder Social logo

circular-dependency-plugin-visualizer's Introduction

๐Ÿ”„ Circular Dependency Plugin Visualizer

This package was made for use with the circular-dependency-plugin (GitHub|npm) to assist in making sense of your circular dependencies and aid in fixing them.

Installation

Use a package installer like NPM to install the package and the peer dependency circular-dependency-plugin

npm i --save-dev circular-dependency-plugin circular-dependency-plugin-visualizer

Usage

The visualizer takes all the same options as circular-dependency-plugin >=4.4.0 and an additional optional configuration object specific to the visualization.

// webpack.config.js
const CircularDependencyPlugin = require("circular-dependency-plugin");
const visualizer = require("circular-dependency-plugin-visualizer");

module.exports = {
  entry: "./src/index",
  plugins: [
    new CircularDependencyPlugin(
      visualizer(
        {
          exclude: /node_modules/,
          cwd: process.cwd(),
        },
        {
          filepath: path.join(
            __dirname,
            "circular-dependency-visualization.html"
          ),
        }
      )
    ),
  ],
};

Options

property type default
filepath string path.join(process.cwd(), 'circular-dependency-visualization.html')

Visualzation Notes

Node names

You can hover over a node to show the file path.

Node color

The nodes show different colors for the directory that they're in (up to 10 directories). If because of your directory set up, they are all in the same root directory, like src, try setting the cwd property in the circular-dependency-plugin options to the common root.

// webpack.config.js
const path = require('path');

module.exports = {
  ...,
  plugins: [
    new CircularDependencyPlugin(visualizer({
      ...
      cwd: path.resolve(__dirname, 'src')
    })
  ]
};

Stroke animations

The strokes between nodes are animating in the direction of the import, showing the direction of the dependency chain. If a.js imports b.js, you will see the animation go from the a.js node to the b.js node. This is also the same direction as the arrows from the circular-dependency-plugin.

a.js -> b.js

circular-dependency-plugin-visualizer's People

Contributors

dependabot[bot] avatar nicolaichuk avatar sfrieson avatar vparchas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

circular-dependency-plugin-visualizer's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.