feat: auto-update prismicio.ts routes for page types during sync#46
Draft
angeloashmore wants to merge 2 commits intomainfrom
Draft
feat: auto-update prismicio.ts routes for page types during sync#46angeloashmore wants to merge 2 commits intomainfrom
angeloashmore wants to merge 2 commits intomainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves:
Description
The
prismic synccommand syncs custom types from Prismic to local files but didn't update theroutesarray inprismicio.tsfor 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 samerecastAST approach.syncCustomTypes()completes, the framework adapter readsprismicio.ts, finds theroutesarray, and appends route objects for any page types not already present. Only appends; never modifies existing routes.routesarray. Leading comments are preserved by transferring them to the next route element.Next.js-specific; base class methods are no-ops.
Checklist
Preview
How to QA 1
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩