-
Notifications
You must be signed in to change notification settings - Fork 110
Pr 137 alternative #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Pr 137 alternative #149
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
There was a problem hiding this 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" |
Copilot
AI
Oct 2, 2025
There was a problem hiding this comment.
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.
| "schema:extract": "cd ../studio && npm run extract-types" | |
| "schema:extract": "cd \"${STUDIO_PATH:-../studio}\" && npm run extract-types" |
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