solidusio / solidus_support

Common runtime helpers for Solidus extensions.
BSD 3-Clause "New" or "Revised" License
9 stars 23 forks source link

Update `SolidusSupport.frontend_available?` to also check if SolidusStarterFrontend exists #68

Closed gsmendoza closed 2 years ago

gsmendoza commented 2 years ago

Goal

We want to update SolidusSupport.frontend_available? to also check if SolidusStarterFrontend exists so that extensions that call the method can detect if an app has a storefront generated from the StarterFE template.

Background

This is part of an ongoing effort to transition from the SolidusFrontend gem to SolidusStarterFrontend.

https://user-images.githubusercontent.com/61476/155482788-ec1014a3-9c5f-4956-8d2e-9646fc269126.mp4

How does the Solidus ecosystem use SolidusSupport.frontend_available?

Requirements

Given I have SolidusStarterFrontend installed on my Solidus app

When I call SolidusSupport.frontend_available?

Then it should return true

waiting-for-dev commented 2 years ago

Hey @gsmendoza, did you check it works as expected? Please, see https://github.com/solidusio/solidus_support/pull/66. IIRC, the app code is not available at the moment when .frontend_available? is called.

gsmendoza commented 2 years ago

@waiting-for-dev Thanks! I forgot about that. Will test it out...

gsmendoza commented 2 years ago

@waiting-for-dev

So far, I have found that the change to frontend_available? doesn't seem to break an app that uses the legacy SolidusFrontend gem.

However, the updated frontend_available? 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. If you remember, SolidusStarterFrontend already generates its own authentication frontend code. As a result, the legacy frontend code that is loaded by SolidusAuthDevise would conflict with the already-generated Starter FE authentication code.

It seems better to not change the definition of frontend_available?: that is, for its "frontend" to refer to the legacy frontend gem. I'm thinking that I'll eventually create a separate starter_frontend_available? method for checking if the app uses the new frontend.

I'll be closing this ticket for now.