decouple from inversify
moltar opened this issue · 6 comments
It would be great if the library was decoupled from a specific IoC implementation.
Do you think something like that would be possible to refactor with the current setup?
Thanks!
Hey @moltar sorry for the late reply! I agree and would like to tone down some of the opinions the library forces on consumers - especially around consumption of the internals.
Do you have any suggestions on a preferred approach? Personally I don't mind keeping inversify internally and offer consumers a generic set of IoC functions to interact with it (eg get
, rebind
etc). Is this what you had in mind?
@adenhertog I'm currently in a similiar camp, as I am currently using typedi. I realy would want to use this package, but can't (or better not want to) introduce another DI framework to the stack.
routing-controllers allows you to introduce your own ioc container into the system. Maybe something like this would be possible for bus?
I think this could be decoupled by exposing the following APIs to allow developer overriding functions for:
- Adding new injection rule.
- Getting new instance.
And it can keep the default inversify implementation in the library as default implementation following this concept
+1 would be great to be able to use within NestJS
Just an update for anyone following this, removal of inversify is mostly done in https://github.com/node-ts/bus/tree/remove-inversify.
This is obviously a breaking change, and the following is being worked on prior to merge to master:
- full test coverage
- update all the documentation
- integrate the alpha with a larger app to find any remaining issues
I can't commit to any timelines but hope to have this done in the next few weeks.
This is now released in alpha and available at master. docs are at https://node-ts.gitbook.io/bus/