Managing Modern JS Monorepos

👋 @jesstelford

Single Package Repos

aka Many-Repos

Tools for Many-Repos

  • yarn
  • np
  • Most other things on npm

Many-repo flow

Code -> Commit -> PR -> Publish

âš  Problems with Many-Repos

  • Managing lots of packages is tricky
  • Large effort to publish
  • Version syncing is tricky

Monorepos are the solution! 🎉

Many vs Mono

Many

✅ git history
✅ no merge conflicts
✅ easier onboarding / contributing
✅ less tooling

Many

🚫 duplicate node_modules (yarn PNP might help)
🚫 managing publishing for related deps
🚫 disconnected git histories
🚫 multiple PRs

Mono

✅ Single codebase
✅ single PRs for many packages
✅ single integration test point
✅ Single node_modules

Mono

🚫 huge repos
🚫 mixed git history
🚫 more tooling
🚫 difficult onboarding

Many in a Mono

Code -> Commit -> PR -> Publish

becomes

cd [package-dir] -> Code -> Commit -> PR -> Publish

Many in a Mono

✅ less tooling
✅ Single codebase
✅ single PRs for many packages
✅ single integration test point
✅ single node_modules

Many in a Mono

🚫 managing publishing for related deps
🚫 huge repos
🚫 mixed git history
🚫 difficult onboarding

Tools for Monorepos

  • lerna
  • yarn workspaces
  • bolt

Bolt

Bolt

✅ Single codebase
✅ single PRs for many packages
✅ single integration test point
✅ single node_modules

Bolt

🚫 managing publishing for related deps
🚫 huge repos
🚫 mixed git history
🚫 more tooling

Publishing from a Bolt monorepo

@atlaskit/build-releases

  1. yarn build-releases changeset
  2. yarn build-releases version
  3. yarn build-releases publish

Bolt + @atlaskit/build-releases

✅ Single codebase
✅ single PRs for many packages
✅ single integration test point
✅ single node_modules
✅ Easy publish
🚫 huge repos
🚫 more tooling

Monorepo tools