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

[copy] filter is applied to directories, even though docs say it's just applied to files #843

jedwards1211 opened this issue Oct 29, 2020 · 2 comments


Copy link

@jedwards1211 jedwards1211 commented Oct 29, 2020

Hence I can't use a filter like file => file.endsWith('.js') because that excludes directories that don't end with .js.

The docs only mention files:

filter : Function to filter copied files. Return true to include, false to exclude. Can also return a Promise that resolves to true or false (or pass in an async function).

However when I log what the filter gets called with, it gets called with directories.

Copy link

@RyanZim RyanZim commented Oct 29, 2020

Ah, yeah; docs aren't well-written here. Calling with directories is intended behavior, but docs should reflect that. PR welcome to clarify docs. Also CC @manidlou

Copy link

@jedwards1211 jedwards1211 commented Oct 29, 2020

okay, I'll also make a separate issue about passing isDirectory to the filter, since I'm pretty sure copy already knows that so it would be a waste for the filter function to have to stat the path.

@RyanZim RyanZim self-assigned this Apr 2, 2021
RyanZim added a commit that referenced this issue Apr 2, 2021
Fixes #843
@RyanZim RyanZim closed this in #884 Apr 8, 2021
RyanZim added a commit that referenced this issue Apr 8, 2021
* Clarify docs for copy*() filter

Fixes #843

* Implement suggestion

#884 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants