Skip to content

feat: auto-update prismicio.ts routes for page types during sync#46

Draft
angeloashmore wants to merge 2 commits intomainfrom
aa/sync-page-type-routes
Draft

feat: auto-update prismicio.ts routes for page types during sync#46
angeloashmore wants to merge 2 commits intomainfrom
aa/sync-page-type-routes

Conversation

@angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Mar 11, 2026

Resolves:

Description

The prismic sync command syncs custom types from Prismic to local files but didn't update the routes array in prismicio.ts for page types — even though the template already had a comment saying it would. This ports the route upsert and removal behavior from devtools (adapter-next) to the CLI using the same recast AST approach.

  • Upsert: After syncCustomTypes() completes, the framework adapter reads prismicio.ts, finds the routes array, and appends route objects for any page types not already present. Only appends; never modifies existing routes.
  • Removal: When a page type is deleted remotely and synced locally, its route entries are removed from the routes array. Leading comments are preserved by transferring them to the next route element.

Next.js-specific; base class methods are no-ops.

Checklist

  • A comprehensive Linear ticket, providing sufficient context and details to facilitate the review of the PR, is linked to the PR.
  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

angeloashmore and others added 2 commits March 10, 2026 16:57
After syncing custom types, appends missing page type routes to the
`routes` array in `prismicio.ts` using recast AST manipulation. Only
appends new entries; never modifies or removes existing ones.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…uring sync

Ports the route-removal behavior from adapter-next. When a page type is
deleted remotely and synced, its route entry is removed from the routes
array in prismicio.ts. Leading comments are preserved by transferring
them to the next route element.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant