Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 650
Max Komarychev Avatar asked Mar 02 '18 07:03

Max Komarychev


People also ask

How do I install lerna packages?

lerna create is a command to add a new package to be managed in Monorepo. To install an npm package, we can use the yarn workspace command in the root directory or the yarn add package-name command in the package directory where you'd like to install the package. Yarn updates package. json for the package and yarn.

Does lerna work with NPM?

Lerna is a popular and widely used tool written in JavaScript for setting and managing multi-package repositories for Node. js projects with npm and Git.

Is it possible to host Python packages in private Git monorepo?

2 We have a private git monorepo which hosts a number of Python packages. Poetry was the dependency management tool initially chosen for the project. Anyway, due to this Poetry issue, it would not be accepted solution that involves creating new setup.pyfiles.

Where does Lerna point its packages to?

By default, lerna points its packages to the packages folder. We’ll not be using the default lerna’ packages/ folder since Angular uses the projects directory for applications and libraries, therefore, we need to tell lerna about that. Open the lerna.json file and update it as follows:

How do I manage monorepos?

Monorepos can be challenging to manage because sequential builds and publishing individual packages take a long time. Lerna provides features such as package bootstrapping, parallelized builds, and artifactory publication, which can aid you when managing monorepos.


1 Answers

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.

like image 120
jjbskir Avatar answered Sep 21 '22 13:09

jjbskir