Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Monorepo: Shared managed dependencies

Writer Sebastian Wright

I have an issue related to a monorepo (using turborepo) and NPM. The issue is concerning dependency management and being able to manange certain dependencies that's shared with multiple apps and packages and my repo.

I've ie. this stucture

apps/ project1/ package.json project2/ package.json
packages/ package.json package.json
package.json

This structure is used because we want to keep all server related and data fetching in the apps, and from there import the specific page component from the corresponding .react folder.

In all these package.json we have the following dependencies

react
react-dom
sass
@types/node
@types/react
@types/react-dom

Instead of having to version-check each and single package.json file to ensure versions are up to date, we would like (if possible) to have a single file somewhere in the monorepo to control this.

We know this is doable inside the root package.json file, but we do not want to clutter that one up, but would rather have something like

external/ react/ storybook/ graphql/

where we can make specific folders containing certain dependencies we from there can update and select the overall version from. And then add them as dependencies or somehow to the package.json files in the project.

Hopefully someone knows a good solution for this.

Kind regards, Mads

Related questions 2866 What's the difference between dependencies, devDependencies, and peerDependencies in NPM package.json file? 11 How to use Turborepo for an existing react app created with Create React App in order to make it a monorepo? 7 "Error: Invalid hook call." when importing React component from shared component library in monorepo (turborepo & npm workspaces) Related questions 2866 What's the difference between dependencies, devDependencies, and peerDependencies in NPM package.json file? 11 How to use Turborepo for an existing react app created with Create React App in order to make it a monorepo? 7 "Error: Invalid hook call." when importing React component from shared component library in monorepo (turborepo & npm workspaces) 10 Enforcing shared dependencies in a monorepo 0 is there any way to install dependency from multiple package.json files for monorepo projects in npm 5 How to publish yarn workspace with root package.json dependencies? 6 Styling issues in monorepo with Turborepo, SvelteKit and Tailwind 424 Why does npm install say I have unmet dependencies? 1 React Native monorepo: TS2786: 'View' cannot be used as a JSX component Load 6 more related questions Show fewer related questions Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.