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

feat: support custom fs #136

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feat: support custom fs #136

wants to merge 1 commit into from

Conversation

43081j
Copy link
Contributor

@43081j 43081j commented Mar 10, 2025

Adds a new fs option for specifying your own fs implementation.

Fixes #134

@@ -25,13 +26,23 @@ export type PathsOutput = string[];

export type Output = OnlyCountsOutput | PathsOutput | GroupOutput;

export type FSLike = {
Copy link
Contributor Author

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.
@SuperchupuDev
Copy link
Contributor

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 🙏

@michaelangeloio
Copy link

This is awesome!

@SuperchupuDev
Copy link
Contributor

it truly is

Comment on lines +13 to +14
import type { Dirent } from "fs";
import * as nativeFs from "fs";
Copy link
Contributor

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

@benmccann
Copy link
Contributor

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') {
Copy link
Contributor

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 😄

Copy link
Contributor Author

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

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

Successfully merging this pull request may close these issues.

fs option
4 participants