Given the directory structure:
/Users/doge/very/amaze.js
/usr/local/bin/wow
/node_modules/
/css/
/css/somefile.css
/lib/
/somelib/
/anotherlib/somedir/finallib.js
/index.html
/somefile.test
/somelib/file.html
/firstdir/seconddir/file.css
/node_modules.txt
How would I only exclude the node_modules directory using extglob?
/!(node_modules)
The above matches everything at the root level except the node_modules directory and text file (which we want to include). It also doesn't follow matching directories recursively.
/!(node_modules)/**
This one is closer, but it also excludes all of the files in the root directory. Even if it included files at the root level, I'm guessing it would exclude the node_modules.txt file.
P.S. This is for file matching using grunt-ssh and minimatch node modules.
This one can solve your problem:
/!(node_modules){,/**}