Publish prereleases
This guide shows how to publish prereleases of a scope, such as 1.1.0-alpha.0, then release it as stable. The SemVer and CalVer plugins provide the same pre command; the examples use SemVer.
Declare the channels
Section titled “Declare the channels”List the channels in the order a release goes through them:
createSemverPlugin({ prereleaseChannels: ["alpha", "beta", "rc"],});Enter a channel
Section titled “Enter a channel”Put the scope in prerelease mode:
npx unirelman semver pre --scope my-package --channel alphapnpm unirelman semver pre --scope my-package --channel alphayarn unirelman semver pre --scope my-package --channel alphabunx unirelman semver pre --scope my-package --channel alphaThe command records the channel in .unirelman/semver/prerelease.json. Commit this file: version reads it.
From now on, each version run with changes gives a prerelease, such as 1.0.0 → 1.1.0-alpha.0 with a minor change, then 1.1.0-alpha.1. See the next version rules.
With fixed versioning, name the group with --group instead of --scope. See semver pre.
Move to the next channel
Section titled “Move to the next channel”npx unirelman semver pre --scope my-package --channel betapnpm unirelman semver pre --scope my-package --channel betayarn unirelman semver pre --scope my-package --channel betabunx unirelman semver pre --scope my-package --channel betaThe next version run with changes gives 1.1.0-beta.0.
Release as stable
Section titled “Release as stable”Exit prerelease mode:
npx unirelman semver pre --scope my-package --exitpnpm unirelman semver pre --scope my-package --exityarn unirelman semver pre --scope my-package --exitbunx unirelman semver pre --scope my-package --exitThe next version run releases the stable version, such as 1.1.0, even without new changesets.
Find the published prereleases
Section titled “Find the published prereleases”- npm publishes a prerelease under a dist-tag named after its channel, such as
npm install my-package@beta.latestkeeps pointing to the last stable version. - GitHub marks the release of a prerelease as a prerelease.