version_utils.ts

Declarations
#

10 declarations

view source

calculate_next_version
#

compare_bump_types
#

detect_bump_type
#

version_utils.ts view source

(old_version: string, new_version: string): "major" | "minor" | "patch"

old_version

type string

new_version

type string

returns

"major" | "minor" | "patch"

get_update_prefix
#

version_utils.ts view source

(current_version: string, default_strategy?: "" | "^" | "~" | ">="): string

Determines version prefix to use when updating dependencies.

Strategy: - Wildcard (*): Use caret (^) as default - Has existing prefix: Preserve it (^, ~, >=, <=, etc) - No prefix: Use default_strategy

This preserves user intent while handling wildcard replacements sensibly.

current_version

type string

default_strategy

prefix to use when no existing prefix found

type "" | "^" | "~" | ">="
default '^'

returns

string

get_version_prefix
#

version_utils.ts view source

(version: string): string

Gets the version prefix (^, ~, >=, <=, or empty string).

version

type string

returns

string

is_breaking_change
#

version_utils.ts view source

(old_version: string, bump_type: "major" | "minor" | "patch"): boolean

Determines if a bump is a breaking change based on semver rules. Pre-1.0: minor bumps are breaking 1.0+: major bumps are breaking

old_version

type string

bump_type

type "major" | "minor" | "patch"

returns

boolean

is_wildcard
#

needs_update
#

version_utils.ts view source

(current: string, new_version: string): boolean

current

type string

new_version

type string

returns

boolean

normalize_version_for_comparison
#

version_utils.ts view source

(version: string): string

Normalizes version string for comparison.

Strips prefixes (^, ~, >=) to get bare version number. Handles wildcards as-is. Used by needs_update to compare versions.

version

type string

returns

string

examples

Example 1
Example 2
Example 3

strip_version_prefix
#

version_utils.ts view source

(version: string): string

Strips version prefix (^, ~, >=, <=, etc) from a version string.

version

type string

returns

string

Imported by
#