-
Notifications
You must be signed in to change notification settings - Fork 174
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
chore (client): add Zod and Prisma as (optional) peer dependencies #1187
Conversation
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.
We can pin Prisma, but not Zod. There are valid reasons to use a different version of Zod, one being that at the moment the pinned version of Zod does not handle UUIDv7. So it's up to the user to decide if they want to trade type errors for UUIDv7 (and other UUID format) support.
@samwillis I think most projects will want to use the version of Zod required by Electric, and only a small number of projects will want to use another version of Zod, e.g. for UUIDv7 support. Therefore, i like pinning Zod as this informs developpers automatically if they have a wrong version of Zod in their project. For the occasional case where one really needs another version of Zod, they can use |
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.
@kevin-dp agreed, lest merge this and revisit in future.
Looks good and agree with adding them as peerDeps - although I'm pretty sure Prisma also needs to be exactly 4.8.1 because I remember trying to update it to the latest v4 version when I looked at the generation and there were already issues with minor version updates. I've also opened a PR to add some other missing optional flags for existing peer deps which are causing issues in projects: |
Adds peer dependency optional flags that are missing (also reordered to match peer dep order). Relevant PR: #1187
6c6e911
to
3d98d86
Compare
Every Electric app needs Zod in order to use the generated client. However, in recent versions of Zod something changed that breaks the types in the generated client (cf. #700). Therefore, Electric apps should always use Zod version 3.21.1. Added this as a peer dependency such that npm complains if the app installs a different version. Similarly, added an optional peer dependency for Prisma v4 such that it complains if the app installs another version of Prisma.