[Feature]: Theme command to load the default environment #4692
Labels
Area: @shopify/theme
@shopify/theme package issues
open for contributions
theme bugs that won't be prioritized in the near future
Type: Enhancement
New feature or request
What area(s) will this request affect?
Theme
What type of change do you want to see?
New feature
Overview
The Shopify CLI already supports environment settings through
shopify.theme.toml
. I propose a small tweak to improve the default behavior by automatically loading the default environment if it is available.Proposed Change
Modify the default behavior of shopify theme related command to load the environment configuration by default. Specifically:
shopify theme dev
, the CLI would effectively executeshopify theme dev -e default
in the background.shopify.theme.toml
file with the default store settings, the command will automatically load these settings.shopify.theme.toml
file doesn’t exist or doesn't contain default environment, the CLI would continue to work as it currently does —without any breaking changes.Example Configuration
With this change, developers could avoid unexpected deployment issues and simplify their workflow, particularly when switching between different stores.
How do you feel about this feature enhancement? If this makes sense, I’d be happy to go ahead and raise a PR to implement it.
Motivation
Currently, the Shopify CLI remembers the last store that was worked on and keeps this stored for future sessions. However, this behavior can lead to unexpected issues: when a developer switches to another project folder and runs
shopify theme dev
, the CLI mistakenly uploads files to the previous working store instead of the intended one. This can cause significant, unintended trouble, especially if the developer is unaware of this stored preference.Although there are alternatives, such as setting the environment variable manually or writing scripts to ensure the correct store information is set, I believe the CLI could handle this more seamlessly by improving the default behavior. A solution that prevents accidental deployment to the wrong store would benefit everyone and make the experience smoother and safer for all users.
The text was updated successfully, but these errors were encountered: