or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

bumper.mdcli.mdindex.mdtypes.md
tile.json

tessl/npm-conventional-recommended-bump

Get a recommended version bump based on conventional commits.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/conventional-recommended-bump@11.2.x

To install, run

npx @tessl/cli install tessl/npm-conventional-recommended-bump@11.2.0

index.mddocs/

Conventional Recommended Bump

Conventional Recommended Bump is a TypeScript/JavaScript library that determines the appropriate semantic version bump (major, minor, or patch) based on conventional commit messages. It analyzes Git commit history to recommend version increments according to conventional commit standards, making it essential for automated release workflows and semantic versioning.

Package Information

  • Package Name: conventional-recommended-bump
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install conventional-recommended-bump

Core Imports

import { Bumper, packagePrefix } from "conventional-recommended-bump";
import type { BumperRecommendationResult, Preset, Options } from "conventional-recommended-bump";

For CommonJS:

const { Bumper, packagePrefix } = require("conventional-recommended-bump");

Basic Usage

import { Bumper } from "conventional-recommended-bump";

// Basic usage with a preset
const bumper = new Bumper().loadPreset("angular");
const recommendation = await bumper.bump();

if ("releaseType" in recommendation) {
  console.log(recommendation.releaseType); // 'major', 'minor', or 'patch'
  console.log(recommendation.reason); // Explanation for the bump
}

Architecture

Conventional Recommended Bump is built around several key components:

  • Bumper Class: Main interface for configuring and executing version bump analysis
  • Preset System: Pre-configured rulesets for different conventional commit standards (Angular, etc.)
  • Git Integration: Built-in Git client for commit retrieval and tag analysis
  • Commit Parser: Parses conventional commit messages to extract semantic information
  • Custom Configuration: Support for custom presets and configuration objects

Capabilities

Core Bumper Interface

Main class for analyzing commits and determining version bumps. Provides fluent API for configuration and supports both preset-based and custom configurations.

class Bumper {
  constructor(cwdOrGitClient?: string | ConventionalGitClient);
  loadPreset<PresetCreatorParams>(preset: PresetParams<PresetCreatorParams>, loader?: PresetModuleLoader): this;
  config(config: Preset | Promise<Preset>): this;
  options(options: Options): this;
  tag(paramsOrTag: GetSemverTagsParams | string): this;
  commits(params: GetCommitsParams, parserOptions?: ParserStreamOptions): this;
  commits(commits: Iterable<Commit> | AsyncIterable<Commit>): this;
  bump(whatBump?: (commits: Commit[]) => Promise<BumperRecommendation | null | undefined>): Promise<BumperRecommendationResult>;
}

Core Bumper Interface

Command-Line Interface

Complete CLI for integrating version bump recommendations into scripts and CI/CD pipelines.

// CLI command: conventional-recommended-bump
// Basic usage: conventional-recommended-bump --preset angular
// With options: conventional-recommended-bump --preset angular --verbose --tag-prefix v

Command-Line Interface

Type System

Complete type definitions for bump recommendations, presets, and configuration options.

interface BumperRecommendation {
  level: 0 | 1 | 2;
  reason: string;
  releaseType: 'major' | 'minor' | 'patch';
  commits: Commit[];
}

interface EmptyBumperRecommendation {
  commits: Commit[];
}

type BumperRecommendationResult = BumperRecommendation | EmptyBumperRecommendation;

interface Preset {
  whatBump(commits: Commit[]): Promise<WhatBumpResult> | WhatBumpResult;
  tags?: GetSemverTagsParams;
  commits?: GetCommitsParams;  
  parser?: ParserStreamOptions;
}

Type System

Utility Functions

Helper functions for package prefix handling in monorepo scenarios.

/**
 * Generate a package prefix for use with Lerna-style monorepos
 * @param packageName - The package name to generate prefix for
 * @returns Package prefix string for git tag analysis
 */
function packagePrefix(packageName: string): string;

Usage Example:

import { packagePrefix } from "conventional-recommended-bump";

// Generate prefix for scoped package analysis
const prefix = packagePrefix("@myorg/ui-components");
// Returns: "@myorg/ui-components@"

// Use with tag configuration
const bumper = new Bumper().tag({ prefix });

External Dependencies

This package integrates with and depends on several related packages:

  • @conventional-changelog/git-client - Git operations and commit retrieval
  • conventional-commits-parser - Parsing conventional commit messages
  • conventional-changelog-preset-loader - Loading and managing presets
  • conventional-commits-filter - Filtering commits based on criteria

The package provides seamless integration with these dependencies while exposing a simplified API for version bump determination.