Validate and visualize dependencies. Your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.
MIT License
no-duplicate-dep-types
and not-to-dev-dep
in some typescript based projects that separately installed @types as development dependencies.--collapse
command line option (#366) which works the same as the option of the same name in depcruise-fmt.βοΈ If you have a largish code base and want to make loads of overview pictures of parts of your repo fast this is the feature for you.
save the dependency-graph as a json. You probably know that if your repo is big (let's say > 5000 modules, > 20000 dependencies) this can take a minute as dependency-cruiser has to read each file from disk & parse it:
depcruise "^packages|lib" --config --output-type json -f result.json # might take some time
From the saved result generate a bunch of overview graphs. As the heavy lifting is done already, each will take typically < 1s (depending on the size of your graph):
depcruise-fmt result.json --output-type dot --include-only ^packages/search |\
dot -T svg | depcruise-wrap-stream-in-html > search-graph.html
depcruise-fmt result.json --output-type dot --include-only ^packages/checkin |\
dot -T svg | depcruise-wrap-stream-in-html > checkin-graph.html
depcruise-fmt result.json --output-type dot --include-only ^packages/trip |\
dot -T svg | depcruise-wrap-stream-in-html > trip-graph.html
depcruise-fmt result.json --output-type dot --include-only ^packages/ancillaries --exclude "\\.spec.ts$|mocks" |\
dot -T svg | depcruise-wrap-stream-in-html > ancillaries-graph-without-test-stuffs.html
The compressed architecture view will be fast as well:
depcruise-fmt result.json --output-type archi |\
dot -T svg | depcruise-wrap-stream-in-html > high-level-graph.html
It works on all reporters, so if you want to generate separate violation reports for parts of your repo you can do this:
# The focus filter only includes modules matching the regex + their direct neighbours, which is exactly
# what we want for violation reports:
depcruise-fmt result.json --output-type err-html --focus ^packages/ancillaries -f ancillary-violations.html
depcruise-fmt result.json --output-type err-html --focus ^packages/trip -f trip-violations.html
# ... etc
Enjoy! Bug reports (and β 's if you like it :-) ) welcome
912 is apparently the designation of another porsche
Published by sverweij about 4 years ago
Will speed up the cycle and reachability detection code between 2x and 10x - which can improve performance on certain larger repos (> 2000 modules) with seconds.
This also introduces a feature to tweak the cache duration enhanced resolve uses. For larger repos (above ~5000 modules, 20000 dependencies) it might be worthwhile to play with this to find a trade off between memory usage and time spent running.
Thanks to @jomi-se who not only found the bug in enhanced-resolve but also helped validate the fix (in detail!) and rolled an alternate and promising cache implementation for enhanced resolve