globby is a .gitignore
-style
file globber for JavaScript. It's not a general replacement for glob,
but it is potentially a better choice if you're globbing a large js
project and applying a long list of exclusion patterns.
not to be confused with the other globby. sadlol story here (i thought i had learned my lesson after the i18nline/i18nliner fiasco, but apparently not).
npm install gglobby
var Globby = require('gglobby');
// all files matched by the rules
Globby.select(rules).files;
// all other files
Globby.reject(rules).files;
// ooh chaining!
Globby.select(rules).reject(other_rules).files;
> var rules = fs.readFileSync('.gitignore').split(/\n/)
=> ["/node_modules", "/tmp", "/build"]
> Globby.select(rules).result
=> [
"node_modules/browserify/.npmignore",
"node_modules/browserify/.travis.yml",
...
"tmp/test/extractors/translate_call_test.js",
"tmp/test/extractors/translation_hash_test.js"
]
.gitignore
'd and/or you want to do somethingglobby is compatible with .gitignore
rules; it respects negated patterns, and
ignores comments or empty patterns. That said, it supports some things that may
or may not work in your version of git. These platform-dependent .gitignore
behaviors are platform independent in globby and can always be used:
**
matches directories recursively.Copyright (c) 2015 Jon Jensen, released under the MIT license