Currently, globby or rather glob returns both directories and files. You can turn off returning directories using the nodir: true glob option, but that's not what you want. You'd rather want to expand directories into files. That's what this option should do. So globby.sync('foo') where foo is a directory would be expanded into all the files in that directory that doesn't match any of the ignore patterns. Same with globby.sync('foo/**'). There also needs to be a way to specify an array of extensions. In many cases you wouldn't want the expansion to happen for all files, but, for example, just .js files. It should override the nodir option if specified by the user.
This would be useful and simplify code in AVA, XO, cpy, imagemin-cli, and other tools expecting files. For example: https://github.com/avajs/ava-files/blob/master/index.js#L212-L271
@UltCombo @schnittstabil @jamestalmage @SamVerschueren @novemberborn Thoughts?
Currently,
globbyor ratherglobreturns both directories and files. You can turn off returning directories using thenodir: trueglob option, but that's not what you want. You'd rather want to expand directories into files. That's what this option should do. Soglobby.sync('foo')wherefoois a directory would be expanded into all the files in that directory that doesn't match any of the ignore patterns. Same withglobby.sync('foo/**'). There also needs to be a way to specify an array of extensions. In many cases you wouldn't want the expansion to happen for all files, but, for example, just.jsfiles. It should override thenodiroption if specified by the user.This would be useful and simplify code in AVA, XO, cpy, imagemin-cli, and other tools expecting files. For example: https://github.com/avajs/ava-files/blob/master/index.js#L212-L271
@UltCombo @schnittstabil @jamestalmage @SamVerschueren @novemberborn Thoughts?