dependency-cruiser

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

MIT License

Downloads
1.5M
Stars
4.9K
Committers
47

Bot releases are hidden (Show)

dependency-cruiser -

Published by sverweij almost 8 years ago

  • adds 'unfollowable' module dependencies (like node core modules and included json files) as regular 'sources' so they
    • show up in the html and csv reports
    • can get processed like modules that are followable
  • html and csv reporters: color core modules grey
dependency-cruiser -

Published by sverweij almost 8 years ago

  • Adds the 'severity' of a violation into the html and csv reporter output
  • html reporter:
    • colors the cell according to the severity of the violation
    • adds the violated rule into the title, so you can see it on hover
  • csv reporter: when the cell is the intersection of a violation it'll contain the severity of that violation
  • dot reporter:
    • colors violating dependencies according to their severity (in stead of merely red)
    • some layout tweaks to make output easier on the eye - see below for an 'after - before' comparison

after

after

before

before

dependency-cruiser -

Published by sverweij almost 8 years ago

Changes since v1.1.0:

  • Err reporter:
    • make output better scannable (by adding spacing and coloring).
    • Makes the violated rule + the severity of the violation visible (so it's easier to track what needs fixing)
  • Nests nested packages in the dot reporter (in addition to just grouping them, which was already done in v1.1.0):

This command ...

bin/dependency-cruise -T dot -x "(node_modules|json$)" src | dot -T png > dependency-cruiser-cruised.png

... will now give you this:
dependency-cruiser-cruised

dependency-cruiser -

Published by sverweij almost 8 years ago

Changes since 1.0.4

  • Dependency-cruiser now also runs on slightly older versions of nodejs (4 and up)
    (tested, updated package.json - included a ci target for nodejs 4, 6 and latest)
  • The dot reporter now clusters modules to improve visual grepping - see below for a simple sample.
  • Switched to github as main repository.

a simple sample, based on the fixtures folder in dependency-cruiser/test

... which is what you get when you run this:

cd test/fixtures
dependency-cruise -T dot -r rules.sub-not-allowed.json -x "(node_modules|json$)" . | dot -T png > sample-dot-output.png
dependency-cruiser -

Published by sverweij almost 8 years ago

'release' 1.0.1 - 1.0.4 are just documentation updates - pictures mostly (first I got them from gitlab - who apparently hadn't switched the project private -> public yet. Or I didn't switch enough switches for that. Secondly I got them from github, but made the classic mistake of not linking pictures to raw.githubusercontent but to github.com. Which works ask within github, but not outside of it. Like on npmjs.com. Or on gitlab.com :-/)

dependency-cruiser -

Published by sverweij almost 8 years ago

Initial release

Features:

  • Generates dependency information from any javascript code base:
    • in html, dot, csv
    • highlights for dependencies you have configured to be forbidden
  • Configurable dependency validation (and a special bare bones reporter) to integrate into build systems.
  • See Daphne's dependencies for a gentle introduction.

Pictures

Graphviz dot output

dot output

Build output

(only visible when there's something wrong wit your dependencies):

dependency-cruise -T err -v test/fixtures
Dependency-cruiser found the following illegal dependencies:
  test/fixtures/cjs/root_one.js => test/fixtures/cjs/sub/dir.js
  test/fixtures/cjs/sub/dir.js => test/fixtures/cjs/sub/depindir.js
  test/fixtures/cjs/two_only_one.js => test/fixtures/cjs/sub/dir.js
make: *** [dependency-cruise] Error 3

HTML

html output
rotated html output. Like a boss