Add "listing" flag support to theme commands
Follow up to https://github.com/Shopify/cli/pull/6002.
WHY are these changes introduced?
Shopify introduced new requirements for the Shopify Theme Store that require themes with multiple presets to include a /listings directory in their theme zip submissions. However, developers need a way to preview and test these specific theme presets during development and deployment.
WHAT is this pull request doing?
- Added
--listingflag toshopify theme dev,shopify theme push, andshopify theme sharecommands - Implemented "file overlay" to serve listing-specific templates and sections when available
- Updated theme file watching to monitor the active listing directories during development
- Added
config/settings_data.jsonpreset switching, i.e."current" key, based on listing name
How to test your changes?
-
Create a theme with a
listings/directory:theme/ ├── listings/ │ ├── preset-name-one/ │ │ ├── templates/ │ │ │ └── *.json │ │ └── sections/ (optional) │ │ └── *.json │ └── another-preset-name/ │ ├── templates/ │ │ └── *.json │ └── sections/ (optional) │ └── *.json -
Test development with listing:
shopify theme dev --listing preset-name-one -
Test push with listing:
shopify theme push --listing another-preset-name -
Test share with listing:
shopify theme share --listing preset-name-one -
Verify that listing-specific files are served when they exist, and base theme files are used as fallbacks when they don't
Measuring impact
How do we know this change was effective? Please choose one:
- [x] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
- [ ] Existing analytics will cater for this addition
- [ ] PR includes analytics changes to measure impact
Checklist
- [x] I've considered possible cross-platform impacts (Mac, Linux, Windows)
- [x] I've considered possible documentation changes
Thanks @karreiro. I'm taking vacation so I'll look into this once I'm back in a week or so. Could you share some thoughts on this point?
This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.
Commenting so that this won't get closed automatically. It's still relevant and needed for theme development, waiting feedback from @chrisberthe and @karreiro
This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.
Any progress on this?
Any progress on this?
This fell by the wayside. Will look into the remaining feedback and address.
@karreiro Going to need your input on --theme-editor-sync with --listing. Thinking of two options here:
- Always sync JSON files to
listings/<preset>/.... This keeps things isolated per preset but also generates lots of, potentially unwanted, files per preset. - If a JSON file exists in
listings/<preset>/..., sync to that folder, otherwise sync to the theme's basetemplates/orsections/folders. Example: iflistings/<preset>/templates/index.jsonexists, sync to this folder, but if that file didn't exist, sync totemplates/index.json.
Personally, leaning towards the latter. What do you think?
This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.
Still relevant. @chrisberthe waiting feedback from @karreiro
Can't say when this will be merged @anastis, but I can say that having to repeatedly rebase this is getting annoying 😛