Do not ignore me#193
Conversation
|
Thanks @retrofox, I really really appreciate it when users of a project are involved and contribute back - especially when they have tests heh. So please don't get discouraged from further contributions. Here are some thoughts:
|
|
Hi @zertosh for your thoughts. Let me add some comments:
I know isn't best solution but
Yes, but
I think the problem is because we aren't handling when a new watcher should't be created (yes, again). |
|
Doing some changes. I've added |
|
Ok. I've added # my Makefile
# Just watch .jade, .json and .js files and ignore node_modules folder
watchify
.
--ignore-watch="/^((?!\.j(ade|son|s)).)*$$/" \
--ignore-watch="**/node_modules/**" \
--oufile build.js |
Yes. But chokidar instances are super cheap. At most, you're talking about bytes of memory per instance. Even if you have 9k instances, that's probably less than 1MB. And those are just "dead" instances, they don't do any work. The expensive part is the file system watching. When a file is ignored, chokidar won't actually setup any fs watchers. See #65 for more context.
Not really because no fs watchers were setup by chokidar, so the update function never gets called.
The way we use chokidar makes this an implementation detail. The standard for filename patterns is globs. anymatch also takes functions, but aren't going to handle that. If someone really wants to pass in a regex or function, they can use the API instead of the CLI.
It's setting a sane default value that chokidar will then decide on. What you proposed was preempting chokidar's matching logic by doing it in watchify in some cases - double logic.
globs are very important notation. They're universally supported across languages, shells, and even OSes.
It's only a CLI limitation (via the API you can do whatever you want) for 2 reasons: globs are the standard for shell commands, and inventing your own pattern for sniffing out regexs from strings is a Bad Idea.
As mentioned above, this isn't a big deal because the fs watchers aren't created if chokidar matches the ignored pattern.
Sorry dude. I recommend you look at node-glob. There are also a bunch a changes that are just noise in your commits - like whitespace and comma changes. Those changes, although an improvement, make the git history hard to read. Unless there's a good reason why globs with chokidar don't work, I'd only then consider switching to handling ignoring inside of watchify, and only if it's implemented in the same way that browserify already handles file patterns. |
|
ok @zertosh. Thanks for your feedback. I've cleaned a lot this PR. It's ignoring files using |
|
I'll close this one and start a new one. Apologies. |


The title is just a joke. :-D because I've working in how to improve ignored files processing.
regexp
Allow give a regexp in
ignore-watchparameter. As you knowchokidarallow pass a regexp in itsignoredoption parameter:However we can't do it through of
ignore-watch.So in this PR it could be a string:
or a regexp
Keep in mind that
ignore-watchalways is a string but now if it is wrapped in/chars then a RegExp will be created. Look at this complex ignoring condition:Multiple ignore-watch parameters
This PR allows give more that one
--ignore-watchparameters.Improve ignoring
I've added conditionals in some places of index.js to ignore completely those files that not match with
ignore-watchparam (when it is a regexp).It improve considerably the compiling time and avoids to call to compiling process every time a file is edited no matter what type of file being edited (as now it does).
Test
I've created
bin_ignore_watch_regexp.jstesting file.