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

FR: Load drivers on demand #9

Open
micalevisk opened this issue Jan 31, 2022 · 3 comments
Open

FR: Load drivers on demand #9

micalevisk opened this issue Jan 31, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@micalevisk
Copy link

micalevisk commented Jan 31, 2022

Is your feature request related to a problem? Please describe.

I want to use the fs driver and another cloud driver. I might not need S3 thus I won't need the aws-sdk dependency as well

"dependencies": {
"aws-sdk": "^2.1058.0",
"file-type": "^17.1.1",
"fs-extra": "^10.0.0",
"rxjs": "^7.5.2"
},

That dep is quite huge. Having that installed doesn't make much sense in my use case

image

Describe the solution you'd like

Moving hard dependencies that are driver-specific (like fs-extra and aws-sdk) to optional peer dependencies list

image

image

Describe alternatives you've considered

I can use overrides from NPM v8+ or resolutions from Yarn to override those deps to some "noop" one like this one. But this sounds a bit hacky and not reliable to me as those drivers are not lazily loaded.

With this approach, using Yarn, my node_modules size becomes 5x smaller.

Additional context

Having such feature will problably require a major release because now users will need to install those deps beforehand.

At same time, this feature will we could to make the package size smaller regardless of how many drivers are supported.

@vinayak25
Copy link
Contributor

Hello @micalevisk, I agree with your feedback and the drivers should be made available on demand. Due to office work, I have not been able to focus on this much lately. If you would like to contribute to this package, and raise a PR. Otherwise I will pick this up on coming weekends and do it!

Cheers! 💯

@vinayak25 vinayak25 added the enhancement New feature or request label Jan 31, 2022
@vinayak25 vinayak25 self-assigned this Jan 31, 2022
@micalevisk
Copy link
Author

can we use this loadPackage helper approach from NestJS

https://github.com/nestjs/nest/blob/89124ad6d33cbeb55d1f11d6dd69f9e7a95b0f47/packages/common/utils/load-package.util.ts

or do you have another ideia?

I've been pretty busy too but I would like to use nest-storage with GCS thus this feat will be good for me

@vinayak25
Copy link
Contributor

Sounds like a good solution to me. I will pick it up, you make sure that you don't miss the deadlines :p

Happy Coding! Cheers 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants