theme-app-extension and app blocks in staged environments

Solved

theme-app-extension and app blocks in staged environments

L4webdesign
Tourist
9 0 2

Hi everybody,

 

I just updated my app to use app blocks with the theme-app-extension. I have three environments for my app: local, stage, live.

 

Now I can only use theme-app-extension for one app. But I use the same repo for all three stages. This leads to the fact that I now have three directories in my project for my three different theme-app-extension environments. I also have to push each app-extension separately, which is very very inconvenient.

 

Do you have any suggestions or a better workflow on how to tackle this problem?

 

Thank you!

 

Lee

Accepted Solutions (2)

bishpls
Shopify Partner
26 6 21

This is an accepted solution.

Have you tried using the "Development Store Preview" functionality for theme app extensions?

 

https://shopify.dev/apps/app-extensions#app-extension-versioning

 

From your Shopify Partners account, navigate to:

App > Extensions > Select your Theme App Extension > Enable the "Development Store Preview" flag. 

 

Then create a new version for your app extension, which will only be applied to development stores until you click "Publish" to propagate it to production stores. 

 

You shouldn't need separate app repos, and can just run 

shopify extension push

as your 'build' command to test changes on the development store. 

 

(Getting the changes to refresh quickly is more annoying, as what causes Shopify to purge the internal cache for the app block is a bit unclear; I've found that loading the Online Store Theme Preview from your Admin account is reasonably reliable at purging the cached version of the dev store app block files.)

View solution in original post

AvocadosLab
Shopify Partner
51 4 45

This is an accepted solution.

I think following Github issue clearly matches with issue you are having.

https://github.com/Shopify/shopify-cli/issues/1387

View solution in original post

Replies 6 (6)

bishpls
Shopify Partner
26 6 21

This is an accepted solution.

Have you tried using the "Development Store Preview" functionality for theme app extensions?

 

https://shopify.dev/apps/app-extensions#app-extension-versioning

 

From your Shopify Partners account, navigate to:

App > Extensions > Select your Theme App Extension > Enable the "Development Store Preview" flag. 

 

Then create a new version for your app extension, which will only be applied to development stores until you click "Publish" to propagate it to production stores. 

 

You shouldn't need separate app repos, and can just run 

shopify extension push

as your 'build' command to test changes on the development store. 

 

(Getting the changes to refresh quickly is more annoying, as what causes Shopify to purge the internal cache for the app block is a bit unclear; I've found that loading the Online Store Theme Preview from your Admin account is reasonably reliable at purging the cached version of the dev store app block files.)

L4webdesign
Tourist
9 0 2

Hey @bishpls,

 

thank you very much, yes that pretty much answers my question.

 

But now that leads me to a new question:

I basically have 3 different apps in my partners dashboard. One for local development, one for staging and for production.

 

Based on your answer it seems like you don't have those different environments or stages, or there might not even be a need for that.

 

May I ask you how do you manage different environments?

johnyjoe
Shopify Partner
10 0 1

That's a good question, I was also wondering that.

In my case, I had to create another app just for local development since Shopify doesn't offer option to input URL for development (after app is published).

 

So the accepted answer doesn't really solve the issue with multiple environments for me.

Unless I'm missing something.

AvocadosLab
Shopify Partner
51 4 45

This is an accepted solution.

I think following Github issue clearly matches with issue you are having.

https://github.com/Shopify/shopify-cli/issues/1387

L4webdesign
Tourist
9 0 2

Hey @AvocadosLab, thank you very much! yes that completely matches my question.

 

And it's also scary to see, that there haven't been any updates on that issue as of now. It looks like this will continue to be an issue.

 

Best regards

 

Lee

Charles_Roberts
Shopify Partner
49 0 17

I have a separate branch for my development and production stages.

I have a different app for my development and production stages. This allows me to have one theme extension app source code, but I can different settings in the .env file:

 

Development:

 

SHOPIFY_SB_USER_EXTENSION_APP_V1_ID=[ID]
 

Production:

 

SHOPIFY_SB_USER_EXTENSION_APP_V2_ID=[ID]
 
And I have the same source code in:
 
└── extensions
    └── my-theme-app-extension
        ├── assets/extension.js
        ├── blocks/extension.liquid
        ├── snippets
        ├── locales
        ├── package.json
        └── shopify.extension.toml