Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrays of globs with negation #82

Open
aomarks opened this issue Mar 23, 2022 · 1 comment
Open

Arrays of globs with negation #82

aomarks opened this issue Mar 23, 2022 · 1 comment

Comments

@aomarks
Copy link

aomarks commented Mar 23, 2022

Currently, tiny-glob takes a single glob string.

It would be nice if it could also take an array of glob strings, where negations apply to previous items in the array.

For example, given the files:

src/foo.js
src/bar.js
src/test/baz.js

then the invocation:

await glob([
  'src/**/*.js',
  '!test'
]);

would return:

src/foo.js
src/bar.js

This syntax is supported by fast-glob (ref), and is common in applications such as .gitignore files, and the package.json files array.

@aomarks
Copy link
Author

aomarks commented Mar 23, 2022

For further reference, the glob library does not support arrays of globs, and NPM implements the behavior described above by doing its own transformation of the globs and the glob results: https://github.com/npm/npm-packlist/blob/f56a4cf77fbbb123f3c818777cf00555538e1c1c/lib/index.js#L224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant