CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-standard-version

A Node.js command-line tool that automates versioning and changelog generation for projects following the Conventional Commits specification.

Pending
Overview
Eval results
Files

cli.mddocs/

Command Line Interface

Standard Version provides a comprehensive CLI for automated versioning and changelog generation. The CLI analyzes conventional commits, determines appropriate version bumps, updates files, generates changelogs, and creates git tags.

Capabilities

Basic Commands

Standard command-line usage for common versioning scenarios.

# Automatic version bump based on conventional commits
standard-version

# Specific release types
standard-version --release-as major
standard-version --release-as minor  
standard-version --release-as patch
standard-version --release-as 1.5.0

# Pre-release versions
standard-version --prerelease
standard-version --prerelease alpha
standard-version --prerelease beta

Usage Examples:

# Analyze commits and bump version automatically
standard-version
# If commits contain: feat: add new feature -> minor bump
# If commits contain: fix: resolve bug -> patch bump  
# If commits contain: feat!: breaking change -> major bump

# Force specific version bump
standard-version --release-as major
# Always creates major version bump regardless of commits

# Create pre-release version
standard-version --prerelease
# 1.0.0 -> 1.0.1-0, 1.0.1-0 -> 1.0.1-1

# Create pre-release with custom tag
standard-version --prerelease alpha
# 1.0.0 -> 1.0.1-alpha.0

Release Configuration Options

Options for controlling release behavior and version calculation.

--release-as, -r <type>        # Specify release type (major|minor|patch) or exact version
--prerelease, -p [tag]         # Create pre-release with optional tag identifier  
--first-release, -f            # Mark as first release (skips version bump)

Usage Examples:

# First release of a project
standard-version --first-release
# Creates changelog and tag without bumping version from package.json

# Pre-release with custom tag
standard-version --prerelease canary
# Creates version like 1.0.1-canary.0

Git Configuration Options

Options for controlling git commit and tag behavior.

--sign, -s                     # Sign git commit and tag with GPG
--no-verify, -n               # Bypass pre-commit and commit-msg git hooks
--commit-all, -a              # Commit all staged changes, not just version files
--tag-prefix, -t <prefix>     # Custom prefix for git tags (default: 'v')

Usage Examples:

# Sign commits and tags
standard-version --sign
# Creates signed commit and tag using configured GPG key

# Skip git hooks during commit
standard-version --no-verify  
# Bypasses pre-commit hooks that might prevent commit

# Custom tag prefix
standard-version --tag-prefix rel-
# Creates tags like 'rel-1.0.0' instead of 'v1.0.0'

File Configuration Options

Options for controlling which files are read and updated.

--infile, -i <path>           # Path to changelog file (default: CHANGELOG.md)
--package-files <files>       # Comma-separated list of files to read version from
--bump-files <files>          # Comma-separated list of files to update with version

Usage Examples:

# Custom changelog file
standard-version --infile HISTORY.md
# Updates HISTORY.md instead of CHANGELOG.md

# Multiple package files
standard-version --package-files package.json,manifest.json
# Reads version from either package.json or manifest.json

# Custom bump files  
standard-version --bump-files package.json,version.txt
# Updates both package.json and version.txt with new version

Behavior Control Options

Options for controlling output and execution behavior.

--silent                      # Suppress all output except errors
--dry-run                     # Show what would be done without making changes
--git-tag-fallback           # Use git tags for version if no package files found

Usage Examples:

# Preview changes without executing
standard-version --dry-run
# Shows planned version bump, changelog entries, and files to be modified

# Run silently for CI/CD
standard-version --silent
# Suppresses progress output, only shows errors

# Use git tags as version source
standard-version --git-tag-fallback
# Falls back to latest git tag if package.json not found

Advanced Configuration Options

Options for advanced customization and workflow integration.

--scripts <object>            # JSON object defining lifecycle hook scripts
--skip <object>               # JSON object defining steps to skip
--preset <preset>             # Conventional changelog preset name
--path <path>                 # Only include commits made under this path
--lerna-package <name>        # Extract tags for specific package in Lerna monorepo
--header <text>               # Custom header for changelog

Usage Examples:

# Skip specific steps
standard-version --skip.changelog=true --skip.tag=true
# Bumps version and commits, but skips changelog and tagging

# Custom changelog preset
standard-version --preset angular
# Uses Angular conventional changelog preset

# Include only commits under specific path
standard-version --path packages/core
# Only analyzes commits that modified files under packages/core

# Lerna monorepo package-specific versioning
standard-version --lerna-package my-package
# Extracts tags specifically for 'my-package' in a Lerna monorepo

# Custom lifecycle scripts
standard-version --scripts.prebump="echo 'Starting version bump'"
# Runs custom script before version bump

Deprecated Options

Options that are deprecated and will be removed in future versions.

--message, -m <template>      # [DEPRECATED] Use --releaseCommitMessageFormat
--changelogHeader <text>      # [DEPRECATED] Use --header

Exit Codes

Standard Version uses conventional exit codes:

  • 0 - Success
  • 1 - Error occurred during execution

Configuration File Integration

All CLI options can be specified in configuration files:

{
  "scripts": {
    "prebump": "echo 'Preparing version bump'",
    "postbump": "echo 'Version bumped'"
  },
  "skip": {
    "changelog": false,
    "tag": false
  },
  "tagPrefix": "release-",
  "releaseCommitMessageFormat": "chore(release): {{currentTag}}"
}

The CLI will automatically load configuration from .versionrc, .versionrc.json, .versionrc.js, or the standard-version key in package.json.

Install with Tessl CLI

npx tessl i tessl/npm-standard-version

docs

api.md

cli.md

configuration.md

index.md

lifecycle.md

updaters.md

tile.json