Skip to content

Pre-releases, Snapshots & Canary Preview Releases ​

@neosjs/release offers three publishing modes for testing and preview scenarios:

  • Standard pre-release (--preRelease): publishes SemVer-compliant pre-release versions such as alpha, beta, and rc, with the full Git tag, changelog, and Release flow.
  • Snapshot release (--snapshot): quickly publishes branch snapshot versions in the form 0.0.0-<id>.N on a non-default branch.
  • Canary preview release (--canary): lightly publishes a preview package carrying a date and a short commit hash, without creating Git commits/tags, and restores package.json exactly after publishing.

Mutually exclusive: --canary, --snapshot, and --pr are mutually exclusive and cannot be enabled in the same release.

Standard Pre-release (--preRelease) ​

Creating the First Pre-release Version ​

Suppose the current latest version is 1.0.0:

bash
# Interactive mode: only the prePatch / preMinor / preMajor options are shown
release --preRelease=alpha

# Specify the increment: 1.0.0 -> 1.1.0-beta.0
release minor --preRelease=beta

# Specify the starting pre-release number: 1.0.0 -> 1.1.0-beta.1 (starts from 0 by default)
release minor --preRelease=beta --preReleaseBase=1

# The identifier can also be passed separately
release prepatch --preReleaseId=rc

Continuing a Pre-release Series ​

Suppose the current latest version is already a pre-release, 1.1.0-beta.0:

bash
# Continue incrementing the current pre-release number: 1.1.0-beta.0 -> 1.1.0-beta.1
release --preRelease=beta

# Switch the pre-release phase: 1.1.0-beta.1 -> 1.1.0-rc.0
release --preRelease=rc

Promoting a Pre-release to a Stable Version ​

When 1.1.0-beta.1 has been verified and is ready to be published as a stable version, drop --preRelease and run the stable increment directly:

bash
# 1.1.0-beta.1 -> 1.1.0
release patch
# Or select patch / minor / major from the interactive list
release
  • npm dist-tag: the pre-release identifier is used as the dist-tag automatically (for example 1.1.0-beta.0 → --tag beta), so latest is not overwritten. If the pre-release number is purely numeric (such as 1.0.1-0), an existing non-latest tag from the registry is reused at publish time, falling back to next when there is none.
  • GitHub Release: prerelease: true is set automatically (no need to set github.preRelease manually).
  • Changelog version recommendation: the current pre-release series is continued by default; to re-determine the bump level strictly from the commits since the last tag, set changelog.strictSemVer: true.

Snapshot Releases ​

--snapshot is suited to repeatedly publishing temporary snapshot versions from a feature branch or a PR verification environment:

bash
release --snapshot=feat-auth
# 1st release: 0.0.0-feat-auth.0
# 2nd release: 0.0.0-feat-auth.1

When --snapshot=<id> is enabled, the tool automatically applies the following configuration:

Option set automaticallyValueEffect
version.increment'prerelease'Always increment as a pre-release
git.tagMatch'0.0.0-<id>.[0-9]*'Match only the tags of this snapshot series
git.getLatestTagFromAllRefstrueLook for the latest snapshot tag across all branch refs
git.requireBranch'!main'Prevent publishing snapshots on the main branch by mistake
git.requireUpstreamfalseDo not require an upstream on the temporary branch
npm.ignoreVersiontrueIgnore the original version in package.json and increment from the snapshot tags instead

In snapshot mode the git.logCommand fallback log is an empty string.

Canary Preview Releases ​

--canary is suited to publishing preview versions to npm for early testing while developing, or on every CI push to a development branch, without polluting Git history or CHANGELOG.md at all.

Version Number Format ​

text
<next-version>-<id>.<YYYYMMDD>.g<shortSha>

Example: the current version is 1.3.3, the latest commit is fab9148, and the publish happens on December 2, 2026:

text
1.3.4-canary.20261202.gfab9148

The date is the UTC date (YYYYMMDD), and shortSha comes from git rev-parse --short=7 HEAD.

Common Commands ​

bash
# Uses the canary identifier and canary dist-tag by default; the next version is computed from the recommended or patch increment
release --canary --npm.publish

# Custom identifier and dist-tag (e.g. nightly / next / beta)
release --canary=nightly --npm.publish

# Base the preview version on the next minor / major version
release minor --canary --npm.publish

# Print only the canary version that would be generated, for scripts to read
release --canary --release-version

Base Version Derivation Rules ​

  1. A valid SemVer is passed explicitly (such as release 2.0.0 --canary): its major.minor.patch is used (2.0.0).
  2. major / minor / patch is passed explicitly or recommended by changelog: the corresponding level is incremented on top of the current version's major.minor.patch.
  3. No increment is specified and the current version is already a pre-release (such as 1.4.0-beta.1): its major.minor.patch is kept (1.4.0).
  4. In all other cases: patch is used by default (for example 1.3.3 → 1.3.4).

Automatic Behavior in Canary Mode ​

With --canary enabled, the tool automatically applies the following isolation and safeguards:

  • npm dist-tag: npm.tag is set automatically to the matching identifier (default canary; it can also be overridden manually with --npm.tag=...), so nothing is ever published to latest.
  • Skipping Git and hosting platform operations: git.commit, git.tag, git.push, git.requireBranch, git.requireUpstream, git.requireUpToDate, changelog.generate, github.release, and gitlab.release are turned off automatically, and npm.checkBreakingChanges is skipped.
  • Exact restoration of package.json: the full original content of package.json is backed up before it is modified. Whether the publish succeeds, fails, or is cancelled with Ctrl+C, package.json is written back exactly as it was, and other uncommitted files in the working directory are neither touched nor discarded.