Our projects start with 2–3 repositories and quickly grow to 5–10 or more. There are several developers working on modules, front-end or backend services and you may not be responsible or aware of what’s going on in the other repositories, but you still need everything up-to-date on your laptop to run and test the whole architecture.
We initially looked into “monorepo” tools like Lerna, but we found them to be overly complex and storing everything in “packages” didn’t feel right. The one problem we wanted to solve is keeping a few folders updated. The first thing we did was to create a “root level” repository, we either call that “hq” or the same name as the organisation/product we want to build. This repo we clone locally and add a .gitignore:
This ignores all contents in that repo except
we clone all related repositories for that project into the root folder.
The interesting part happens in bin/:
The script loops through every folder and first prints the name of the folder.
This is important to see when an error happens on git pull. Afterwards, we check
package-lock.json because this it the most common cause for a
--prune also removes all stale branches that you might have locally,
keeping things clean and tidy. And last, we run
npm install to update the
In the Makefile, just add those lines:
and you can run everything with
make update. The whole process can take a
minute or two, but it’s great to keep all repos of a project updated.
It happened a few times that we forgot to checkout the master branch after
committing a pull request and the repo would never be updated with the update
script, so here is a little addition to quickly check if all repos are using the
Again, this is most useful in the Makefile:
Enjoy this developer experience and let us know what you think!