Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

yarn publish

Publishes a package to the npm registry.

Once a package is published, you can never modify that specific version, so take care before publishing.

yarn publish

Publishes the package defined by the package.json in the current directory.

yarn publish [tarball]

Publishes the package defined by a .tgz gzipped tarball.

yarn publish [folder]

Publishes the package contained in the specified folder. <folder>/package.json should specify the package details.

yarn publish --new-version <version>

Skips the prompt for new version by using the value of version instead.

yarn publish --tag <tag>

Providing a tag to yarn publish lets you publish packages with a specific tag. For example, if you do a yarn publish --tag beta, and your package is named blorp, then someone else can install that package with yarn add blorp@beta.

yarn publish --access <public|restricted>

The --access flag controls whether the npm registry publishes this package as a public package, or restricted.