Monorepo: Shared managed dependencies

386 Views Asked by At

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/
  project1.react/
    package.json
  project2.react/
    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

0

There are 0 best solutions below