Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

semantic-release-yarn

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semantic-release-yarn

semantic-release plugin to publish a npm package with yarn

  • 0.1.0
  • npm
  • Socket score

Version published
Weekly downloads
6.1K
increased by14.67%
Maintainers
1
Weekly downloads
 
Created
Source

⚠️
Do not use in production!
This plugin is work in progress.

semantic-release-yarn npm

semantic-release plugin to publish a npm package with yarn.

StepDescription
verifyConditionsVerify Yarn 2 or higher is installed, verify the presence of an NPM auth token (either in an environment variable or an .yarnrc.yml file) and verify the authentication method is valid.
prepareUpdate the package.json version and create the package tarball.
addChannelAdd a tag for the release.
publishPublish to the npm registry.

Intended audience

Use this plugin if you want to use Yarn instead of the NPM CLI to publish your packages to the NPM registry.

As an added bonus, this plugin will also publish some simple monorepo patterns (WIP).

💡
You could also use this plugin to publish packages which are using NPM for dependency management.

Install

yarn add --dev semantic-release-yarn

⚠️
Please note this plugin only works with Yarn 2 and higher.

Usage

The plugin must be added in the semantic-release configuration, for example:

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

Configuration

NPM registry authentication

The NPM authentication configuration is required and can be set either via environment variables or the .yarnrc.yml file.

The configuration set by environment variables will take precedence over configuration set in an existing .yarnrc.yml file as detailed in Yarnrc files

⚠️
When two-factor authentication is enabled on your NPM account and enabled for writes (default setting), the token needs to be of type Automation.

⚠️
Only the npmAuthToken is supported. The legacy npmAuthIdent (username:password) authentication is strongly discouraged and not supported by this plugin.

Environment variables

VariableDescription
YARN_NPM_AUTH_TOKENNPM token. Translates to the npmAuthToken .yarnrc.yml option.
YARN_NPM_PUBLISH_REGISTRYNPM registry to use. Translates to the npmPublishRegistry .yarnrc.yml option.

Other valid .yarnrc.yml options could be specified as environment variables as mentioned in the Yarnrc files documentation:

Finally, note that most settings can also be defined through environment variables (at least for the simpler ones; arrays and objects aren't supported yet). To do this, just prefix the names and write them in snake case: YARN_CACHE_FOLDER will set the cache folder (such values will overwrite any that might have been defined in the RC files - use them sparingly).

Yarn configuration

The plugin uses the yarn CLI which will read the configuration from a .yarnrc.yml file if present. See Yarnrc files for the option list.

The NPM registry to publish to can be configured via the environment variable YARN_NPM_PUBLISH_REGISTRY and will take precedence over the configuration in .yarnrc.yml.

The registry can be configured in the package.json and will take precedence over the configuration in .yarnrc.yml and YARN_NPM_PUBLISH_REGISTRY:

{
  "publishConfig": {
    "registry": "https://registry.npmjs.org/"
  }
}

⚠️
The @semantic-release/npm plugin supports setting the publishConfig.tag option. However, Yarn 2 doesn't seem to > support this.

Plugin options

These options can be added to the semantic-release configuration, for example:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [
      "semantic-release-yarn",
      {
        "npmPublish": false
      }
    ],
    "@semantic-release/github"
  ]
}
OptionsDescriptionDefault
npmPublishWhether to publish the NPM package to the registry. If false the package.json version will still be updated.false if the package.json private property is true, true otherwise.
pkgRootDirectory path to publish..
tarballDirDirectory path in which to write the package tarball. If false the tarball is not kept on the file system.false

Note: The pkgRoot directory must contain a package.json. The version will be updated only in the package.json within the pkgRoot directory.

Note: If you use a shareable configuration that defines one of these options you can set it to false in your semantic-release configuration in order to use the default value.

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",
    [
      "semantic-release-yarn",
      {
        "npmPublish": false,
        "tarballDir": "dist"
      }
    ],
    [
      "@semantic-release/github",
      {
        "assets": "dist/*.tgz"
      }
    ]
  ]
}

Credits

©️ Copyright 2022 Joram van den Boezem
♻️ Licensed under the MIT license
⚡ Powered by Node.js and TypeScript (and a lot of amazing open source packages)
🚀 This plugin is forked from the core @semantic-release/npm plugin.

Keywords

FAQs

Package last updated on 06 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc