madge
madge copied to clipboard
Add support for `--include` flag
This PR adds support for an --include
flag, as per #219, that filters out everything in the tree that's not matched by the regular expressions provided.
Also made the --include
/ --exclude
flags accumulate their values in arrays, so you can provide the flags more than once in a command.
You can run madge
off my branch with:
npx danburzo/madge#include ...
Thanks for your contribution!
I could be a nice feature to add but I think your specific problem can be solved by running madge $(git diff --name-only --diff-filter=A origin/master...HEAD | grep -E '\.js$')
instead which will probably be faster too since it only parses the files you give it.
@pahen I mention that version in the attached issue. What I wanted to solve with --include
is to limit the nodes drawn in the graph to the set of files provided as input.
To make the intention clearer, I think of --include
as the counterpart of --exclude
and a combination of these two options works as a lightweight CLI version of the dependencyFilter
function.
Oh, I see. It would be nice to have this functionality without having to rely on a script. Let me think about this one a little bit.
Oh, I see. It would be nice to have this functionality without having to rely on a script. Let me think about this one a little bit.
Is there any update on this?
Hi, @danburzo . Thanks for this neat PR and the issue #219.
Considering myself as a user, it's kind of confusing when we have both --include
and --exclude
. I've this pattern this pattern in tsconfig or its example.
Since we can pass tsconfig.json
to madge already, maybe we can use the same style of include
, exclude
and files
?
Also, the current GitHub process doesn't allow me to accept this PR due to the deleted original repo. If you are interested please create a new PR. (This PR is currently stored in branch https://github.com/pahen/madge/tree/danburzo-include) Thanks again for the contribution.
P.S. It might worth mentioning that this PR is missing according tests. It's better to add them before merging
Hi @PabloLION, thanks for the ping. Honestly I need a moment to refresh my memory about this issue and PR. I had deleted my forked repo, but I can fetch the code and redo the PR if that's useful.
@danburzo I've managed to get the code without problem. My intention was to include you as a contributor of the repo, since we just started to maintain this repo. I'm not sure if you are still interested 😂 But thanks for the contribution anyway 😃
I've created a new PR, I will respond to your proposal there.