Skip to content

Add typed JSON output to Hydrogen route generation - #4100

Draft
gonzaloriestra wants to merge 1 commit into
gonzalo/hydrogen-json-envfrom
gonzalo/hydrogen-json-routes
Draft

gonzaloriestra wants to merge 1 commit into
gonzalo/hydrogen-json-envfrom
gonzalo/hydrogen-json-routes

Conversation

@gonzaloriestra

@gonzaloriestra gonzaloriestra commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Route generation needs a result that distinguishes created, replaced and skipped files.

WHAT is this pull request doing?

Add a shared route-generation schema and --json support to generate route and generate routes. Return route groups, language and file operations, and forward all-route options directly so false boolean options stay false. Remove the hidden g alias from the shared exception list without adding a JSON contract; a local lint exemption is needed because the current plugin does not skip hidden commands.

Without --json, the existing terminal presentation remains. Example JSON result:

shopify hydrogen generate route cart --json
{"isTypescript":true,"routeGroups":{"cart":["cart.tsx"]},"routes":[{"sourceRoute":"cart.tsx","destinationRoute":"app/routes/cart.tsx","operation":"created"}]}

HOW to test your changes?

pnpm --filter @shopify/cli-hydrogen test src/commands/hydrogen/generate/route.test.ts

Build and typecheck were checked at each layer. The full stack passed 498 tests (6 skipped), lint, and schema discovery for all 22 finite commands. Command-line smoke checks covered a successful unlink result, fatal project errors, watch-mode rejection and schema environment flags. Live authenticated Shopify operations have not been exercised.

Stack

Draft 6 of 9. Previous: #4099. Next: #4101. One changeset is included in #4103.

  1. Prepare Hydrogen commands for typed JSON output
  2. Add typed JSON output to Hydrogen build tooling
  3. Add typed JSON output to hydrogen customer-account-push
  4. Add typed JSON output to hydrogen deploy
  5. Add typed JSON output to Hydrogen environment commands
  6. Add typed JSON output to Hydrogen route generation
  7. Add typed JSON output to Hydrogen project and account commands
  8. Add typed JSON output to Hydrogen setup commands
  9. Add typed JSON output to Hydrogen maintenance commands

@shopify

shopify Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Oxygen deployed a preview of your gonzalo/hydrogen-json-routes branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment September 29, 2026 2:56 PM

Learn more about Hydrogen's GitHub integration.

@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-json-routes branch from f69ff8a to 58b2f56 Compare September 28, 2026 15:38
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-json-routes branch from 58b2f56 to 783de51 Compare September 29, 2026 12:25
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-json-routes branch from 783de51 to 26229df Compare September 29, 2026 14:54

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants