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

add { ignore: [globs] } #23

Closed
stefanpenner opened this issue Dec 30, 2015 · 8 comments
Closed

add { ignore: [globs] } #23

stefanpenner opened this issue Dec 30, 2015 · 8 comments

Comments

@stefanpenner
Copy link
Collaborator

Often the current whitelist globs do the trick, but implementing the blacklist performantly is non-obvious and sometimes not possible.

I'm leaving this as a place-holder, I intend to implement this sometime. But if someone beats me to it, I will not be offended.


My thoughts are as follows:

walkSync(root, { ignore: [array, of, globs/strings] });

Similar to, https://github.com/joliss/node-walk-sync/blob/master/index.js#L53-L55 we would just prune a dir early. And instead of mayContain I believe we must use an explicit match, which MatcherCollection already supports

Then finally before appending to the output paths, a full check should occur.

All of this should be pay as you go, if people don't use it we should avoid those branches.

@alexlafroscia
Copy link
Contributor

alexlafroscia commented Jul 21, 2016

Is there a way to get this kind of behavior right now? I'm working on this PR and after hearing you mention this project last night at the Ember meetup, figured it was worth checking to see if this is faster than the glob package that I'm using right now. I want to be able to explicitly avoid walking through the whole node_modules and bower_components directories since they're often pretty huge and I don't care about the files in it.

@stefanpenner
Copy link
Collaborator Author

@alexlafroscia in many cases walkSync will just do the right thing (no need to ignore) as it decomposes the globs to prune directories early.

For example:

walkSync('.', ['bower_components/jquery/**/*.js', 'app/**/*.js']

Will be smart enough to only traverse the following deeply app/**/* and bower_components/jquery/**/* and '. shallow, even though the root is at .

@stefanpenner
Copy link
Collaborator Author

but yes, in your case glob('**/.jshintrc' would be the canonical example of when a blacklist would be good. Currently this isn't possible (as the issue describes) but it would be great to have this functionality added.

@alexlafroscia
Copy link
Contributor

Gotcha, thanks for the pointers. I'll look into some of those links you provided above and see if I can get a PR together to implement this.

@alexlafroscia
Copy link
Contributor

Anything else I should know before trying it out?

@stefanpenner
Copy link
Collaborator Author

@alexlafroscia not that I can think of, feel free to submit a PR early (here or maybe matcher-collection) so I can provide feedback and help guide.

@alexlafroscia
Copy link
Contributor

Sounds good!

@stefanpenner
Copy link
Collaborator Author

@alexlafroscia awesome, I am excited to get a hand \w this. It seems like your use-case is perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants