Open vjpr opened 2 years ago
I addresed a similar use case in QUnit sometime ago using picomatch
incombination with a recursive fs.readdir
call (for gathering files), and node-watch
for performant watching over an entire project (and exclude node_modules):
https://github.com/qunitjs/qunit/commit/b7fb112d61dd9a03c69e32c9da204defb1b166c1
I switched the "gather files" part from picomatch to tiny-glob
in the above change, because I found it to make the code simpler (and probably faster too). If you need to gather all files but not enter node_modules, I would restructured the call so as to invoke glob separately for the top-level directories and skip node_modules
at that level, and use glob only for recursing within each of the top-level directories.
In a monorepo this won't work - there will be 100s of nested node_modules
. tiny-glob
needs to have a way to not enter dirs.
Agree, without this feature, I can't adopt tiny-glob, which I was planning to do for storybook.
It's probably easier to add an exclude
option to prevent traversing of unwanted directories.
see #74 see How to exclude directory from reading? for fast-glob
any update?
Using
!(node_modules)/**/package.json
still seems to search withinnode_modules
...or at least its still very slow compared to every other library I'm testing.