Skip to content

Conversation

@kenjonespizza
Copy link
Collaborator

@kenjonespizza kenjonespizza commented Aug 22, 2025

Description

Alternative to #137 - This PR adds the pre-dev script within the Frontend, to run Sanity schema extraction and type generation. This allows for a better developer experience. When updates are made to the Sanity schema, you just need to re-run your dev script and it regenerates types

@vercel
Copy link

vercel bot commented Aug 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
template-nextjs-clean Ready Ready Preview Comment Aug 22, 2025 9:42pm

Copy link

@wutangpaul wutangpaul left a comment

Choose a reason for hiding this comment

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

Looks good

@kenjonespizza kenjonespizza requested a review from Copilot October 2, 2025 16:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the developer experience by automating Sanity schema extraction and type generation during development. When developers run the dev script, it will automatically extract the latest schema types from the Sanity studio and regenerate TypeScript types, ensuring the frontend always has up-to-date type definitions.

Key changes:

  • Added automatic schema extraction to the pre-dev script
  • Updated generated TypeScript types with simplified array and union type formatting

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
frontend/package.json Added schema extraction step to predev script to automate type generation workflow
frontend/sanity.types.ts Updated with regenerated types featuring simplified formatting for arrays and union types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

"lint": "next lint",
"typegen": "sanity typegen generate"
"typegen": "sanity typegen generate",
"schema:extract": "cd ../studio && npm run extract-types"
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

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

The script relies on a relative path assumption that may break if the project structure changes. Consider using a more robust approach like defining the studio path as an environment variable or using a package manager workspace feature.

Suggested change
"schema:extract": "cd ../studio && npm run extract-types"
"schema:extract": "cd \"${STUDIO_PATH:-../studio}\" && npm run extract-types"

Copilot uses AI. Check for mistakes.
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