Max Komarychev
Max Komarychev

Reputation: 2856

Install package from lerna-managed monorepo via git URL

I am using yarn for my project. My project has a dependency which happened to be a subpackage of larger monorepo maintained by lerna. The subpackage was updated but not published yet and I need that unpublished code. Is there any way to install lerna's subpackage via git url?

Thanks.

Upvotes: 24

Views: 3876

Answers (2)

Aleksi
Aleksi

Reputation: 5046

Try GitPkg: https://gitpkg.vercel.app/.

Using sub folders of a repo as yarn/npm dependencies made easy

Upvotes: 2

jjbskir
jjbskir

Reputation: 10723

If your questions is "How do I install a sub-package via git?" then that would be a duplicate of this question, which it sounds like you kind of can do, but it does not look fun. But npm on its own does not support installs of git subdirectories.

A better solution would be either to do a release of the package with a npm beta tag and target it directly in your package.json. Or to set up the lerna project locally and run npm link to use it directly.

Upvotes: 2

Related Questions