Skip to content

Add "listing" flag support to theme commands #6007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chrisberthe
Copy link
Contributor

@chrisberthe chrisberthe commented Jun 23, 2025

Follow up to #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:

  • 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

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@chrisberthe chrisberthe requested review from a team as code owners June 23, 2025 19:37
@chrisberthe chrisberthe changed the title Add listing flag to dev, push, and share commands Add "listing" flag support to theme commands Jun 23, 2025
@chrisberthe chrisberthe force-pushed the add/listing-flag-to-theme-commands branch from 5a32b1e to 881d68a Compare June 25, 2025 15:31
Copy link
Contributor

@graygilmore graygilmore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing this out with theme dev worked well! Very neat! Couple of pieces of feedback and I'll ping the rest of the team to get one more set of eyes because I'm not too familiar with some of the pieces in here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧵 I'm not seeing any validation around if a user provides a --listing value that doesn't exist. I think we should stop the command and return an error otherwise they'd be left assuming their command worked but we actually never found a matching listing.

Copy link
Contributor Author

@chrisberthe chrisberthe Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I originally had a number of validation checks for this and ultimately decided on removing as I wasn't sure where to draw the line with what the CLI validates for versus the platform.

Currently, if you specify a non-existent listing, the platform will output an error about this, i.e. settings_data.json error when the "current" key is set to a non-existent preset/listing, but this will only happen after the dev server boots up, not before, which perhaps is less ideal than throwing an error before files are synced.

@chrisberthe chrisberthe force-pushed the add/listing-flag-to-theme-commands branch from 881d68a to d6d3181 Compare June 27, 2025 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants