-
-
Notifications
You must be signed in to change notification settings - Fork 479
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
How to find a folder
that are not inside folder
#335
Comments
The ignore doesn't prevent it from searching inside |
This is also discussed here: #213 (comment) |
@isaacs After a lot of testing It seems there is no way to achieve this.
I feel like the addition of an option to not match the parent dir of a globstar expression would help solve this. Use case: Excluding |
Will search all But if you have 100s of packages in your |
Yes I see that glob is not actually right solution for this case, actually I had some other problems with |
@whitecolor Its a shame though because you can get very, very close to a simple elegant glob solution, but then this limitation makes it unfeasible and you have to write your own. I ended up writing my own recursive directory walker. But I am trying to integrate with chokidar for file watching, which also uses globbing. So its a pain that globs don't work. In both glob and chokidar, there should be two ignore options, one for searching, and one for returning results. |
This did the job for us https://github.com/mrmlnc/fast-glob#how-to-exclude-directory-from-reading |
could you specify what pattern you used exactly? I tried |
We used ignore option https://github.com/mrmlnc/fast-glob#ignore. |
What syntax did you use? |
This works in v9, but yes, it does read the
I think it would be a good feature addition in v9 to allow you to pass in a Then you could do something like: globSync('**/node_modules', {
ignore: {
ignore: (p) => false,
ignoreChildren: (p) => p.name === 'node_modules',
},
}) The challenge here is that the pattern Alternatively (or in addition to this), the Ignore logic should be smart enough to realize that |
Custom ignores will be in the 9.2 release. |
The task is to find all
node_modules
in the project tree, that are not inside other node_modules.I tried unsuccessfully something like:
('**/node_modules/', {ignore: '**/node_modules/**/node_modules/'})
('**/node_modules/', {ignore: '**/node_modules/**'})
Any advice on this?
The text was updated successfully, but these errors were encountered: