yarn npm publish — Yarn CLI reference

Publish the active workspace to an npm registry.

Docs/Reference/CLI/npm/publish

yarn npm publish

Publish the active workspace to an npm registry.

yarn npm publish

This command packs the active workspace and uploads it to the registry selected for publishing. The registry is resolved from publishConfig.registry when present, then from npmPublishRegistry, then from the regular npm registry configuration.

The published package must have both a name and a version, and workspaces marked as private: true cannot be published.

The publish access is selected in order of precedence: the --access option, then publishConfig.access, then the npmPublishAccess configuration setting. The supported values are public and restricted.

By default, attempting to publish a version that already exists on the registry is an error. Use --tolerate-republish to check first and skip the upload when the same version is already known by the registry.

#--access, -aboolean

Access level for the published package (public or restricted)

#--tagboolean

Dist-tag to attach to the published version

#--tolerate-republishboolean

Skip the upload if the registry already contains this version

#--otpboolean

One-time password to use when the registry requires two-factor authentication

#--provenanceboolean

Generate and upload a provenance statement for the package

#--dry-runboolean

Print what would be published without uploading anything

#--jsonboolean

Output the result as JSON