injectable icon indicating copy to clipboard operation
injectable copied to clipboard

Support for micropackages

Open GoncaloPT opened this issue 3 years ago • 17 comments

following issue #139 this pull request adds support for micropackages.

In the readme section, you can find Support for micro packages section which explains how to use this feature.

The implementation took in consideration take many of us may not want to use this feature, therefore this feature is only enabled in 2 scenarios:

  1. if a module has @MicroPackageRootInit instead of @InjectableInit. This would typically be the 'root' package
  2. if a class exists in the package with @MicroPackage. this would typically be the micro package.

If the first annotation is found, the generator tries to find *.micropackage.json files inside the micro package folder, building then a micro_package.json that aggregates the information from all the found JSON files. After that, it uses that information to build the injection.config.micropackage.dart file which is used by injection.config.dart ( the call is just before return this
if the second annotation is found, the project generates the micropackage.json file, holding information about this micro package.

Although the fork is from version 1.0.4, I've included the last changes in this PR

GoncaloPT avatar Oct 14 '20 12:10 GoncaloPT

@Milad-Akarie @fabriziocacicia @TarekkMA @refi64 @doppio @Ascenio @mohanasundaramn Could one of you please look into this PR? I desperately need this feature and I do not wish to publish my own fork.

GoncaloPT avatar Oct 16 '20 10:10 GoncaloPT

Sorry for the delay, I'll try to look at it today.

On Fri, Oct 16, 2020, 12:07 PM Gonçalo [email protected] wrote:

@Milad-Akarie https://github.com/Milad-Akarie @fabriziocacicia https://github.com/fabriziocacicia @TarekkMA https://github.com/TarekkMA @refi64 https://github.com/refi64 @doppio https://github.com/doppio @Ascenio https://github.com/Ascenio @mohanasundaramn https://github.com/mohanasundaramn Could one of you please look into this PR? I desperately need this feature and I do not wish to publish my own fork.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Milad-Akarie/injectable/pull/146#issuecomment-709954393, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANECH6MJ6KCDD2Y55MXT5P3SLALPVANCNFSM4SQSC5BA .

Milad-Akarie avatar Oct 16 '20 12:10 Milad-Akarie

Sorry for the delay, I'll try to look at it today. On Fri, Oct 16, 2020, 12:07 PM Gonçalo @.***> wrote: @Milad-Akarie https://github.com/Milad-Akarie @fabriziocacicia https://github.com/fabriziocacicia @TarekkMA https://github.com/TarekkMA @refi64 https://github.com/refi64 @doppio https://github.com/doppio @Ascenio https://github.com/Ascenio @mohanasundaramn https://github.com/mohanasundaramn Could one of you please look into this PR? I desperately need this feature and I do not wish to publish my own fork. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#146 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANECH6MJ6KCDD2Y55MXT5P3SLALPVANCNFSM4SQSC5BA .

@Milad-Akarie Let me know if you need any help, i can assist or clarify any doubt that you may have..

GoncaloPT avatar Oct 21 '20 16:10 GoncaloPT

@GoncaloPT Hello, That's some nicely refactored code, I have some questions thu, is your main goal here only the micro libs that live in the packages folder? Are you assuming that users will run the generator on each micro-package separately?

Milad-Akarie avatar Oct 25 '20 13:10 Milad-Akarie

@GoncaloPT Hello, That's some nicely refactored code, I have some questions thu, is your main goal here only the micro libs that live in the packages folder? Are you assuming that users will run the generator on each micro-package separately?

Thanks @Milad-Akarie :) The idea is to run micropackages code generator only where you want. Let's assume I'm developing feature ABCD, I would have the code generator running inside my features/ABCD folder while developing. When I'm done with the task I would run the generator also in the root ( lib/ ) of the root project and that will pick up the generated json inside features/ABCD... Let me know if my response is clear enough. I've tried to add a working example of this methodology in the example project.

GoncaloPT avatar Oct 26 '20 15:10 GoncaloPT

@Milad-Akarie ping :)

GoncaloPT avatar Oct 30 '20 19:10 GoncaloPT

@Milad-Akarie Last call :)

GoncaloPT avatar Nov 07 '20 10:11 GoncaloPT

will be wonderful if it is supported. GoncaloPT, do you have any updates, Are you use it internally?

rafampessoa avatar Apr 07 '21 14:04 rafampessoa

will be wonderful if it is supported. GoncaloPT, do you have any updates, Are you use it internally?

Hello @rafampessoa, yes we are using it in our project - i was never able to merge this PR... never understood why it was ignored.

GoncaloPT avatar Apr 12 '21 09:04 GoncaloPT

any updates on this? @Milad-Akarie @GoncaloPT

daniellampl avatar Apr 23 '21 10:04 daniellampl

any updates on this? @Milad-Akarie @GoncaloPT

I've published my own fork named injectable_micropackges. I'm currently migrating to null safety. it can be found in pub.dev and on my github https://pub.dev/packages/injectable_micropackages

GoncaloPT avatar Apr 24 '21 17:04 GoncaloPT

But wouldn't it make sense to add this functionality to injectable? @Milad-Akarie

daniellampl avatar Apr 24 '21 23:04 daniellampl

Is it visible to fix conflicts in near future? Really waiting this feature

fryette avatar May 27 '21 12:05 fryette

Is it visible to fix conflicts in near future? Really waiting this feature

I could fix the conflicts but for what? I couldn't get any maintainer to approve this in the past

GoncaloPT avatar Jul 28 '21 18:07 GoncaloPT

Any updates on this? I found it interesting... @Milad-Akarie ?

Inakitajes avatar Feb 08 '22 09:02 Inakitajes

Any update? @Milad-Akarie This is a really important PR.

SAGARSURI avatar Feb 13 '22 08:02 SAGARSURI

yup! this functionality should be prioritised

KgotsoK avatar Feb 28 '22 15:02 KgotsoK

Hello @GoncaloPT I'd like to apologies for not merging your pull request and I think I awe you an explantation why I didn't and implemented my own. I didn't close this PR until now because I wanted a less-complicated (lesser - steps ) version but I wasn't sure if it's possible.

What I found inconvenient about this implementation is 1- Adding an extra builder/generator 2- Adding more annotations 3- generating a json file inside of dart-code folder 4- finally and most importantly not supporting external packages

Once again I apologize for not handling this PR professionally and thank you for inspiring me to implement this feature.

Milad-Akarie avatar Nov 22 '22 10:11 Milad-Akarie