Do you have a zoo of packages? Living the pre-release-testing-maintenance hell? Move everything to a single repository using lernaJS and have more time to things that matter.
correct version & branches Bug in package C is well documented, but complex. Feature in package B should be just a small change. lerna - monorepo | @arndissler 7
correct version & branches Bug in package C is well documented, but complex. Feature in package B should be just a small change. easy doin' lerna - monorepo | @arndissler 8
controlling npm workflows. If you’re working on multiple similar repos, it allows you to define tasks and dependencies in a single shared source of truth. } lerna - monorepo | @arndissler 27
in package-c: ! lerna run generate --scope=package-c -- --interfaces Example for running code generation script for generating interfaces. --scope is a global parameter that accept a globbing pattern for package names lerna - monorepo | @arndissler 37
what packages are affected: ! lerna updated lerna info version 2.10.2 lerna info Checking for updated packages... lerna info Comparing with v1.0.1. lerna info Checking for prereleased packages... lerna info result - package-c lerna - monorepo | @arndissler 40
! lerna bootstrap • symlinks all internal packages within the monorepo • installs external dependencies • run prepublish and prepare on the packages lerna - monorepo | @arndissler 42
for us • increment version key in lerna.json (if needed) • update the package.json for each package • create git commit & tag with the new version • publish everything on npm lerna - monorepo | @arndissler 45
! lerna publish --skip-npm --skip-git --cd-version minor lerna info version 2.10.2 lerna info current version 1.0.1 lerna info Checking for updated packages... lerna info Comparing with v1.0.1. lerna info Checking for prereleased packages... Changes: - package-c: 1.0.1 => 1.1.0 lerna - monorepo | @arndissler 47
by conventional commits lerna publish --conventional-commits • for a fix, it's like a semver patch version bump • for feature, it's like a semver minor version bump • if it's breaking change, it's like a semver major version bump lerna - monorepo | @arndissler 48
! lerna publish --canary • basically the same as publish • except the version number is bumped to the next minor version, a meta suffix and the current commit hash, e.g. 1.7.2-alpha.ba751a0e lerna - monorepo | @arndissler 49
a package lerna import ../path/to/repo be warned • it takes time & will consume massive memory • maybe it won't work (at least for long running projects) lerna - monorepo | @arndissler 52
the team/teams, they know about their edge cases • take their concerns seriously • involve them in the process • keep your changes transparent • don't overrule team decisions lerna - monorepo | @arndissler 57
the downtime in product/package teams • setup your CI environment, check permissions • make test runs • plan a rollback strategy • spot the elephant in the room • automate as much as possible lerna - monorepo | @arndissler 58
saved and pushed changes • kickoff the migration script • set all migrated repos to 'read only' • push the monorepo • start the CI pipelines • manual test, if needed lerna - monorepo | @arndissler 60
sure, if the repo is accessible • create a branch, change & push something • inform the teams about the success • say THANK YOU lerna - monorepo | @arndissler 61
• number of total stored bytes • number of commits • number of tracked files • number of branches • number of tags • number of tests lerna - monorepo | @arndissler 63
slow down • switching branches may slow down • tracking changed files may slow down • build times may increase • CI may need more resources • it's more likely that you need low-level git commands • your editor may not work anymore lerna - monorepo | @arndissler 64
& remove branches when they are merged • avoid large files • document everything, even worse decisions • write a bullet proof workflow documentation • consider split the repo (again) into separate, logical units • ask yourself and the teams, if you're going in the right direction lerna - monorepo | @arndissler 65