{"id":13566956,"url":"https://github.com/hongaar/semantic-release-yarn","last_synced_at":"2025-04-09T13:04:08.649Z","repository":{"id":63756425,"uuid":"570463716","full_name":"hongaar/semantic-release-yarn","owner":"hongaar","description":"🧶 A semantic-release plugin to publish npm packages with Yarn. Comes with built-in support for monorepos.","archived":false,"fork":false,"pushed_at":"2025-03-31T17:40:28.000Z","size":5137,"stargazers_count":22,"open_issues_count":7,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T12:08:20.644Z","etag":null,"topics":["monorepo","npm","plugin","release-automation","semantic-release","yarn"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/hongaar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-11-25T08:55:59.000Z","updated_at":"2025-03-03T17:54:32.000Z","dependencies_parsed_at":"2023-10-02T21:44:49.551Z","dependency_job_id":"bfd10861-8f72-4e21-bc37-9d1a6048c104","html_url":"https://github.com/hongaar/semantic-release-yarn","commit_stats":{"total_commits":719,"total_committers":35,"mean_commits":"20.542857142857144","dds":0.611961057023644,"last_synced_commit":"7b5afd0dc46409eec3418f02c8f71c776ba23681"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongaar%2Fsemantic-release-yarn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongaar%2Fsemantic-release-yarn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongaar%2Fsemantic-release-yarn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongaar%2Fsemantic-release-yarn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hongaar","download_url":"https://codeload.github.com/hongaar/semantic-release-yarn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045230,"owners_count":21038553,"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":["monorepo","npm","plugin","release-automation","semantic-release","yarn"],"created_at":"2024-08-01T13:02:20.236Z","updated_at":"2025-04-09T13:04:08.615Z","avatar_url":"https://github.com/hongaar.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# semantic-release-yarn [![npm](https://img.shields.io/npm/v/semantic-release-yarn)](https://www.npmjs.com/package/semantic-release-yarn)\n\n**A [semantic-release](https://semantic-release.gitbook.io/semantic-release/)\nplugin to publish [npm](https://www.npmjs.com) packages with\n[Yarn](https://yarnpkg.com). Comes with built-in support for monorepos.**\n\n```diff\n {\n   \"branches\": [\"main\"],\n   \"plugins\": [\n     \"@semantic-release/commit-analyzer\",\n     \"@semantic-release/release-notes-generator\",\n-    \"@semantic-release/npm\",\n+    \"semantic-release-yarn\",\n     \"@semantic-release/github\",\n     \"@semantic-release/git\"\n   ]\n }\n```\n\n## Table of contents\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n- [Install](#install)\n- [Usage](#usage)\n- [NPM registry authentication](#npm-registry-authentication)\n- [Monorepo support](#monorepo-support)\n- [Configuration](#configuration)\n  - [Environment variables](#environment-variables)\n  - [`.yarnrc.yml` file](#yarnrcyml-file)\n  - [`package.json` file](#packagejson-file)\n  - [Plugin options](#plugin-options)\n- [Examples](#examples)\n  - [Only create package tarball](#only-create-package-tarball)\n- [Plugin steps](#plugin-steps)\n- [Development](#development)\n  - [Roadmap](#roadmap)\n- [Credits](#credits)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Install\n\n```bash\nyarn add --dev semantic-release-yarn\n```\n\n\u003e **Note**: this plugin only works with **Yarn 2** and higher.\n\n## Usage\n\nUse this plugin instead of the default\n[@semantic-release/npm](https://github.com/semantic-release/npm). The plugin\nmust be added in the\n[**semantic-release** configuration](https://semantic-release.gitbook.io/semantic-release/usage/configuration),\nfor example:\n\n```json\n{\n  \"plugins\": [\n    \"@semantic-release/commit-analyzer\",\n    \"@semantic-release/release-notes-generator\",\n    \"semantic-release-yarn\",\n    \"@semantic-release/github\",\n    \"@semantic-release/git\"\n  ]\n}\n```\n\n## NPM registry authentication\n\nProviding a NPM access token in your configuration is **required** and can be\nset either via [environment variables](#environment-variables) or the\n[`.yarnrc.yml`](#yarnrcyml-file) file.\n\nMake sure your access token has write access to the package you want to publish:\n\n- **When using a\n  [classic/legacy token](https://docs.npmjs.com/creating-and-viewing-access-tokens#creating-legacy-tokens-on-the-website)**,\n  it must be either:\n  - A \"**Publish**\" token if you're not using 2FA or if 2FA is disabled for\n    write operations (The \"Require two-factor authentication for write actions\"\n    is unchecked in your 2FA settings)\n  - An \"**Automation**\" token if 2FA is enabled for write operations (The\n    \"Require two-factor authentication for write actions\" is checked in your 2FA\n    settings)\n- **When using a\n  [granular access token](https://docs.npmjs.com/creating-and-viewing-access-tokens#creating-granular-access-tokens-on-the-website)**\n  make sure it has \"**Read and write**\" permissions on the package you want to\n  publish.\n\n\u003e **Note**: only the\n\u003e [`npmAuthToken`](https://yarnpkg.com/configuration/yarnrc/#npmAuthToken) is\n\u003e supported. The legacy\n\u003e [`npmAuthIdent`](https://yarnpkg.com/configuration/yarnrc/#npmAuthIdent)\n\u003e (`username:password`) authentication is strongly discouraged and not supported\n\u003e by this plugin.\n\n## Monorepo support\n\nCurrently, simple monorepo versioning and publishing is supported. All\nworkspaces versions will be aligned (a.k.a. fixed/locked mode) and when a new\nrelease is due, all workspaces will be published to the NPM registry.\n\nMonorepos are detected by the presence of a\n[`workspaces`](https://yarnpkg.com/configuration/manifest#workspaces) option in\nthe root `package.json` file, for example:\n\n```json\n{\n  \"workspaces\": [\"packages/*\"]\n}\n```\n\nYou can set the `mainWorkspace` [plugin option](#plugin-options) to use in\nnotifications of new releases (e.g. in issue and pull request comments made by\nthe [@semantic-release/github](https://github.com/semantic-release/github)\nplugin.\n\nSee [our roadmap](#roadmap) for further implementation status.\n\n## Configuration\n\n### Environment variables\n\n| Variable                    | Description                                                                                                                                                                                  |\n| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `YARN_NPM_AUTH_TOKEN`       | [NPM access token](https://docs.npmjs.com/creating-and-viewing-access-tokens). Translates to the [npmAuthToken](https://yarnpkg.com/configuration/yarnrc#npmAuthToken) `.yarnrc.yml` option. |\n| `YARN_NPM_PUBLISH_REGISTRY` | NPM registry to use. Translates to the [npmPublishRegistry](https://yarnpkg.com/configuration/yarnrc#npmPublishRegistry) `.yarnrc.yml` option.                                               |\n\nMost other Yarn options could be specified as environment variables as well.\nJust prefix the names and write them in snake case. Refer to the\n[Yarnrc files](https://yarnpkg.com/configuration/yarnrc) documentation to see\nall options.\n\n\u003e **Note**: the configuration set by environment variables will take precedence\n\u003e over configuration set in the `.yarnrc.yml` file.\n\n### `.yarnrc.yml` file\n\nOptions can also be set in a `.yarnrc.yml` file. See\n[Yarnrc files](https://yarnpkg.com/configuration/yarnrc) for the complete list\nof option.\n\n### `package.json` file\n\nThe\n[`registry`](https://yarnpkg.com/configuration/manifest#publishConfig.registry)\ncan be configured in the `package.json` and will take precedence over the\nconfiguration in environment variables and the `.yarnrc.yml` file:\n\n```json\n{\n  \"publishConfig\": {\n    \"registry\": \"https://registry.npmjs.org/\"\n  }\n}\n```\n\n\u003e **Note**: the `@semantic-release/npm` plugin supports setting the\n\u003e `publishConfig.tag` option. However, Yarn 2\n\u003e [doesn't seem to](https://github.com/yarnpkg/berry/issues?q=publishConfig+tag) \u003e\n\u003e [support this](https://yarnpkg.com/configuration/manifest#publishConfig).\n\n### Plugin options\n\nThese options can be added to the\n[**semantic-release** configuration](https://semantic-release.gitbook.io/semantic-release/usage/configuration),\nfor example:\n\n```json\n{\n  \"plugins\": [\n    \"@semantic-release/commit-analyzer\",\n    \"@semantic-release/release-notes-generator\",\n    [\n      \"semantic-release-yarn\",\n      {\n        \"npmPublish\": false\n      }\n    ],\n    \"@semantic-release/github\"\n  ]\n}\n```\n\n| Options         | Description                                                                                                      | Default                                                                                                                                                      |\n| --------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `npmPublish`    | Whether to publish the NPM package to the registry. If `false` the `package.json` version will still be updated. | `false` if the `package.json` [private](https://docs.npmjs.com/files/package.json#private) property is `true` and no monorepo is detected, `true` otherwise. |\n| `pkgRoot`       | Directory path to publish.                                                                                       | `.`                                                                                                                                                          |\n| `tarballDir`    | Directory path in which to write the package tarball. If `false` the tarball is not kept on the file system.     |                                                                                                                                                              |\n| `mainWorkspace` | Name of monorepo workspace to be used in release info                                                            |                                                                                                                                                              |\n\n\u003e **Note**: the `pkgRoot` directory must contain a `package.json`. The version\n\u003e will be updated only in the `package.json` within the `pkgRoot` directory.\n\n## Examples\n\n### Only create package tarball\n\nThe `npmPublish` and `tarballDir` option can be used to skip the publishing to\nthe NPM registry and instead release the package tarball with another plugin.\nFor example with the\n[@semantic-release/github](https://github.com/semantic-release/github) plugin:\n\n```json\n{\n  \"plugins\": [\n    \"@semantic-release/commit-analyzer\",\n    \"@semantic-release/release-notes-generator\",\n    [\n      \"semantic-release-yarn\",\n      {\n        \"npmPublish\": false,\n        \"tarballDir\": \"dist\"\n      }\n    ],\n    [\n      \"@semantic-release/github\",\n      {\n        \"assets\": \"dist/*.tgz\"\n      }\n    ]\n  ]\n}\n```\n\n## Plugin steps\n\n| Step               | Description                                                                                                                                                                               |\n| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `verifyConditions` | Verify Yarn 2 or higher is installed, verify the presence of a NPM auth token (either in an environment variable or an `.yarnrc.yml` file) and verify the authentication method is valid. |\n| `prepare`          | Update the `package.json` version and [create](https://yarnpkg.com/cli/pack) the package tarball.                                                                                         |\n| `addChannel`       | [Add a tag](https://yarnpkg.com/cli/npm/tag/add) for the release.                                                                                                                         |\n| `publish`          | [Publish](https://yarnpkg.com/cli/npm/publish) to the npm registry.                                                                                                                       |\n\n## Development\n\nAfter cloning this repository, optionally install\n[husky](https://typicode.github.io/husky/) so you never commit incorrectly\nformatted code:\n\n```bash\nyarn husky install\n```\n\n### Roadmap\n\n- [ ] Monorepo support\n  - [x] Support for fixed versions\n  - [x] Support for private/non-private root package\n  - [x] Support for channels\n  - [ ] Support for release information for each workspace\n  - [ ] Support for independant versions (probably impossible without custom\n        analyze-commits plugin)\n- [x] Get rid of CJS build once\n      [upstream PR 2607](https://github.com/semantic-release/semantic-release/pull/2607)\n      lands\n- [ ] Since we're using the latest AggregateError package, `semantic-release` is\n      not picking up our error stack and we get a generic error message instead\n      of a well formatted one. Hope this can be fixed once\n      [upstream PR #2631](https://github.com/semantic-release/semantic-release/pull/2631)\n      lands\n\n## Credits\n\n©️ Copyright 2022 Joram van den Boezem  \n♻️ Licensed under the MIT license  \n⚡ Powered by Node.js and TypeScript (and a lot of\n[amazing open source packages](./yarn.lock))  \n🚀 This plugin is forked from the core\n[@semantic-release/npm](https://github.com/semantic-release/npm) plugin.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhongaar%2Fsemantic-release-yarn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhongaar%2Fsemantic-release-yarn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhongaar%2Fsemantic-release-yarn/lists"}