Skip to content

Conversation

tadeuzagallo
Copy link

Add the simplest possible implementation of ignore option that allows not to watch directories that match
the given glob(s).

Added to allow to ignore the node_modules folder of React Native. It was causing an EMFILE error because it'd exceed the allowed number of open file descriptors on Travis CI.

Right now it was just implemented on NodeWatcher but I can add it to the other watchers if you think it's useful/necessary.

It currently supports:
new NodeWatcher('path/to/project', { ignore: 'node_modules' })
new NodeWatcher('path/to/project', { ignore: ['a', 'b', 'c'] })

@amasad
Copy link
Owner

amasad commented May 28, 2015

My concern with this is that it's only implemented at the initialization phase. Imagine if an ignored node_modules dir is created when the program is running. It should then be run by the ignore filter. Let's add it to common.js in the function isFileIncluded (that would give us support in the other watchers for free).

Also, a test would be fantastic 👍

@tadeuzagallo
Copy link
Author

I moved the logic to common.js, but since the repo has 21910 folders I had to add a short check specific to NodeWatcher.

Also add a couple of simple tests

@stefanpenner
Copy link
Collaborator

so, i think to add such a feature it should attempt to use the best possible ignore across all watchers. Watchman for example, has a low level ignore that is significantly more performant then doing it in JS.

Currently, I am unsure if this is configurable via the JS API. But it is configurable via .watchmanconfig. It would be nice it was also configurable via the JS api.

@amasad
Copy link
Owner

amasad commented Feb 13, 2017

closed via #79

@amasad amasad closed this Feb 13, 2017
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

Successfully merging this pull request may close these issues.

3 participants