Skip to content

getNewVersion

Generates a new version string based on the current version and the specified update type.

Uses the semver package to compute the next version, supporting all npm increment types: major, minor, patch, premajor, preminor, prepatch, and prerelease. Pre-release versions use the beta identifier by default (e.g., 1.2.4-beta.0).

Import:

import { getNewVersion } from 'obsidian-dev-utils/script-utils/version';

Signature:

function getNewVersion(versionUpdateType: string): Promise<string>

Parameters:

ParameterTypeDescription
versionUpdateTypestringThe type of version update or an explicit version string.

Returns: Promise<string> — A Promise that resolves to the new version string.