Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

dependency-cruiser

Package Overview
Dependencies
Maintainers
2
Versions
553
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dependency-cruiser

Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.

latest
Source
npmnpm
Version
17.0.1
Version published
Weekly downloads
566K
-16.3%
Maintainers
2
Weekly downloads
 
Created

What is dependency-cruiser?

dependency-cruiser is a tool to analyze and visualize the dependencies in your JavaScript and TypeScript projects. It helps you understand the structure of your codebase, identify potential issues, and enforce architectural rules.

What are dependency-cruiser's main functionalities?

Dependency Graph Generation

Generates a dependency graph for the specified source directory. This helps in visualizing the dependencies between different modules in your project.

const depCruiser = require('dependency-cruiser');
const result = depCruiser.cruise(['src']);
console.log(result.output);

Enforcing Architectural Rules

Allows you to define and enforce architectural rules, such as preventing circular dependencies. This helps maintain a clean and manageable codebase.

const depCruiser = require('dependency-cruiser');
const config = {
  forbidden: [
    {
      name: 'no-circular',
      severity: 'error',
      comment: 'Circular dependencies are not allowed',
      from: {},
      to: {
        circular: true
      }
    }
  ]
};
const result = depCruiser.cruise(['src'], config);
console.log(result.output);

Reporting

Generates reports in various formats (e.g., JSON, HTML) to help you analyze the dependency structure and identify potential issues.

const depCruiser = require('dependency-cruiser');
const result = depCruiser.cruise(['src'], {}, { outputType: 'json' });
console.log(JSON.stringify(result.output, null, 2));

Other packages similar to dependency-cruiser

Keywords

static analysis

FAQs

Package last updated on 04 Aug 2025

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