pnpm / turbo monorepo - how to structure shared dependencies

I'm fairly new to monorepos, even more to turbo does anyone have advice on what's the least headache-prone way of structuring shared deps (e.g. one typescript version, one zod version) across a monorepo? one way ig would be to to create a package, e.g. packages/zod, then use that packages whenever you need zod the other way i found would be to use pnpm's catalog but im not sure which is better caching, maintainability-wise
4 Replies
Himanshu77D
Himanshu77D7mo ago
Have you checked out create-t3-turbo? They have a validators folder in tooling/ Edit: you meant version, then yeah catalog inside pnpm-workspace.yaml file Then whenever you do pnpm add zod in any app it'll reference catalog
Dave
Dave3mo ago
is there any easy way to update a version in the catalog? I could manually update the version in the catalog but then I need to recreate the pnpm-lock if might not be missing something. pnpm update is not working (even using pnpm version 10)
lassiter
lassiter3mo ago
Settings (pnpm-workspace.yaml) | pnpm
pnpm gets its configuration from the command line, environment variables, pnpm-workspace.yaml, and
lassiter
lassiter3mo ago
you can start with just your root package.json and expand from there as your dependencies get more complicated.

Did you find this page helpful?