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 asalpha,beta, andrc, with the full Git tag, changelog, and Release flow. - Snapshot release (
--snapshot): quickly publishes branch snapshot versions in the form0.0.0-<id>.Non 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 restorespackage.jsonexactly after publishing.
Mutually exclusive:
--canary,--snapshot, and--prare 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:
# 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=rcContinuing a Pre-release Series
Suppose the current latest version is already a pre-release, 1.1.0-beta.0:
# 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=rcPromoting 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:
# 1.1.0-beta.1 -> 1.1.0
release patch
# Or select patch / minor / major from the interactive list
releaseRelated Behavior During Pre-releases
- npm dist-tag: the pre-release identifier is used as the dist-tag automatically (for example
1.1.0-beta.0→--tag beta), solatestis not overwritten. If the pre-release number is purely numeric (such as1.0.1-0), an existing non-latesttag from the registry is reused at publish time, falling back tonextwhen there is none. - GitHub Release:
prerelease: trueis set automatically (no need to setgithub.preReleasemanually). - 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:
release --snapshot=feat-auth
# 1st release: 0.0.0-feat-auth.0
# 2nd release: 0.0.0-feat-auth.1When --snapshot=<id> is enabled, the tool automatically applies the following configuration:
| Option set automatically | Value | Effect |
|---|---|---|
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.getLatestTagFromAllRefs | true | Look for the latest snapshot tag across all branch refs |
git.requireBranch | '!main' | Prevent publishing snapshots on the main branch by mistake |
git.requireUpstream | false | Do not require an upstream on the temporary branch |
npm.ignoreVersion | true | Ignore the original version in package.json and increment from the snapshot tags instead |
In snapshot mode the
git.logCommandfallback 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
<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:
1.3.4-canary.20261202.gfab9148The date is the UTC date (YYYYMMDD), and shortSha comes from git rev-parse --short=7 HEAD.
Common Commands
# 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-versionBase Version Derivation Rules
- A valid SemVer is passed explicitly (such as
release 2.0.0 --canary): itsmajor.minor.patchis used (2.0.0). major/minor/patchis passed explicitly or recommended bychangelog: the corresponding level is incremented on top of the current version'smajor.minor.patch.- No increment is specified and the current version is already a pre-release (such as
1.4.0-beta.1): itsmajor.minor.patchis kept (1.4.0). - In all other cases:
patchis used by default (for example1.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.tagis set automatically to the matching identifier (defaultcanary; it can also be overridden manually with--npm.tag=...), so nothing is ever published tolatest. - Skipping Git and hosting platform operations:
git.commit,git.tag,git.push,git.requireBranch,git.requireUpstream,git.requireUpToDate,changelog.generate,github.release, andgitlab.releaseare turned off automatically, andnpm.checkBreakingChangesis skipped. - Exact restoration of
package.json: the full original content ofpackage.jsonis backed up before it is modified. Whether the publish succeeds, fails, or is cancelled withCtrl+C,package.jsonis written back exactly as it was, and other uncommitted files in the working directory are neither touched nor discarded.