Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix(assets): support exceptions to exclude patterns #4473
fix(assets): support exceptions to exclude patterns #4473
Changes from 5 commits
3af6b91
e0738c3
dce18c6
00c3852
5faf3ca
d4cff4d
89c792f
9cc89c8
13602a5
65a3f96
6afead3
3b745bd
1462566
5abcf66
12d896e
2172793
47bc251
e5bf485
4966740
6059be0
4a1d7b6
7f40962
baa4315
273d3f5
db504be
a26d7f2
10e62b5
c426803
0c528db
c07eb60
5de1e6d
1e9476d
455f912
b49f64f
44f7757
ab92e3f
af2098b
9cf39b0
02a8d0e
23331a3
fc95caa
e2cee6b
75f7c3c
d2d9f43
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be done in-line while traversing. It is also possible to run through the list of entries in the ignore list, see which ones are directories and treat those as prefixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, I'd like to convert the "list of exclude/include entries" into a function or class that encapsulates the behavior as soon as possible and pass that around.
I'm thinking something like:
ignoreList
will be either of type(path: string) => boolean
, or be a class with a method of that type.I would have that as an argument to
listFilesRecursively()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that it wouldn't be very economical,
fs
calls-wise. I'm filling theexclude
directory on the fly because I'm also checking thestat
of the files I'm traversing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do these tests in memory?
I'm thinking of a test where we have preloaded this list of ignore patterns, and pushing a number of paths past it (either by means of
shouldExclude()
or by means of a newIgnoreList
API)That is effectively the same and easier to change/assert against than making a whole new fixture with "just these" files in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up creating a
createFsStructureFromTree
function, and removing the previous fixtures (with the exception ofdemo-image/
).Does that work for you?