Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

semantic-release-npm-workspaces-monorepo

ido-pluto383MIT3.1.0TypeScript support: included

Help you use semantic-release with npm workspaces

npm-workspaces, monorepo, semantic-release, workspaces, npm, release, publish, yarn-workspaces, bun-workspaces, automation

readme

Semantic Release with NPM Workspaces

Simplify the process of releasing a monorepo with npm workspaces.

Work with:

  • Npm workspaces
  • Bun workspaces
  • Yarn workspaces
  • Pnpm workspaces

Only publish packages that changed.

Installation

npm install --save-dev semantic-release-npm-workspaces-monorepo

Usage

Add this to your package.json of your workspace root:

{
  "workspaces": [
    "packages/*"
  ],
  "workspaceRelease": {
    "npmRelease": true,
    "release": {
      // semantic-release configuration
    }
  },
  "scripts": {
    "release": "semantic-release-npm-workspaces-monorepo"
  }
}

The default configuration of this package is:

settings = {
    preReleaseVersionTemplate: false, // example: '${version}', override the template in the package.json for pre-release versions
    registry: 'https://registry.npmjs.org',
    tagFormat: '${name}@${version}',
    release: {
        extends: 'semantic-release-commit-filter',
        ci: true,
        branches: [
            "main", 
            "master",
            {
                name: "beta",
                prerelease: true
            }
        ],
        plugins: [...]
    },
    semanticReleaseBin: 'semantic-release',
    semanticReleaseBinArgs: [],

    // semantic-release pre-configured plugins
    changelogCommit: true, // create & update CHANGELOG.md
    npmRelease: false, // use NPM_TOKEN to publish packages
    extendsReleaseRules: [], // extend defaults release rules
    extendsNoteGeneratorTypes: [], // extend defaults note generator types
    extendsDefaultPlugins: [], // add custom plugins additonally to the pre-configured plugins
}

How it works

  • It will update all the workspace (local dependencies) to the latest version from the registry before running semantic release, respecting configured release channels. When working in a prerelease branch (e.g., beta), it will fetch the latest prerelease version from that channel if available.
  • It will do it by the dependency graph, meaning that it will update the packages in the correct order.
  • Use semantic-release-commit-filter to filter the commits to only publish packages that changed.

Pre-configured plugins

If you do not specify the plugins property in the release object, it will use the following plugins:

  • @semantic-release/commit-analyzer
  • @semantic-release/release-notes-generator
  • @semantic-release/changelog (if changelogCommit is set true)
  • @semantic-release/npm (if npmRelease is set true)
  • @semantic-release/github (if changelogCommit is set true)
  • @semantic-release/git (if changelogCommit is set true)

The plugins configure with recommended settings. Checkout settings.ts for more information.

Per Package Configuration

If you need the flexibility to configure some packages separately, you can use the perPackageConfig object within the workspaceRelease object.

{
  "workspaces": [
    "packages/*"
  ],
  "workspaceRelease": {
    "npmRelease": true,

    "perPackageConfig": {
      "packages/internal/**": {
        // override specific configuration
        "npmRelease": false
      }
    }
  },
  "scripts": {
    "release": "semantic-release-npm-workspaces-monorepo"
  }
}

Examples

Some examples of how to use this package:

How to "Breaking Changes"?

The release of breaking changes can be confusing sometimes.

You need to write a commit message with BREAKING CHANGE in the footer of the commit to trigger a major release.

(You cannot use BREAKING CHANGE as the type)

git commit -m "feat: add new feature
BREAKING CHANGE: this is a breaking change"

To ease the process, you can use the breaking type in the commit message to trigger a major release in one line.

git commit -m "breaking: this is a breaking change"

changelog

3.1.0 (2025-05-22)

Features

  • workspaces: respect package.json workspaces pattern (#11) (d76b2f1)

3.1.0-beta.3 (2025-03-14)

Features

  • config: support per package config (12cc4d5)

3.1.0-beta.2 (2025-03-12)

Bug Fixes

  • scan: skip node_modules (3685bb7)

3.1.0-beta.1 (2025-03-12)

Bug Fixes

  • settings: read workspaces (466139e)

Features

  • workspaces: respect package.json workspaces pattern (d0354cf)

3.0.1 (2025-03-06)

Bug Fixes

  • avoid throwing error when package.json does not exist (d9c7619)
  • Avoid throwing error when package.json does not exist (0485d4f)
  • Remove redundant fs.access (92be7bd)

3.0.0 (2025-03-05)

Bug Fixes

  • Fixed issue where incorrect branch is returned in gitlab CI (10b5fad)
  • issue where incorrect branch is returned in gitlab CI (daaa4cf)
  • Linting (d3e5c8a)
  • merge fixes (47b071c)

Features

  • Beta deployments added (eb2c75f)
  • respect release channels when resolving dependencies (5190ed2)
  • support prerelease (d2acfd7)

BREAKING CHANGES

  • search with dist-tags

3.0.0-beta.2 (2025-03-05)

Bug Fixes

  • Fixed issue where incorrect branch is returned in gitlab CI (10b5fad)
  • issue where incorrect branch is returned in gitlab CI (daaa4cf)
  • Linting (d3e5c8a)

3.0.0-beta.1 (2025-03-05)

Bug Fixes

Features

  • Beta deployments added (eb2c75f)
  • respect release channels when resolving dependencies (5190ed2)
  • support prerelease (d2acfd7)

BREAKING CHANGES

  • search with dist-tags

2.2.3 (2024-07-07)

Bug Fixes

  • cache: cli receive arguments (6070db0)

2.2.2 (2024-07-06)

Bug Fixes

  • packages: publish order (0d74519)

2.2.1 (2024-07-06)

Bug Fixes

  • npm: skip checking npm for version if not a release package (6bab1fc)

2.2.0 (2024-07-06)

Features

  • cache: cache releases versions (02f6e22)

2.1.1 (2024-07-01)

Bug Fixes

2.1.0 (2023-12-18)

Features

  • extend default configurations (481a04a)

2.0.2 (2023-11-23)

Bug Fixes

  • sleep before next publish (b859e81)

2.0.1 (2023-11-23)

Bug Fixes

2.0.0 (2023-11-23)

1.1.5 (2023-11-23)

Bug Fixes

1.1.4 (2023-11-21)

Bug Fixes

1.1.3 (2023-11-21)

Bug Fixes

1.1.2 (2023-11-21)

Bug Fixes

  • update-packages: fetch retry (6b1aaec)

1.1.1 (2023-11-21)

Bug Fixes

  • settings: initialization access (c6e721d)

1.1.0 (2023-11-21)

Features

  • settings: work by default (36d7df6)

1.0.2 (2023-11-20)

Bug Fixes

  • package: update local packages (3da4991)

1.0.1 (2023-11-20)

1.0.0 (2023-11-20)

Features