-
Notifications
You must be signed in to change notification settings - Fork 64
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: support custom fs #136
base: master
Are you sure you want to change the base?
Conversation
@@ -25,13 +26,23 @@ export type PathsOutput = string[]; | |||
|
|||
export type Output = OnlyCountsOutput | PathsOutput | GroupOutput; | |||
|
|||
export type FSLike = { |
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 is purposely explicit rather than just FSLike = typeof nativeFs
since the fs
module has all sorts of exports (both types and actual exports) which we don't want to have to stub out to satisfy the type when bringing our own fs-like object
Adds a new `fs` option for specifying your own `fs` implementation.
was about to start working on this, then saw you had already implemented and pr'd it!! thanks a lot. hopefully @thecodrr can review soon 🙏 |
This is awesome! |
it truly is |
import type { Dirent } from "fs"; | ||
import * as nativeFs from "fs"; |
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.
just a style question probably for @thecodrr, but I wonder if these two lines should be combined into a single line
I noticed there aren't any docs being updated as part of this PR. That would probably be nice to add |
}) | ||
.crawl("node_modules"); | ||
await api[type](); | ||
if (type === 'withPromise') { |
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 might need to be double quotes to align with the project's style. i'm in the habit of using single quotes too though 😄
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.
Surprised it doesn't have a formatter setup, unless I just missed it somehow
If that doesn't exist, I'll open a separate pr to add prettier
Adds a new
fs
option for specifying your ownfs
implementation.Fixes #134