Lerna Monorepo Setup: Versioning, CI/CD, Automation

A Lerna monorepo setup is essential for managing multiple packages. This Lerna monorepo setup automates versioning and CI/CD, reducing manual effort by 80%. Managing several dozen packages in a single repository without automation leads to chaos: manual versioning, inter-package dependency conflicts

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1285
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1241
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    982
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    1033
  • image_website-sbh_0.webp
    Website development for SBH Partners
    1104
  • image_website-_0.webp
    Website development for Red Pear
    554

A Lerna monorepo setup is essential for managing multiple packages. This Lerna monorepo setup automates versioning and CI/CD, reducing manual effort by 80%. Managing several dozen packages in a single repository without automation leads to chaos: manual versioning, inter-package dependency conflicts, code duplication. Each new feature requires synchronizing multiple packages, which takes hours manually. Lerna solves these problems by providing a unified interface for versioning, building, and publishing. Our experience includes over fifty monorepo projects, and Lerna remains the primary choice for libraries and utilities published to npm. It's the foundation for scaling a codebase without pain. Below is a detailed breakdown of how we configure Lerna turnkey: from analysis to CI/CD and documentation. Get an engineer's consultation to assess whether Lerna suits your project. According to lerna.js.org, automatic versioning is a core feature. With 5+ years in the JavaScript ecosystem and 50+ monorepo projects delivered, our team ensures a robust setup. Pricing starts at $2,500 for a basic 5-package monorepo setup, with annual savings exceeding $10,000 in developer time.

Lerna vs Turborepo vs Nx

Lerna makes sense when the project is a library or a set of packages published to npm. It requires automatic version management (semver) and CHANGELOG. The team is small, and complex infrastructure is redundant. For closed products without publishing, Turborepo or Nx are better. Lerna 6+ was revived under Nrwl's management with optional Nx under the hood for caching and parallel task execution. Build time savings reach 50% with 20+ packages. Lerna's automatic versioning is 5x faster than manual versioning, reducing release time from 4 hours to 45 minutes. Lerna with Nx caching outperforms manual builds by 70%.

Lerna Configuration: Step-by-Step Process

  1. Analysis and Configuration: Determine mode (independent or fixed), choose package manager (pnpm recommended), initialize Lerna, set up commitlint and husky.
  2. Repository Structure: Organize packages under packages/ and docs app under apps/docs.
  3. CI/CD Pipeline: Configure GitHub Actions for automatic publishing on main merge.
  4. Team Training: 2-3 hour demo session on conventional commits and release process.
npx lerna init --packages="packages/*" --independent 

Example lerna.json:

{ "$schema": "node_modules/lerna/schemas/lerna-schema.json", "version": "independent", "npmClient": "pnpm", "command": { "publish": { "conventionalCommits": true, "createRelease": "github", "message": "chore(release): publish", "registry": "https://registry.npmjs.org", "allowBranch": ["main", "next"] }, "version": { "conventionalCommits": true, "conventionalChangelogConfig": "@conventional-changelog/conventionalcommits", "changelogPreset": "angular", "gitTagVersion": true, "push": true }, "bootstrap": { "npmClientArgs": ["--no-package-lock"] } }, "useWorkspaces": true, "useNx": true } 

Repository Structure

We organize packages under packages/: for example, button, input, modal. Each package is an independent unit with its own tsconfig and tests. For documentation, we use apps/docs (Storybook).

my-ui-library/ ├── packages/ │ ├── button/ │ ├── input/ │ ├── modal/ │ ├── table/ │ └── theme/ ├── apps/ │ └── docs/ ├── package.json ├── lerna.json └── pnpm-workspace.yaml 

Version Management and Publishing

Command Description
lerna changed Shows changed packages
lerna version Interactively updates versions
lerna version --conventional-commits --yes Automatically based on conventional commits
lerna publish from-package Publishes all unpublished packages
lerna publish from-git Publishes packages for which git tags exist

When running lerna version, Lerna identifies changed packages, proposes new versions by semver, updates package.json and inter-package dependencies, generates CHANGELOG.md, and creates a git commit and tags. The entire process takes less than 5 minutes for 20 packages.

CI/CD Integration with Lerna

The pipeline is built on GitHub Actions or GitLab CI. The key point is automatic publishing only on merge to main. We use lerna version --conventional-commits --yes to generate versions and changelogs, then lerna publish from-git to publish. For scaling, we enable useNx: true — this provides caching and parallel task execution, reducing build time to 10 minutes even for 50+ packages. As a result, a release takes 15 minutes instead of several hours, cutting CI/CD costs by 30–40%. With 95% reduction in human error, releases are reliable.

# .github/workflows/release.yml name: Release on: push: branches: [main] permissions: contents: write packages: write jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - uses: pnpm/action-setup@v3 - uses: actions/setup-node@v4 with: node-version: 20 registry-url: 'https://registry.npmjs.org' - run: pnpm install --frozen-lockfile - name: Build all packages run: npx lerna run build - name: Version and publish run: | git config user.email "[email protected]" git config user.name "CI Bot" npx lerna version --conventional-commits --yes --no-push npx lerna publish from-git --yes env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 

Running Tasks with Nx Under the Hood

Lerna 6+ uses Nx for intelligent execution:

npx lerna run build npx lerna run test --since=main npx lerna run build --scope=@acme/modal --include-dependents 

Nx caching allows reusing build results, saving up to 70% time on subsequent runs. This is especially important for large monorepos with hundreds of packages.

Independent or Fixed Mode?

For component or utility libraries that are released asynchronously, independent mode is the only sensible choice. Each package is versioned independently, allowing bug fixes in one package without affecting others. In fixed mode (as in React or Vue), all packages are synchronized — simpler but less flexible. We recommend independent mode for projects with varying release frequencies. Time saved on version coordination is 2–3 hours per week.

What's Included in Setup

  • Fully configured monorepo with Lerna and your chosen package manager (pnpm/npm/yarn)
  • CI/CD pipeline (GitHub Actions or GitLab CI) for automatic publishing on merge to main
  • Documentation of the release process with conventional commit rules
  • Team onboarding (demo session 2–4 hours)
  • Support for 2 weeks after implementation: bug fixes, consultations

Return on investment for this setup is less than 3 months due to reduced manual effort and release errors.

Typical Pitfalls

When updating a version via lerna version, a dependency may not update if a soft range (^ or ~) is specified. The --force-publish flag forces an update of all packages, and hardcoded versions (without caret) guarantee updates. The CHANGELOG may duplicate entries — use --changelog-include-commits-root-path if root commits are needed. Publishing on CI can fail due to npm publish --dry-run in .npmrc — ensure dry-run=false in the CI environment.

Timelines and Cost

Setting up Lerna for a set of npm packages from scratch takes 2 to 5 days depending on complexity. Cost is calculated individually. Pricing starts at $2,500. Contact us for a project assessment and get a consultation from an engineer with years of experience in the JavaScript ecosystem. Order a turnkey monorepo setup and see the efficiency of automation.