{"id":13524433,"url":"https://github.com/pmowrer/semantic-release-monorepo","last_synced_at":"2025-04-04T06:10:11.001Z","repository":{"id":37493396,"uuid":"112014611","full_name":"pmowrer/semantic-release-monorepo","owner":"pmowrer","description":"Apply semantic-release's automatic publishing to a monorepo.","archived":false,"fork":false,"pushed_at":"2024-08-05T16:00:47.000Z","size":1531,"stargazers_count":538,"open_issues_count":26,"forks_count":81,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-28T05:13:51.032Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pmowrer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-25T15:38:00.000Z","updated_at":"2025-03-11T08:05:46.000Z","dependencies_parsed_at":"2024-01-23T16:29:46.902Z","dependency_job_id":"e6c28c42-d9bb-43be-803a-ebf8595adec7","html_url":"https://github.com/pmowrer/semantic-release-monorepo","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmowrer%2Fsemantic-release-monorepo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmowrer%2Fsemantic-release-monorepo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmowrer%2Fsemantic-release-monorepo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmowrer%2Fsemantic-release-monorepo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmowrer","download_url":"https://codeload.github.com/pmowrer/semantic-release-monorepo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128753,"owners_count":20888235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:10.048Z","updated_at":"2025-04-04T06:10:10.979Z","avatar_url":"https://github.com/pmowrer.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# semantic-release-monorepo\n\n![Tests workflow](https://github.com/pmowrer/semantic-release-monorepo/actions/workflows/tests.yml/badge.svg) [![npm](https://img.shields.io/npm/v/semantic-release-monorepo.svg)](https://www.npmjs.com/package/semantic-release-monorepo) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\nApply [`semantic-release`'s](https://github.com/semantic-release/semantic-release) automatic publishing to a monorepo.\n\n## Why\n\nThe default configuration of `semantic-release` assumes a one-to-one relationship between a GitHub repository and an `npm` package.\n\nThis library allows using `semantic-release` with a single GitHub repository containing many `npm` packages.\n\n## How\n\nInstead of attributing all commits to a single package, commits are assigned to packages based on the files that a commit touched.\n\nIf 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.\n\nIn order to avoid version collisions, generated git tags are namespaced using the given package's name: `\u003cpackage-name\u003e-\u003cversion\u003e`.\n\n## Install\n\nBoth `semantic-release` and `semantic-release-monorepo` must be accessible in each monorepo package.\n\n```bash\nnpm install -D semantic-release semantic-release-monorepo\n```\n\n## Usage\n\nRun `semantic-release` in an **individual monorepo package** and apply `semantic-release-monorepo` via the [`extends`](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#extends) option.\n\nOn the command line:\n\n```bash\n$ npm run semantic-release -e semantic-release-monorepo\n```\n\nOr in the [release config](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration-file):\n\n```json\n{\n  \"extends\": \"semantic-release-monorepo\"\n}\n```\n\nNOTE: This library **CAN'T** be applied via the `plugins` option.\n\n```json\n{\n  \"plugins\": [\n    \"semantic-release-monorepo\" // This WON'T work\n  ]\n}\n```\n\n### With Yarn Workspaces\n\n```bash\n$ yarn workspaces run semantic-release -e semantic-release-monorepo\n```\n\n### With Lerna\n\nThe monorepo management tool [`lerna`](https://github.com/lerna/lerna) can be used to run `semantic-release-monorepo` across all packages in a monorepo with a single command:\n\n```bash\nlerna exec --concurrency 1 -- npx --no-install semantic-release -e semantic-release-monorepo\n```\n\n### With pnpm\n\n[pnpm](https://pnpm.io/) has built-in [workspace](https://pnpm.io/workspaces) functionality for monorepos. Similarly to the above, you can use pnpm to make release in all packages:\n\n```bash\npnpm -r --workspace-concurrency=1 exec -- npx --no-install semantic-release -e semantic-release-monorepo\n```\n\nThanks to how [`npx's package resolution works`](https://github.com/npm/npx#description), if the repository root is in `$PATH` (typically true on CI), `semantic-release` and `semantic-release-monorepo` can be installed once in the repo root instead of in each individual package, likely saving both time and disk space.\n\n## Advanced\n\nThis library modifies the `context` object passed to `semantic-release` plugins in the following way to make them compatible with a monorepo.\n\n| Step             | Description                                                                                                                                                                                                                                                                                                                                                                                                                      |\n| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `analyzeCommits` | Filters `context.commits` to only include the given monorepo package's commits.                                                                                                                                                                                                                                                                                                                                                  |\n| `generateNotes`  | \u003cul\u003e\u003cli\u003eFilters `context.commits` to only include the given monorepo package's commits.\u003c/li\u003e\u003cli\u003eModifies `context.nextRelease.version` to use the [monorepo git tag format](#how). The wrapped (default) `generateNotes` implementation uses this variable as the header for the release notes. Since all release notes end up in the same Github repository, using just the version as a header introduces ambiguity.\u003c/li\u003e\u003c/ul\u003e |\n\n### tagFormat\n\nPre-configures the [`tagFormat` option](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/configuration.md#tagformat) to use the [monorepo git tag format](#how).\n\nIf you are using Lerna, you can customize the format using the following command:\n\n```\n\"semantic-release\": \"lerna exec --concurrency 1 -- semantic-release -e semantic-release-monorepo --tag-format='${LERNA_PACKAGE_NAME}-v\\\\${version}'\"\n```\n\nWhere `'${LERNA_PACKAGE_NAME}-v\\\\${version}'` is the string you want to customize. By default it will be `\u003cPACKAGE_NAME\u003e-v\u003cVERSION\u003e` (e.g. `foobar-v1.2.3`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmowrer%2Fsemantic-release-monorepo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmowrer%2Fsemantic-release-monorepo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmowrer%2Fsemantic-release-monorepo/lists"}