npm dependency-cruiser 9.0.0

latest releases: 16.6.0-beta-1, 16.5.0, 16.4.2...
4 years ago

🌟 Features

  • feature(main): add tripple slash directives to the module systems scanned by default (#289)
    (:boom: 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.
    (:boom: 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
    (:boom: breaking change)

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

🐛 Fixes

🔧 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).

Don't miss a new dependency-cruiser release

NewReleases is sending notifications on new releases.