-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add SolidusSupport.starter_frontend_available? to check if SolidusStarterFrontend exists #69
Conversation
…rterFrontend exists Where does the Solidus ecosystem currently use `SolidusSupport.frontend_available?` ----------------------------------------------------------------------------------- * The extension's engine checks if frontend is available before adding assets to the app's lib and precompile paths. * The EngineExtensions module from SolidusSupport automatically adds the extension's frontend classes to the app's lib. Why not just update `SolidusSupport.frontend_available?` to check if Starter FE is available? --------------------------------------------------------------------------------------------- While updating `frontend_available?` doesn't seem to break an app that uses the legacy SolidusFrontend gem, it currently doesn't work with SolidusStarterFrontend. This is because the updated `frontend_available?` allows SolidusAuthDevise to load its (legacy) frontend code to a Starter FE-based app. SolidusStarterFrontend already generates its own authentication frontend code, so the legacy frontend code that is loaded by SolidusAuthDevise would conflict with the generated Starter FE authentication code. It seems better to keep the definition of `frontend_available?` unchanged, that is, for the method to refer to the legacy frontend gem. Requirement ----------- Given I have SolidusStarterFrontend installed on my Solidus app When I call `SolidusSupport.starter_frontend_available?` Then it should return true
Hey @gsmendoza, can you help me understand the big picture? Where are you going to call |
I am not a big fan of having But I understand @gsmendoza argument. I still feel that we should/must find a clean(er) solution for this. |
@waiting-for-dev Here are some Solidus apps where I tested that SolidusHelloWorld extension install generator:
@wintermeyer I'm okay with with the |
For the method vs. parameter discussion, I'd go with different methods. As the caller already knows which path it wants to take, I think it'd be a case of control coupling. Anyway, I agree that asking from within the extension is not ideal, as we're simulating polymorphism. Maybe we could have the core components providing hook points or something else. But I'm afraid that would require changing A LOT of things... |
hmmm... what do we do if there is the need for another |
@wintermeyer I like what @waiting-for-dev said about control coupling. I think the best time to switch to a parameter-based solution is when the choice of frontend has be decided during runtime.
Our current direction is to replace the SolidusFrontend gem with the Starter FE. It's unlikely that we'll add new frontends in the future. However, even if we do, I think what I said earlier still applies: the best time to switch to a parameter-based solution is when the choice of frontend will be decided during runtime. It might be clunky having a several methods for the frontends, but with only a few of them, it's probably tolerable hehe :) |
Should we rename |
After thinking about it, I think the best solution here would be to do nothing! Let me explain better. As the edge guides point out (and @gsmendoza shared in another channel), we want to discourage solidus extensions from providing storefront code. The reasons for that are that many different storefronts exist, plus they're usually customized so that it's difficult that an extension can integrate seamlessly. Because of that, we don't want to provide an officially endorsed method to do that. If an extension really wants to extend one of the specific frontends, they can check themselves for the existence of, for instance, the Before reaching that conclusion, I had thought about coming up with a solution similar to the one proposed in #66. That's to say:
The above would allow having the system open for extension (create a new system) but closed for modification (that wouldn't require updating However, as I said before, probably the best thing is to do nothing about it, as that's a behavior we want to discourage. Thoughts? |
I like your argumentation. |
I'm good with not implementing anything. No code = best code :D
…On Fri, Mar 11, 2022, 1:27 PM Stefan Wintermeyer ***@***.***> wrote:
After thinking about it, I think the best solution here would be to do
nothing!
I like your argumentation.
—
Reply to this email directly, view it on GitHub
<#69 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAPAJDV3WXHIKG4OLJFZ3DU7LKS3ANCNFSM5QIE4AEQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Where does the Solidus ecosystem currently use
SolidusSupport.frontend_available?
The extension's engine checks if frontend is available before adding
assets to the app's lib and precompile paths.
The EngineExtensions module from SolidusSupport automatically adds the
extension's frontend classes to the app's lib.
Why not just update
SolidusSupport.frontend_available?
to check if Starter FE is available?While updating
frontend_available?
doesn't seem to break an app that uses thelegacy SolidusFrontend gem, it currently doesn't work with
SolidusStarterFrontend. This is because the updated
frontend_available?
allows SolidusAuthDevise to load its (legacy) frontend code to a Starter
FE-based app. SolidusStarterFrontend already generates its own authentication
frontend code, so the legacy frontend code that is loaded by SolidusAuthDevise
would conflict with the generated Starter FE authentication code.
It seems better to keep the definition of
frontend_available?
unchanged, thatis, for the method to refer to the legacy frontend gem.
See #68 for a previous attempt to change
SolidusSupport.frontend_available?
to check if Starter FE is available.Requirement
Given I have SolidusStarterFrontend installed on my Solidus app
When I call
SolidusSupport.starter_frontend_available?
Then it should return true