Skip to content

feat: generate page files for page types#63

Merged
angeloashmore merged 5 commits intomainfrom
aa/generate-page-files-for-page-types
Mar 24, 2026
Merged

feat: generate page files for page types#63
angeloashmore merged 5 commits intomainfrom
aa/generate-page-files-for-page-types

Conversation

@angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Mar 24, 2026

Resolves: #61

Description

Automatically generate framework-appropriate page files when page types are synced. Each adapter (Next.js, Nuxt, SvelteKit) creates minimal page templates matching the route derived in prismic.config.json, so developers get working pages out of the box after syncing their content models.

Note: E2E tests only cover Next.js App Router without JavaScript for now. Expanding the test suite will come later.

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


Note

Medium Risk
Medium risk: adds new file-generation behavior across Next.js/Nuxt/SvelteKit adapters based on routing rules, which could create files in unexpected paths or generate incorrect templates for some project setups. Changes are additive and avoid overwriting existing files, limiting impact.

Overview
Automatically scaffolds framework page files when a Prismic Custom Type with format: "page" is created/synced, using the route derived from prismic.config.json (via exported buildRoutePath).

Adds new page templates for Next.js (App Router + Pages Router, JS/TS, repeatable vs single), Nuxt (repeatable vs single, JS/TS), and SvelteKit (generates both +page.svelte and +page.server.*). Generation is non-destructive: adapters skip writing if the target page file already exists.

Extends E2E test utilities with stubNodeModule and a toHaveFile matcher, and adds sync tests (currently covering Next.js App Router) to verify page files are created for page types, not created for non-page types, and not overwritten.

Written by Cursor Bugbot for commit 99ace4e. This will update automatically on new commits. Configure here.

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 angeloashmore marked this pull request as ready for review March 24, 2026 04:56
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@angeloashmore angeloashmore marked this pull request as draft March 24, 2026 07:18
Base automatically changed from aa/config-routes-for-page-types to main March 24, 2026 19:26
angeloashmore and others added 3 commits March 24, 2026 09:30
Each framework adapter now creates page files when a page type is synced.
The generated route path matches the route added to prismic.config.json.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add App Router vs Pages Router distinction for Next.js page templates,
generating getStaticProps/getStaticPaths for Pages Router projects.
Fix Nuxt templates to conditionally cast uid based on TypeScript usage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@angeloashmore angeloashmore force-pushed the aa/generate-page-files-for-page-types branch from 99ace4e to 6740a64 Compare March 24, 2026 19:31
angeloashmore and others added 2 commits March 24, 2026 09:33
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Individual test timeouts are unnecessary with the global timeout in
vitest config. Adding retry: 1 improves CI reliability for flaky
integration tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@angeloashmore angeloashmore marked this pull request as ready for review March 24, 2026 19:44
@angeloashmore angeloashmore merged commit 1b40899 into main Mar 24, 2026
11 checks passed
@angeloashmore angeloashmore deleted the aa/generate-page-files-for-page-types branch March 24, 2026 19:51
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.

Generate page files when page types are created or deleted

1 participant