Skip to content
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

Better support for monorepos via the repository field #50

Open
runspired opened this issue May 18, 2022 · 0 comments
Open

Better support for monorepos via the repository field #50

runspired opened this issue May 18, 2022 · 0 comments

Comments

@runspired
Copy link

runspired commented May 18, 2022

Currently, monorepos rely on an extends property in each sub-project. This was done for a few reasons:

  • to avoid needing to crawl up the file tree to an undetermined point looking for the closest package.json with a volta field
  • to allow sub-projects to override the main configuration
  • to ensure volta wasn't tied to something like "git root" for projects that don't use git.

However, I think we can do better!

The spec for package.json has added support for monorepo projects that publish multiple packages to the repository field. This field may now be an object with the keys type url and directory. When present, directory is a relative path within the repository pointing to the directory the current package.json is within. Ergo, it is also tells us precisely where to look for the root package.json file.

I'm proposing that we utilize this field by default, when present, unless another volta configuration is present, we find the root package.json and examine it for a volta configuration.

This change would thereby also minimize a risk that the current approach introduces for projects using workspaces. In such projects, mixing yarn/npm/pnpm versions when using workspaces can lead to some serious install problems when dependency versions are shared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant