Run lerna bootstrap on CI

Viewed 1979

I'm using lerna to manage a monorepo. I have this kind of structure:

packages -- app -- dependency1 -- dependency2 app uses dependency1 and dependency2, dependency1 uses also dependency2. The main thing here we want to deploy is app, let's say it's a webapp.

So, if I want to work locally, I would run lerna bootstrap. This would install dependencies in each of the packages and link them so I can see the changes while developing.

Now, I commit and push to my repo (gitlab, but it would be the same for any other one). Maybe I'm wrong, but what seems logical to me is:

  • git checkout branch
  • git remote set-url origin so lerna can push to the repo the package.json changes
  • run lerna publish to see which packages changed and publish them to the npm repo and commit to git repo the package.json changes.
  • navigate to the app folder and install packages (this would also install the published ones in previous step)
  • run the build and deployment scripts

I would say we wouldn't need to run lerna bootstrap, this is would install all dependencies in each package and link them, right? I just need to deploy the webapp. Also, if I just changed one package, I don't have to install dependencies in all of the packages.

If I have a bunch of packages more, CI takes ages, with out needing, in my view...

I see a few examples online where lerna bootstrap is always part of the CI. Is this the right approach?

0 Answers
Related