Skip to content

updateVersion

Updates the version of the project based on the specified update type.

This function performs a series of tasks to handle version updates: 1. Validates the version update type. 2. Checks if Git and GitHub CLI are installed. 3. Verifies that the interactive changelog review, if one is due, can actually be answered. 4. Verifies that the bump is not lower than the commits since the last tag force it to be. 5. Verifies that the Git repository is clean. 6. Runs spellcheck and linting. 7. Builds the project. 8. Settles the changelog — the only step that can block on a human, and deliberately the last one before anything is written, so an interrupt here leaves the working tree clean and the release re-runnable. The settled text is linted here too: lint:md ran in step 6, before a character of it existed. 9. Updates version in files (and in whatever UpdateVersionOptions.updateVersionInExtraFiles adds), then writes the settled changelog. 10. Adds updated files to Git, tags the commit, and pushes to the repository. 11. Prepares and publishes a GitHub release. 12. Closes the issues the release carries, with a link to it.

Import:

import { updateVersion } from '@mnaoumov/typescript-dev-toolkit/version';

Signature:

function updateVersion(versionUpdateType: string | undefined, options: UpdateVersionOptions): Promise<void>

Parameters:

Parameter Type Description
versionUpdateType string | undefined The type of version update to perform (major, minor, patch, premajor, preminor, prepatch, prerelease, or x.y.z[-suffix]).
options UpdateVersionOptions The UpdateVersionOptions controlling the release behavior.

Returns: Promise<void> — A Promise that resolves when the version update is complete.


Links to this page: