Skip to content

Add typed JSON output to theme preview - #8645

Draft
gonzaloriestra wants to merge 1 commit into
gonzalo/json-theme-sharefrom
gonzalo/json-theme-preview
Draft

gonzaloriestra wants to merge 1 commit into
gonzalo/json-theme-sharefrom
gonzalo/json-theme-preview

Conversation

@gonzaloriestra

@gonzaloriestra gonzaloriestra commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

theme preview already emits JSON, but its result has no discoverable schema and its service also renders output and opens the browser.

Part of https://github.com/shop/issues-develop/issues/23695.

WHAT is this pull request doing?

Return a typed preview result and move presentation and browser opening into the command. Preserve the compact JSON keys, success messages, file/API errors, and nonfatal browser behavior. Browser failures use typed diagnostics in JSON mode.

Normal output:

Preview is ready
• https://abc123.shopifypreview.com
• Preview ID: abc123

Matching result:

{"url":"https://abc123.shopifypreview.com","preview_identifier":"abc123"}

Compatibility decision: this draft preserves the existing stderr channel. During the full command lifecycle, the existing event context wraps that JSON string in an info diagnostic's message; stdout stays empty. Moving the final result to stdout needs a separate compatibility decision. Tests capture both streams and cover the current behavior explicitly.

Refresh the manifest, README, and generated docs. This PR reuses the output-capture helper from #8639.

How to manually test your changes?

pnpm shopify theme preview --store YOUR_STORE --theme YOUR_THEME --overrides overrides.json
pnpm shopify theme preview --store YOUR_STORE --theme YOUR_THEME --overrides overrides.json --preview-id YOUR_PREVIEW --open
pnpm shopify theme preview --store YOUR_STORE --theme YOUR_THEME --overrides overrides.json --json
pnpm shopify theme preview --help
pnpm shopify theme preview --json-schema

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • A single changeset for all theme migrations is added in the last PR, #8643.

@gonzaloriestra
gonzaloriestra added this pull request to stack #8646 September 24, 2026 09:23
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Sep 24, 2026
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-preview branch from ebf024f to fda3575 Compare September 24, 2026 10:04
@gonzaloriestra
gonzaloriestra removed this pull request from stack #8646 September 24, 2026 10:04
@gonzaloriestra
gonzaloriestra changed the base branch from gonzalo/json-theme-open to gonzalo/json-theme-share September 24, 2026 10:05
@gonzaloriestra
gonzaloriestra added this pull request to stack #8655 September 24, 2026 10:05
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-preview branch from fda3575 to f82379b Compare September 24, 2026 10:13
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-preview branch from f82379b to f8f160d Compare September 24, 2026 10:25
@github-actions github-actions Bot added no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. and removed Area: @shopify/cli @shopify/cli package issues labels Sep 24, 2026
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-preview branch from f8f160d to 781de0e Compare September 24, 2026 11:56
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-preview branch from 781de0e to a523b13 Compare September 24, 2026 13:46
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-preview branch from a523b13 to 571cd4e Compare September 24, 2026 14:21
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-preview branch from 571cd4e to 814fcb9 Compare September 24, 2026 14:36

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. shopify.dev preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant