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

dependency-cruiser-fork

v9.11.0-beta2

Published

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

Downloads

17

Readme

Dependency cruiser Dependency cruiser

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

What's this do?

Snazzy dot output to whet your appetite

This runs through the dependencies in any JavaScript, TypeScript, LiveScript or CoffeeScript project and ...

  • ... validates them against (your own) rules
  • ... reports violated rules
    • in text (for your builds)
    • in graphics (for your eyeballs)

As a side effect it can generate cool dependency graphs you can stick on the wall to impress your grandma.

How do I use it?

Install it

  • npm install --save-dev dependency-cruiser to use it as a validator in your project (recommended) or...
  • npm install --global dependency-cruiser if you just want to to inspect multiple projects.

Show stuff to your grandma

To create a graph of the dependencies in your src folder, you'd run dependency cruiser with output type dot and run GraphViz dot on the result. In a one liner:

depcruise --include-only "^src" --output-type dot src | dot -T svg > dependencygraph.svg
  • You can read more about what you can do with --include-only and other command line options in the command line interface documentation.
  • Real world samples contains dependency cruises of some of the most used projects on npm.

Validate things

Declare some rules

The easy way to get you started:

depcruise --init

This will ask you some questions and create a .dependency-cruiser.js with some rules that make sense in most projects (detecting circular dependencies, dependencies missing in package.json, orphans, production code relying on dev- or optionalDependencies, ...).

Start adding your rules by tweaking that file.

Sample rule:

{
  "forbidden": [
    {
      "name": "not-to-test",
      "comment": "don't allow dependencies from outside the test folder to test",
      "severity": "error",
      "from": { "pathNot": "^test" },
      "to": { "path": "^test" }
    }
  ]
}

Report them

depcruise --config .dependency-cruiser.json src

This will validate against your rules and shows any violations in an eslint-like format:

sample err output

There's more ways to report validations; in a graph (like the one on top of this readme) or in a table.

  • Read more about the err, dot, csv and html reporters in the command line interface documentation.
  • dependency-cruiser uses itself to check on itself in its own build process; see the decpruise script in the package.json

I want to know more!

You've come to the right place :-) :

License

MIT

Thanks

  • Marijn Haverbeke and other people who collaborated on acorn - the excellent JavaScript parser dependency-cruiser uses to infer dependencies.
  • Katerina Limpitsouni of unDraw for the ollie in dependency-cruiser's social media image.
  • All members of the open source community who have been kind enough to raise issues, ask questions and make pull requests to get dependency-cruiser to be a better tool.

Build status

GitHub Workflow Status Build Status coverage Maintainability Test Coverage total downloads on npm

Made with :metal: in Holland.