Skip to main content

Crate standard_version

Crate standard_version 

Source
Expand description

Semantic version bump calculation from conventional commits.

Pure library — computes the next version from a list of parsed conventional commits and bump rules. No I/O, no git operations.

§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));

Structs§

BumpSummary
Summary of analysed commits for display purposes.

Enums§

BumpLevel
The level of version bump to apply.

Functions§

apply_bump
Apply a bump level to a semver version, returning the new version.
apply_prerelease
Apply a pre-release bump. If the current version already has a pre-release tag matching tag, the numeric suffix is incremented. Otherwise, .0 is appended to the bumped version.
determine_bump
Analyse a list of conventional commits and return the highest applicable bump level.
replace_version_in_toml
Replace the version value in a TOML string’s [package] section while preserving formatting.
summarise
Summarise a list of conventional commits for display purposes.