Skip to main content

Crate standard_version

Crate standard_version 

Source
Expand description

Semantic version bump calculation from conventional commits.

Computes the next version from a list of parsed conventional commits and bump rules. Also provides the VersionFile trait for ecosystem-specific version file detection and updating, with built-in support for Cargo.toml via CargoVersionFile, pyproject.toml via PyprojectVersionFile, package.json via JsonVersionFile, deno.json/deno.jsonc via DenoVersionFile, pubspec.yaml via PubspecVersionFile, gradle.properties via GradleVersionFile, and plain VERSION files via PlainVersionFile.

§Main entry points

§Example

use standard_version::{determine_bump, apply_bump, BumpLevel};

let commits = vec![
    standard_commit::parse("feat: add login").unwrap(),
    standard_commit::parse("fix: handle timeout").unwrap(),
];

let level = determine_bump(&commits).unwrap();
assert_eq!(level, BumpLevel::Minor);

let current = semver::Version::new(1, 2, 3);
let next = apply_bump(&current, level);
assert_eq!(next, semver::Version::new(1, 3, 0));

Re-exports§

pub use bump::BumpLevel;
pub use bump::BumpSummary;
pub use bump::apply_bump;
pub use bump::apply_prerelease;
pub use bump::determine_bump;
pub use bump::summarise;
pub use cargo::CargoVersionFile;
pub use gradle::GradleVersionFile;
pub use json::DenoVersionFile;
pub use json::JsonVersionFile;
pub use project::ProjectJsonVersionFile;
pub use project::ProjectTomlVersionFile;
pub use project::ProjectYamlVersionFile;
pub use pubspec::PubspecVersionFile;
pub use pyproject::PyprojectVersionFile;
pub use regex_engine::RegexVersionFile;
pub use version_file::CustomVersionFile;
pub use version_file::DetectedFile;
pub use version_file::UpdateResult;
pub use version_file::VersionFile;
pub use version_file::VersionFileError;
pub use version_file::detect_version_files;
pub use version_file::update_version_files;
pub use version_plain::PlainVersionFile;

Modules§

bump
Semantic version bump calculation from conventional commits.
calver
Calendar versioning (calver) support.
cargo
Cargo.toml version file engine.
gradle
gradle.properties version file engine.
json
JSON version file engines for package.json and deno.json/deno.jsonc.
project
Project manifest version file engines.
pubspec
pubspec.yaml version file engine.
pyproject
pyproject.toml version file engine.
regex_engine
Regex-based version file engine for user-defined [[version_files]].
scan
Version file discovery and updating.
toml_helpers
Shared helpers for TOML section-based version scanning.
version_file
Version file detection and updating.
version_plain
Plain VERSION file engine.

Functions§

replace_version_in_toml
Replace the version value in a TOML string’s [package] section while preserving formatting.