Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation CLI --exclusions arrays (Help Request) #280

Open
Cleanshooter opened this issue Mar 26, 2021 · 4 comments
Open

Documentation CLI --exclusions arrays (Help Request) #280

Cleanshooter opened this issue Mar 26, 2021 · 4 comments
Labels
viz visualization enhancement, graphviz

Comments

@Cleanshooter
Copy link

Cleanshooter commented Mar 26, 2021

Great Tool. I love this thing, I'm just struggling to figure out how to use the regex array.

Right now I'm using the following CLI command:
madge --exclude '(test)','^client\/.*$' --image ../myApp-20210326.svg ./

It's properly excluding all my files with the word "test" in them but I can't get it to ignore everything in my '"client" folder. I'm trying to build a tree of just my server at the moment and I want it to ignore this folder. I've tried a few variations on the regex (e.g. ^\/client\/.*$, ^\/client.*$, (client) ) but it seems to be ignore the full path and only looks at the file name... that or I'm missing something.

@Cleanshooter
Copy link
Author

Scratch that... my original --exclusion doesn't work at all... I expect I'm doing CLI arrays wrong. I used the same format as the --extensions (e.g. --extensions js,jsx).
This works...
madge --exclude '(test)' --image ../myApp-20210326.svg ./

but it seems that by adding the comma and 2nd criteria breaks it.

@Cleanshooter Cleanshooter changed the title Documentation Help Documentation CLI --exclusions arrays (Help Request) Mar 26, 2021
@metal450
Copy link

metal450 commented Apr 11, 2022

Likewise, I'm trying to run on the CLI & exclusions don't seem to be working. Looks like it's been over a year & nobody has addressed this, just curious if you ever got it working?

Specifically, my command is:

madge --circular --extensions ts,js --exclude '^(dist|public)' --ts-config ./tsconfig.json --warning .

My project has frontend files (tsx) under public/, and output compiled js under dist/, both of which should be ignored. However, not only do I see it scanning both of those folders while it runs (not sure if that's typical behavior to scan ignored paths?), but it's reporting warnings in files that are definitely in the frontend .tsx's. So either it's running on those tsx (despite specifying only ts & js), or more likely, it's running on their compiled js in dist (despite the exclude). I'd mention that both "dist" and "public" are also excluded in tsconfig, if that's relevant.

I also tried running it with --debug, but if I run it in console, it crashes with out-of-memory, and if I pipe to a file, it gets so big that it literally fills up my SSD (I had to cancel when the log file surpassed 25 gigs).

@metal450
Copy link

metal450 commented Apr 11, 2022

Seems like there are multiple issues getting exclude to work as expected.

Seems like some guidance on this might be a good idea, considering that people have been struggling with it for at least 3 years (1st issue is from Jan 2019)

Also tried:

{
    "fileExtensions": ["js","ts"],
    "tsConfig": "tsconfig.json",
	"excludeRegExp": ["^.*dist.*$", "^.*public.*$"]
}

But scanning still shows all the dist/ directories, and warnings is still showing imports from files that are definitely either in public/ or dist/.

@metal450
Copy link

@pahen ?

@PabloLION PabloLION added the viz visualization enhancement, graphviz label Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
viz visualization enhancement, graphviz
Projects
None yet
Development

No branches or pull requests

3 participants