Validate and visualize dependencies. Your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.
MIT License
Technical/ internal things:
Published by sverweij almost 7 years ago
Published by sverweij almost 7 years ago
Published by sverweij almost 7 years ago
--system
option in favour of --module-systems
. It's clearer and simplified the code a bit. The shorthand (-M) stays. --system will be available until the 3.0.0 release, but will will issue a deprecation warning.--module-systems "amd, cjs"
) the cli strips the spaces.Published by sverweij almost 7 years ago
--do-not-follow
option. For details see #18Published by sverweij almost 7 years ago
max-depth
Adds an option to limit the cruise depth - see command line option for the documentation.
depcruise -T dot -x node_modules --max-depth 1 bin/dependency-cruiser | dot -T png > 1.png
--max-depth 1
--max-depth 2
--max-depth 3
--max-depth 4
no max-depth specified:
Published by sverweij about 7 years ago
This release introduces support for jsx - which is used in almost
any react project out there. I'm interested in any feedback!
DEPRECATED; use 2.4.1 or later
Adds support for tsx, but also introducesshrink-wrap
which has a (for dependency-cruiser) the unwanted side effect of also installing all devDependencies on annpm i
=> better use 2.4.1, which doesn't have the shrink-wrap.
Published by sverweij about 7 years ago
Published by sverweij over 7 years ago
Published by sverweij over 7 years ago
--init-rules
configuration with a warning level.{
"name": "no-circular",
"severity": "warn",
"comment": "Warn in case there's circular dependencies",
"from": {},
"to": { "circular": true }
}
For each dependency this will answer the question: When I follow this dependency, will I end up with myself? and hoist a warning flag when it is.
depcruise -v -- src
Detecting circular dependencies is heavy work. Especially on larger code bases (thousands of files in one dependency graph) you might notice an impact on the performance when you add a rule that checks for circular dependencies.
Running with this rule e.g. against the coffeescript transpiler code base will yield
warn no-circular: coffee-script.coffee → register.coffee
warn no-circular: register.coffee → coffee-script.coffee
✖ 2 dependency violations (0 errors, 2 warnings). 23 modules cruised.
or, rendered as a graph (depcruise -v -x node_modules -T dot src | dot -T svg > coffee-deps.svg
)
Published by sverweij over 7 years ago
deprecated
is just an other 'dependency type' - so it should be a doddle to use.In your dependency-cruiser config you can use the 'deprecated' attribute, just like you use other dependency types e.g. like this:
{
"name": "no-deprecated-npm",
"comment": "These npm modules are deprecated - find an alternative.",
"severity": "warn",
"from": {},
"to": { "dependencyTypes": ["deprecated"] }
}