Skip to content

semantic-release plugin to publish a npm package with yarn@berry

Notifications You must be signed in to change notification settings

suin/semantic-release-yarn

Repository files navigation

@suin/semantic-release-yarn

semantic-release plugin to publish a npm package using yarn@berry.

Step Description
verifyConditions Verify the presence of the NPM_TOKEN environment variable and verify the authentication method is valid.
prepare Update the package.json version and create the npm package tarball.
publish Publish the npm package to the registry.

Install

$ yarn add @suin/semantic-release-yarn -D

Usage

The plugin can be configured in the semantic-release configuration file:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    "@suin/semantic-release-yarn"
  ]
}

Configuration

Npm registry authentication

The npm authentication configuration is required and can be set via environment variables.

The token is supported.

Notes:

Environment variables

Variable Description
NPM_TOKEN Npm token created via npm token create

Options

See PluginConfig type declaration.

Npm configuration

The plugin uses the yarn@berry CLI which will read the configuration from .yarnrc.yml.

Notes:

  • The plugin currently only supports the NPM registry https://registry.npmjs.org.
  • The plugin require yarn version plugin. You don't have to install it manually, the plugin will install it for you.

Examples

The npmPublish and tarballDir option can be used to skip the publishing to the npm registry and instead, release the package tarball with another plugin. For example with the @semantic-release/github plugin:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [
      "@suin/semantic-release-yarn",
      {
        "npmPublish": false,
        "tarballDir": "dist"
      }
    ],
    [
      "@semantic-release/github",
      {
        "assets": "dist/*.tgz"
      }
    ]
  ]
}