I'm working with a massive monorepo, and I'm trying to write a script that will need to grab some information from all of the monorepo's package.json files, but not and package.json files that are nested in any of the node_modules folder. I've tried everything apart from just filtering them with a regex after recursively going through the entire directory, including the node_modules folder. I'm aware that that's an option, but ideally I'd like to be able to filter those directories before the search for performance reasons. The monorepo structure looks something like:
root/
node_modules/
apps/
someApp/
node_modules/
someApp2/
node_modules/
packages/
somePackage1/
node_modules/
somePackage2/
node_modules/
somePackage3/
node_modules/
...
Any help would be greatly appreciated! Thanks.
I would go through the whole file tree and skip everything that is
node_modules.This will be much more perfomant then searching for all
package.jsonand filtering them by their path.