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 over 4 years ago

🌟 features

Handles more types of babel configurations. If you put your babel config in package.json or use a commonjs module that exports an object you'll be able to use them with dependency-cruiser as of this release.

  • feature(cli): enables reading babel configs from commonjs modules that export an object (#322)
  • feature(init): detects babel configs in package.json (#321)
  • feature(cli): enables reading babel configs from package.json (#320)

And here's some convenience for writing dependency cruiser configuration files:

  • feature(*): allow reporter options to accept an array if RE's (#319)
  • feature(*): allow filter options to accept an array of RE's (#318)

🔧 maintenance

  • build(npm): ⬆️ acorn, acorn-loose, eslint-plugin-import, lint-staged, mocha
  • refactor(init): make the default no-orphans rule more readable with an array
  • refactor(init): rename stuff for consistency
  • refactor(schema): put descriptions for oneOf's in a better place
dependency-cruiser -

Published by sverweij over 4 years ago

🌟 feature

  • feature(*): allows rule properties that accept RE's to accept an array of RE's (#317) - thanks to @Undistraction for suggesting this in #316!

🔧 maintenance

  • build(npm): ⬆️ chalk, eslint-plugin-import
  • refactor(utl): renames /utl to /tools (#315)
dependency-cruiser -

Published by sverweij over 4 years ago

🌟 features

This release contains mainly improvements in the --init command, so on-boarding becomes easier.

  • feature(init): detect more variants of webpack, typescript and babel configs (#314)
    This also lets you pick the configs it found from a list, so you don't have to type it.
  • feature(init): for mono repos ask whether combined dependencies are used (#313)
  • feature(init): basic mono-repo config init (#312)
  • feature(init|configs): exclude some known config files from the default orphan rule scrutiny (#311)
    Thanks @hoschi for noticing this!
  • feature(init): add manifest run scripts (#308)
    It will add four scripts to your package.json - two for validation, two for generating graphs. This is not in the --init configuration questions yet, but rather in a 'one shot config' (depcruise --init experimental-scripts). It might make it into the --init script in a later release.

📖 documentation

  • bugfix(doc): fix "typo" in Readme about config file extension (#309)
    Thanks @hoschi for the PR!

🔧 maintenance

  • build(npm): ⬆️ @babel/core, @babel/plugin-transform-modules-commonjs, eslint, eslint-plugin-mocha, eslint-plugin-unicorn, lint-staged, nyc, symlink-dir, mocha, typescript, upem
dependency-cruiser -

Published by sverweij over 4 years ago

🌟 features

  • feature(*): add babel support (#304)
  • feature(init): several small tweaks (#307)

If you want to start using babel:

  • if you use dependency-cruiser for the first time on your project you can use depcruise --init. It will detect the presence of many shapes of .babelrc's and configure it in your .dependency-cruiser.js
  • If you already have a .dependency-cruiser.js you can add this:
// ...
  babelConfig: {
     fileName: ".babelrc.json" // or however your .babelrc is called.
   }
// ...

As noted in the PR and the documentation the babel support is ⚠️ experimental. This means it works and is well tested, but small tweaks that might be considered breaking for normal features might be implemented without dependency-cruiser bumping major versions

🐛 bugfixes

  • bugfix(schema|types): make circular and exoticallyRequired mandatory in schema and type declarations (#306)
  • bugfix(doc): typos & copy++ on preCompilationAttribute

🔧 maintenance

  • Parse .dependency-cruiser.json with json5 instead of using strip-json-comments + the builtin json parser. Rationale: we need json5 for babel anyway and it's doing sorta the same thing as strip-json-comments as far as it matters for our use, so it saves one external dependency.
dependency-cruiser -

Published by sverweij over 4 years ago

🌟 features

  • feature(*): reporter level filtering (#302) (thanks @neelance for suggesting this feature and for validating it in the beta)

📖 documentation

  • doc(github): add 'other' template, tweak some copy
  • doc(cli|rules-reference): describe jsconfig.json's also work as tsconfig

🔧 maintenance

  • build(nppm): ⬆️ lint-staged
  • bugfix(ci): work around __dirname problem in mjs (json schema generation code)
dependency-cruiser -

Published by sverweij over 4 years ago

🌟 features

  • feature(*): add focus option (#295) (thanks to @gaggle for suggesting this feature - it's super useful - have been using it every day now - e.g. to show the difference of a refactoring --focus on the changed modules => instant PR documentation - see #300 for an example 🎉 )

🔧 maintenance

  • refactor(extract): split enrichment from extraction (#300)
  • build(npm) ⬆️ acorn, eslint, eslint-config-moving-meadow, eslint-plugin-mocha, eslint-plugin-unicorn, typescript
dependency-cruiser -

Published by sverweij over 4 years ago

🌟 functionality

  • feature(depcruise-fmt): add --exit-code option (#298) (thanks @neelance for the suggestion)
  • perf(init-config): adds explicit path to doNotFollow

🐛 fixes

  • bugfix(resolve): changes default resolve order so .vue is resolved after regular language suffixes (like .ts) (#293) (thanks @neelance for raising the issue and validating the fix!)

🔧 maintenance

  • build(npm): ⬆️ eslint-config-moving-meadow, eslint-plugin-budapestian, lint-staged, symlink-dir, tslint, upem
dependency-cruiser -

Published by sverweij over 4 years ago

🌟 Features

  • feature(main): add tripple slash directives to the module systems scanned by default (#289)
    (💥 breaking change)

  • feature(validate): advanced module isolation checks with reachable: true (#283) - fixes #191.
    This feature includes...

    • The ability to specify rules that forbid modules to reach (both directly and via via) certain other modules.
    • Showing the full offending path between two modules if they violate the rule

    Many thanks to @abierbaum and @jomi-se for raising and re-raising the issue, testing and providing genuinely useful feedback on the beta's of this feature. And for their patience.
    (💥 breaking change)

  • feature(extract): Faster and more intuitive doNotFollow behavior (#282) - fixes #281.
    A big thanks to @electrovir for raising the issue, patiently explaining the problem and validating the beta's
    (💥 breaking change)

  • feature(init): to improve the first time use experience --init now ask better questions for specifying src and test folders (#284)

🐛 Fixes

  • bugfix(*): fix typos (#287) - thanks to @friederbluemle
  • bugfix(types): require array for doNotFollow.dependencyTypes (#280) - thanks to @electrovir

🔧 Maintenance

  • chore(lint): update to latest moving meadow config (#286)
  • refactor(cli): only pass on known cli options downstream (#285)
  • doc(readme): add credits
  • build(lgtm): disable lgtm (it didn't add value over other QA platforms and it's not very fast)
  • chore(*): 💥 de-support node 8, add node 14 to build matrices (#288)
    This also upgrades many dependencies to latest that didn't support node 8 anymore.

💥 Breaking changes

Node 8 de-support (#288)

What changed?

From this version on dependency-cruiser supports node 10, 12, 13 and 14 (which are not coincidentally the same as the ones nodejs support).

Why?

Dependency-cruiser follows the support schedule of nodejs - which desupported node 8 by the end of last year. It has kept supporting node 8 for a while, but many dependencies also stopped supporting it, so it's getting less easy (and safe!) to maintain that situation. The release date of node 14 (last Tuesday) seemed as good a moment as any

What is the impact?

None if you're on node 10 or higher - which is likely. Low in all other cases (see How to migrate below

How to migrate

If you still are on one node 8.x there's two options:

  • upgrade your node version to 10 or higher (recommended)
  • keep using dependency-cruiser @8.0.2

TypeScript triple slash directives (tsd) scanned by default (#289)

What changed?

By default, in addition to amd, commonjs and es6 dependency-cruiser will cruise dependencies defined in triple slash directives as well.

Why?

Dependency-cruiser has supported triple slash directives for a very long time, but didn't include them by default initially because it would've been a breaking change - despite it being useful and expected. This change rectifies that. Also: if you do have triple slash directives you probably want them cruised, visualised and validated without having to tell dependency-cruiser separately.

Impact

None if you're not using TypeScript or are using TypeScript, but not triple slash directives.
Some if you are using triple slash directives (either ) - dependencies might be showing up (and triggering rules) that didn't before this release.

Migration path

If you want to keep the old behavior, explicitly specify the module systems either in the options section of your dependency-cruiser configuration:

"moduleSystems": ["amd", "cjs", "es6"]

... or on the command line with a flag: --module-systems amd,cjs,es6

Advanced module isolation checks with reachable: true (#283)

What changed?

In rules the reachable attribute now yields correct results if you use the value true (to enforce isolation, even via via).

Why?

This functionality was missing - and is useful (see issue #191 for a practical example)

What's the Impact?

Likely none, unless you're using reachable with the value true in your rules. If you do, you'll have noticed the results of the validations were wild, many (and largely incorrect). With this release they're correct, so you're likely to see (a lot) less violations which were false positives.

Migration path

Enjoy the reduction in false positives 😎.

Faster and more intuitive doNotFollow behavior (#282)

What changed?

From this version on dependency-cruiser does not report over modules matching the doNotFollow pattern when they're part of the arguments, unless they're reached through modules matching the arguments.

So in this example node_modules is part of both the arguments and of the doNotFollow pattern:

depcruise src test node_modules --do-not-follow node_modules --validate

The old behavior was to scan all modules in src test and node_modules and after that apply filters on node_modules while crawling through the dependencies. Note that in this case the result was the same as leaving out --do-not-follow.

The new behavior is to scan all modules in src and test, and only visit modules in node_modules if they are reachable from src and test

Why?

  • It's the behaviour you'd expect anyway so users (and I) will be less likely to be confused.
  • By default this behaviour is faster as dependency-cruiser scans less files overall.

What is the impact

None if the path you pass in the arguments (e.g. src lib test) and the path in doNotFollow (typically node_modules) do not overlap.
Low if they do overlap (e.g. when you have node_modules in the sub packages in your mono repo) - dependency-cruiser now only reports over modules matching doNotFollow if they're reached through dependencies in the other arguments.

If you're in that last category (some mono-repos might be, inadvertently), likely you will experience a (considerable) speed up in the time dependency-cruiser takes to cruise your repo.

How to migrate

Probably you'll be happy to leave the new behavior as-is as it will be faster for you, and yield results closer to your intention.

However, in the less likely case your intention was to do scan everything in doNotFollow: remove the pattern of the files you want to follow from the doNotFollow option (either on the command line (--do-not-follow) or in the configuration file).

dependency-cruiser -

Published by sverweij over 4 years ago

🌟 features

  • feature(init): adds source and test folder detection to --init (#279)

🔧 maintenance

  • build(npm): ⬆️ handlebars, nyc
dependency-cruiser -

Published by sverweij over 4 years ago

🔧 Maintenance

  • build(npm): ⬆️ eslint-plugin-budapestian, eslint-plugin-import, eslint-plugin-node, handlebars, tslint
  • refactor(*): rename some stuff to be more clear (#278)
dependency-cruiser -

Published by sverweij over 4 years ago

🌟 features

  • feature(report): add a text only reporter (#276) - thanks @afonsomatos for asking for it!

🔧 maintenance

  • build(npm): ⬆️ eslint-config-moving-meadow
dependency-cruiser -

Published by sverweij over 4 years ago

🔧 maintenance

  • refactor(report): render csv with vanillajs (#274)
  • refactor(*): apply new lint rule set up and lint fix on new rules (#273)
  • build(npm): ⬆️ commander, inquirer, eslint-config-moving-meadow, eslint-plugin-budapestian, eslint-config-prettier, mocha, tslint, yarn
  • bugfix(doc): fix links to schema in api doc
dependency-cruiser -

Published by sverweij over 4 years ago

🔧 maintenance

  • build(npm): ⬆️ acorn, inquirer, yarn
  • doc(*): various tweaks
dependency-cruiser -

Published by sverweij over 4 years ago

🌟 functionality

  • feature(bin): adds a tool to wrap svg output by graphviz in html (#266)
    So it's easier to get highlight-on-hover for the graphical output - see the cli documentation for detail.
  • feature(report): by default visually distinguishes pre-compilation only dependencies in all dot reports (#262)
  • bugfix(extract): disregards the module system when determining pre-compilation-only-ness (#261)
    This might be BREAKING if you use the option preCompilationDeps: "specify" and have rules set up with preCompilationOnly - see below for details.
  • bugfix(init): make options comma-last so they're easier to (un)comment (#270)
  • bugfix(init): for --init yes/ preset only use a webpack/ tsconfig when one is present (#263)
  • test(extract): adds unit tests to verify new types of imports & exports introduced in typescript 3.8+ work (#265)

🔧 maintenance

  • build(npm): ⬆️ acorn-walk, ajv, eslint-plugin-mocha, figures, inquirer, mocha, pnp-webpack-plugin, symlink-dir, typescript
  • refactor(*): standardize on kebab case file names (#267)
  • test(report): add lower level tests for report/utl (#260)
  • style(extract): remove superfluous comment
  • chore(ci): rename yarn-pnp test to yarn-pnp test (#259)

📖 documentation

  • doc(real-world-samples): add react and yarn high-level dependency graphs (#271)
  • doc(rules-reference): correct-a-typo (accfe60)

breaking change: disregard the module system when determining pre-compilation-only-ness

What: If dependency-cruiser is asked to specify whether a dependency exists before compilation from typescript to javascript, it used to compare the before and after too strictly (also heeding the module system - see #261). It does now less strictly, which will yield accurate results.

Impact: Small, and only if you use both:

  • the value "specify" for tsPreCompilationDeps
  • and rules that make use of the preCompilationOnly attribute
    In which case dependencies might get flagged by these rules that didn't get flagged before.

No impact if you don't use both of them (i.e. only one of them or neither).

How to migrate: If there's new dependencies flagged by your specific set up, you probably want to fix them. If that's not a short term option you can set up an exception (e.g. with the pathNot in either the to or from of that rule, making sure the newly found dependencies don't get triggered).

dependency-cruiser -

Published by sverweij over 4 years ago

🌟 functionality

  • feature(report): enables specifying collapse patterns for the regular dot reporter (#258)
  • refactor(report): isolate consolidation functions for use outside dot reporters (#257)
  • feature(report): in archi and ddot reporters distinguish consolidated from regular nodes (#256)
  • feature(report): add vertical highlight to the html table report (#255)

🔧

  • build(npm): ⬆️ commander, handlebars, yarn
  • style(doc): prettier --fix pull request template
dependency-cruiser -

Published by sverweij over 4 years ago

🌟 functionality

  • feature(report): err-html: click on rule = navigate to details (#250)
  • bugfix(report): don't emit dummy nodes in the custol level dot reports (#252)
  • bugfix(report): sort aggregated rules on severity (#253)
  • build(utl): makes the svg wrapper script highlight modules on hover (#254)

📖 documentation

  • doc(doc): enhance copy for the archi & dir reporters + general documentation maintenance (#251)

🔧

  • build(npm): ⬆️ coffeescript, eslint-plugin-import
dependency-cruiser -

Published by sverweij over 4 years ago

🌟 functionality

  • feature(report): add 'archi' - custom granularity dot reporter (#249)
  • bugfix(main): align regular and tspath resolution extensions & order (#247, #243) - this is a 💥 breaking change - see below for details. Thanks to @davidparkagoda for signaling the issue and making the initial PR for this

💥 breaking change

What: dependencies to aliased paths in tsconfigs now get the same detection treatment as all other dependencies, overriding the typescript config paths behaviour that by default only looked at .ts ad .tsx.

Impact: Only if you use tsconfig aliasses/ paths dependency-cruiser might detect dependencies to typescript declaration files it didn't detect before, which might trigger rules that didn't trigger before (typically, but not limited to typescript declaration files)

How to migrate? Either fix the transgressions or add an exception to exclude the newly discovered dependencies (the pathNot attribute in the to part of the rule that triggered will be your friend).

📖 documentation

  • bugfix(doc): correct link to defaultTheme.json (#246) (@vkostenko88)
  • bugfix(doc): update api.md to reflect the correct interface (#245) (@vkostenko88)
  • bugfix(doc): to.dynamic is a boolean (#242) (@christianvuerings)

🔧 maintenance

  • build(npm): ⬆️ acv, eslint-config-prettier, handlebars, inquirer, mocha, pnp-webpack-plugin, tslint, typescript
  • doc(doc): add social sharing pic source
  • doc(workflow): simplify the pull request template checklist
dependency-cruiser -

Published by sverweij almost 5 years ago

🌟 functionality

  • feature(report): enable colouring for the dot (folder level) reporter (#240)

🔧 maintenance

  • build(npm): ⬆️ eslint-plugin-import, handlebars
  • chore(ci): simplify travis job (#241)
dependency-cruiser -

Published by sverweij almost 5 years ago

🌟 functionality

  • feature(*): introduce the 'exoticallyRequired' attribute (#239)

🔧 maintenance

  • refactor(report): make interfaces more uniform. and jsdoc'ed (#238)
  • refactor(report): require via the shortest path (#235)
  • refactor(report): small optimisation in readability of hbs templates (#233)
  • refactor(main): check regex safety with external version of safe-regexp again (#234)
  • chore(json-schema): put title on top, make $id more logical
  • ci(codeclimate): remove eslint plugin from codeclimate config (#237)
  • build(lint): add new linting rules
  • build(npm): ⬆️ commander, inquirer, coffeescript, mocha

📖 documentation

  • bugfix(legal): happy 2020
  • bugfix(doc): fix links to schema in utl/readme + add clickable depgraph for it
  • doc(*): corrects various typos and errors
  • doc(real-world-samples): inline the dependency-graphs from state-machine-cat and mscgen.js themselves
dependency-cruiser -

Published by sverweij almost 5 years ago

functionality

  • feature(report): introduce reporter options (#225)
  • feature(cli): removes one step from the --init script (#228)
  • feature(extract): always derive circular and orphan (#229)
    so you can distinguish them in the graphical output regardless of whether you have rules defined.

maintenance

  • refactor(*): winter cleaning (#222)
  • refactor(types): re-arrange the types + DRY the json schema (#223)
  • feature(doc): add a dot-svg specific html wrapper utensil (#224)
  • refactor(test): unify the reporter test mocks & fixtures (#230)
  • ci(gh-actions|local): use eslint caching mechanism (#227)
  • build(npm): ⬆️ eslint, eslint-config-prettier, eslint-plugin-node, inquirer, nyc, typescript, vue-template-compiler, yarn
  • bugfix(doc): correct a typo in the cli doc