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

Package detail

publish-if-not-published

jameslnewell18.2kMIT3.1.3TypeScript support: included

Publish a package if the current version isn't already published.

npm, yarn, publish, try, attempt, please

readme

publish-if-not-published

Main Actions Status

Publish a package if the current version isn't already published.

A list of packages published with publish-if-not-published

Installation

yarn add --dev publish-if-not-published

Usage

Run publish-if-not-published and pass any additional arguments that you would have passed to npm publish.

"$(yarn bin)/publish-if-not-published" -- --otp 123456 --dry-run

Tags

When specifing a non-latest tag to be published, a suffix should also be appended to the version so as not to use up a semver version on a prerelease.

{
  "name": "package",
  "version": "2.0.0-next.0"
}
"$(yarn bin)/publish-if-not-published" -- --tag next

publish-if-not-published checks whether it has been called with a non-latest tag, and the version of the package to prevent:

  1. Accidentally publishing a tagged release with a non-suffixed version, or
  2. Accidentally publishing a latest release with a suffixed version.

These checks can be turned off with the --no-tag-check flag:

"$(yarn bin)/publish-if-not-published" --no-tag-check -- --tag rc

changelog

Change log

3.1.2

  • Fix isPublish check to work when a package has never been published before and a string is returned instead of an array

3.1.1

  • Fix isPublish check to work when a package has never been published before and 404s are returned

3.1.0

  • Check whether a package version has already been published before checking tags so we skip instead of erroring when we're trying to publish a pre-release but the current version is a not a pre-release and has already been published -

3.0.0

  • Made tag issues exit with a non-zero exit code
  • Changed emojis
  • Include README.md in files

2.2.1

  • Updated to handle slightly modified text for already published version

2.2.0

  • Added --max-buffer flag to support large std* buffers (#3)

2.1.0

  • Added tests and updated all the dependencies
  • Fixed --tag-check behaviour to be on by default

2.0.0

  • Add dist-tag / version suffix logic for preventing accidentally publishing a tagged release with a real version, or a latest release with a version suffix. (#4)

1.0.0

  • Initial release