@lchemist/semantic-release-monorepo
Apply semantic-release
's automatic publishing to monorepo packages. Forked from pmowrer/semantic-release-monorepo
.
Features
- Enable independent versioning on each monorepo package.
- Generate independent release note & git tag for each monorepo package.
- Allow a single GitHub repository to contain many
npm
packages.
Major Diff
This fork uses <PACKAGE_NAME>@<PACKAGE_VERSION>
as format of git tag and release note's version title (e.g. @abc/core@1.2.3
).
Install
npm install -D semantic-release @lchemist/semantic-release-monorepo
NOTE: semantic-release
and @lchemist/semantic-release-monorepo
must be accessible in each monorepo package. (Install both at root directory of monorepo if you use Lerna).
Usage
{
"branches": "main",
"extends": "@lchemist/semantic-release-monorepo"
}
With CLI:
semantic-release -e @lchemist/semantic-release-monorepo
How
This library modifies the context
object passed to semantic-release
plugins in the following way to make them compatible with a monorepo.
Instead of attributing all commits to a single package, commits are assigned to packages based on the files that a commit touched.
If a commit touched a file in or below a package's root, it will be considered for that package's next release. A single commit can belong to multiple packages and may trigger the release of multiple packages.
In order to avoid version collisions, generated git tags are namespaced using the given package's name: <PACKAGE_NAME>@<PACKAGE_VERSION>
.
Step | Description |
---|---|
analyzeCommits |
Filters context.commits to only include the given monorepo package's commits. |
generateNotes |
|