fs-monkey icon indicating copy to clipboard operation
fs-monkey copied to clipboard

show-and-tell: fs-require

Open privatenumber opened this issue 4 years ago • 0 comments

First of all, thank you for your work on all these fs libraries @streamich. I use them in a lot of my libraries and they have saved me a lot of time and improved my DX.

I wanted to share a library I recently developed that might fit in well with the rest of your fs-suite: fs-require.

It's a localized version of fs-monkey for require()ing from a fs instance (eg. memfs). So instead of patching the global require(), it returns a new one that only reads from the given fs instance.

I am using it for testing a Webpack plugin by creating disposable fs instances using memfs and requiring the distribution code to see if it works.

If you'd like, I'd be happy to open a PR to add it to the "Reference" section in your README.md.

privatenumber avatar May 27 '21 21:05 privatenumber