cli icon indicating copy to clipboard operation
cli copied to clipboard

Add "listing" flag support to theme commands

Open chrisberthe opened this issue 6 months ago • 10 comments

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 --listing flag to shopify theme dev, shopify theme push, and shopify theme share commands
  • 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.json preset switching, i.e. "current" key, based on listing name

How to test your changes?

  1. 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
    
  2. Test development with listing:

    shopify theme dev --listing preset-name-one
    
  3. Test push with listing:

    shopify theme push --listing another-preset-name
    
  4. Test share with listing:

    shopify theme share --listing preset-name-one
    
  5. 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

chrisberthe avatar Jun 23 '25 19:06 chrisberthe

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?

chrisberthe avatar Jul 25 '25 14:07 chrisberthe

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.

github-actions[bot] avatar Aug 25 '25 03:08 github-actions[bot]

Commenting so that this won't get closed automatically. It's still relevant and needed for theme development, waiting feedback from @chrisberthe and @karreiro

anastis avatar Aug 25 '25 08:08 anastis

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.

github-actions[bot] avatar Sep 26 '25 03:09 github-actions[bot]

Any progress on this?

anastis avatar Sep 26 '25 08:09 anastis

Any progress on this?

This fell by the wayside. Will look into the remaining feedback and address.

chrisberthe avatar Oct 02 '25 12:10 chrisberthe

@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 base templates/ or sections/ folders. Example: if listings/<preset>/templates/index.json exists, sync to this folder, but if that file didn't exist, sync to templates/index.json.

Personally, leaning towards the latter. What do you think?

chrisberthe avatar Oct 02 '25 15:10 chrisberthe

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.

github-actions[bot] avatar Nov 06 '25 03:11 github-actions[bot]

Still relevant. @chrisberthe waiting feedback from @karreiro

anastis avatar Nov 06 '25 10:11 anastis

Can't say when this will be merged @anastis, but I can say that having to repeatedly rebase this is getting annoying 😛

chrisberthe avatar Nov 20 '25 15:11 chrisberthe