-
Notifications
You must be signed in to change notification settings - Fork 551
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
feat: find files func in prep for auto detection #886
Conversation
85aa30b
to
8456605
Compare
src/lib/find-files.ts
Outdated
const stats = await getStats(searchPath); | ||
if (stats.isDirectory()) { | ||
const paths = await readDirectory(searchPath); | ||
for (const subPath of paths) { |
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.
Do we want to do this asynchronously for found paths?
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.
Not sure I understand, could you elaborate?
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 think she is saying you can do Promise.all()
instead of for loop
(maybe with a pMap to reduce concurrency)
src/lib/find-files.ts
Outdated
const found: string[] = []; | ||
try { | ||
const stats = await getStats(searchPath); | ||
if (stats.isDirectory()) { |
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.
this whole function is quite hard to read with so many if else, maybe split it up and return early where possible?
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.
yea I'll take a look, it is a bit intricate😃
src/lib/find-files.ts
Outdated
): Promise<string[]> { | ||
const found: string[] = []; | ||
try { | ||
const stats = await getStats(searchPath); |
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.
maybe filePathStats
to be more explicit?
386417d
to
e87c2ac
Compare
Added find-files module with find function to help search for files. Added test for find and test fixtures. Ignore node_modules in sub directories or as given path. Co-authored-by: Lili Kastilio <lili@lilianakastilio.co.uk>
e87c2ac
to
8ef2bd9
Compare
🎉 This PR is included in version 1.258.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What does this PR do?
Added find-files module with find function to help search for files.
Added test for find and test fixtures.
How should this be manually tested?
Just helper function at the moment, separate PR to integrate with CLI commands and auto detection.
What are the relevant tickets?
BST-1072