@hyperfrontend/versioning

Versioning library with changelog parsing, conventional commits, and semver flow orchestration.

• 👉 See roadmap

What is @hyperfrontend/versioning?

@hyperfrontend/versioning provides a comprehensive toolkit for managing software versioning in JavaScript/TypeScript projects. The library is built on a purely functional architecture with factory functions, immutable data structures, and composable operations.

Key Features

  • Changelog Parsing - Parse CHANGELOG.md files into structured objects with lossless round-tripping
  • Conventional Commits - Parse commit messages following the Conventional Commits specification
  • Semver Utilities - Parse, compare, increment, and validate semantic versions
  • Registry Client - Query npm registry for published versions and package metadata
  • Compare URLs - Generate platform-specific compare URLs for changelog entries (GitHub, GitLab, Bitbucket, Azure DevOps)
  • Monorepo Scope Filtering - Intelligent commit classification ensures changelogs only include relevant commits
  • Composable Operations - Build complex versioning workflows from simple, pure functions
  • Zero External Dependencies - Self-contained implementation with no third-party runtime dependencies

Architecture Highlights

Built on a purely functional architecture with factory functions and immutable data structures. All parsing uses character-by-character state machines for predictable O(n) performance. The library integrates with @hyperfrontend/project-scope for virtual file system operations and @hyperfrontend/data-utils for deep comparison.

👉 See ARCHITECTURE.md for detailed design principles, data flow diagrams, and module composition.

Why Use @hyperfrontend/versioning?

Type-Safe Changelog Manipulation

Working with CHANGELOG.md files programmatically typically involves fragile string manipulation. This library parses changelogs into fully typed data structures with factory functions for creating entries, sections, and items. Modify changelog content with confidence using immutable operations and round-trip safely back to markdown.

Unified Versioning Primitives

Version management requires coordinating semver parsing, commit analysis, changelog generation, and registry queries. This library provides all these primitives in one cohesive package with consistent APIs. Query npm for published versions, parse commit history, calculate version bumps, and generate changelog entries — all composable into custom release workflows.

Zero-Dependency CI Integration

Designed for automated pipelines where minimal attack surface matters. Zero external runtime dependencies and state-machine parsing ensure predictable performance on any input. All parsers enforce input length limits to prevent resource exhaustion.

Installation

npm install @hyperfrontend/versioning

Quick Start

Parsing a Changelog

import { parseChangelog } from '@hyperfrontend/versioning'
import fs from 'fs'

// Parse existing changelog content
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
const changelog = parseChangelog(content)

// Access entries
for (const entry of changelog.entries) {
  console.log(`Version ${entry.version} - ${entry.date}`)
  for (const section of entry.sections) {
    console.log(`  ${section.heading}: ${section.items.length} changes`)
  }
}

// Access metadata
// Formats: 'keep-a-changelog' (https://keepachangelog.com), 'conventional', etc.
console.log(changelog.metadata.format)

Parsing Conventional Commits

import { parseConventionalCommit } from '@hyperfrontend/versioning'

const commit = parseConventionalCommit('feat(api): add user authentication')

console.log(commit.type) // 'feat'
console.log(commit.scope) // 'api'
console.log(commit.subject) // 'add user authentication'
console.log(commit.breaking) // false

Checking for Breaking Changes

import { parseConventionalCommit } from '@hyperfrontend/versioning'

// Breaking change via !
const commit1 = parseConventionalCommit('feat(api)!: remove deprecated endpoint')
console.log(commit1.breaking) // true

// Breaking change via footer
const commit2 = parseConventionalCommit(\`fix: update API response format

BREAKING CHANGE: Response structure has changed\`)
console.log(commit2.breaking) // true
console.log(commit2.breakingDescription) // 'Response structure has changed'

API Overview

Changelog Models

  • Changelog - Complete representation of a CHANGELOG.md file
  • ChangelogEntry - A single version entry with date and sections
  • ChangelogSection - A category of changes (Features, Bug Fixes, etc.)
  • ChangelogItem - An individual change with description and references

Commit Models

  • ConventionalCommit - Parsed conventional commit message
  • CommitType - Type constants (feat, fix, docs, etc.)
  • CommitFooter - Parsed footer/trailer from commit message

Parser Functions

  • parseChangelog(content: string) - Parse markdown changelog content
  • parseConventionalCommit(message: string) - Parse a commit message
  • tokenize(input: string) - Low-level tokenizer for changelog content

Module Documentation

Module Description Documentation
changelog/ Parse and manipulate CHANGELOG.md files README
commits/ Parse conventional commit messages README
semver/ Semantic version parsing and comparison README
registry/ npm registry client README
git/ Git operations abstraction README
workspace/ Project discovery and package.json README
flow/ Version release workflow orchestration README
repository/ Repository detection and compare URLs README

👉 See ARCHITECTURE.md for module composition diagrams and data flow.

Compatibility

Platform Support
Node.js
Browser

Output Formats

Format File Tree-Shakeable
ESM index.esm.js
CJS index.cjs.js

Security

All parsers use state-machine tokenization with O(n) complexity and enforce input length limits (commit messages: 10KB, changelog files: 1MB) to prevent resource exhaustion. Character-by-character parsing eliminates regex-based vulnerabilities.

Part of hyperfrontend

This library is part of the hyperfrontend monorepo.

📖 Full documentation

License

MIT

API Reference§

View:
Organized by entry point

Module Structure

|

36 modules · 1579 total exports

@hyperfrontend/versioning/@hyperfrontend/versioning

Version management toolkit with semver, changelog, git operations, and workspace coordination.

321 fn106 int33 type39 var

@hyperfrontend/versioning/@hyperfrontend/versioning/changelog

Comprehensive Keep-a-Changelog module with parsing, serialization, comparison, and operations.

84 fn26 int10 type5 var

@hyperfrontend/versioning/@hyperfrontend/versioning/changelog/compare

Changelog equality checks and diff utilities for comparing changelogs, entries, and sections.

15 fn6 int

@hyperfrontend/versioning/@hyperfrontend/versioning/changelog/models

Changelog data structures and factory functions for entries, sections, and items.

13 fn11 int2 type3 var

@hyperfrontend/versioning/@hyperfrontend/versioning/changelog/operations

Immutable changelog operations for adding, removing, filtering, merging, and transforming.

42 fn6 int7 type1 var

@hyperfrontend/versioning/@hyperfrontend/versioning/changelog/parse

Tokenizer and parser for converting Keep-a-Changelog markdown into structured objects.

6 fn1 int1 type

@hyperfrontend/versioning/@hyperfrontend/versioning/changelog/serialize

Serializers for converting Changelog objects to markdown strings or JSON.

8 fn2 int1 var

@hyperfrontend/versioning/@hyperfrontend/versioning/commits

Conventional commit parsing and classification with scope derivation and infrastructure matching.

35 fn14 int3 type10 var

@hyperfrontend/versioning/@hyperfrontend/versioning/commits/classify

Commit classification logic for matching commits to project scopes and infrastructure changes.

21 fn8 int2 type6 var

@hyperfrontend/versioning/@hyperfrontend/versioning/commits/models

Conventional commit types, factories, and semver bump derivation.

9 fn3 int1 type4 var

@hyperfrontend/versioning/@hyperfrontend/versioning/commits/parse

Conventional commit message parsing for headers, bodies, and footers.

5 fn3 int

@hyperfrontend/versioning/@hyperfrontend/versioning/flow

Version flow orchestration with step management, presets, and execution for release workflows.

44 fn12 int4 type14 var

@hyperfrontend/versioning/@hyperfrontend/versioning/flow/executor

Flow execution engine for running version flows with dry-run and validation support.

3 fn1 int

@hyperfrontend/versioning/@hyperfrontend/versioning/flow/models

Flow and step type definitions with factory functions and configuration builders.

15 fn11 int3 type2 var

@hyperfrontend/versioning/@hyperfrontend/versioning/flow/presets

Pre-configured release flows for conventional, independent, and synced release strategies.

10 fn3 var

@hyperfrontend/versioning/@hyperfrontend/versioning/flow/steps

Individual flow step implementations for registry fetch, commit analysis, and changelog generation.

12 fn9 var

@hyperfrontend/versioning/@hyperfrontend/versioning/git

Git operations and models for commits, tags, refs, logging, staging, and diff operations.

80 fn24 int6 type7 var

@hyperfrontend/versioning/@hyperfrontend/versioning/git/models

Git data models for commits, tags, and refs with factory functions and utilities.

25 fn7 int2 type

@hyperfrontend/versioning/@hyperfrontend/versioning/git/operations

Git shell command wrappers for log, tag, commit, staging, status, and diff operations.

54 fn15 int4 type6 var

@hyperfrontend/versioning/@hyperfrontend/versioning/registry

Package registry abstraction with NPM client, caching, and version/package info models.

7 fn7 int1 type

@hyperfrontend/versioning/@hyperfrontend/versioning/registry/models

Registry types and factories for registries, packages, versions, and maintainers.

2 fn5 int

@hyperfrontend/versioning/@hyperfrontend/versioning/registry/npm

NPM registry client with package escaping and in-memory caching.

4 fn2 int

@hyperfrontend/versioning/@hyperfrontend/versioning/repository

Repository configuration with platform detection, URL parsing, and compare URL generation.

14 fn7 int5 type2 var

@hyperfrontend/versioning/@hyperfrontend/versioning/repository/models

Repository types for platforms, resolutions, and configuration with factory functions.

8 fn3 int5 type2 var

@hyperfrontend/versioning/@hyperfrontend/versioning/repository/parse

Repository URL parsing and package.json inference utilities.

5 fn3 int

@hyperfrontend/versioning/@hyperfrontend/versioning/repository/url

Compare URL generation for building diff links between versions on supported platforms.

1 fn1 int

@hyperfrontend/versioning/@hyperfrontend/versioning/semver

Full semver implementation with parsing, comparison, incrementing, and formatting.

40 fn6 int2 type

@hyperfrontend/versioning/@hyperfrontend/versioning/semver/compare

Version comparison functions for equality, ordering, range satisfaction, and sorting.

15 fn

@hyperfrontend/versioning/@hyperfrontend/versioning/semver/format

Version formatting for converting semver objects to strings.

4 fn

@hyperfrontend/versioning/@hyperfrontend/versioning/semver/increment

Version bumping utilities for incrementing versions and calculating diffs.

3 fn

@hyperfrontend/versioning/@hyperfrontend/versioning/semver/models

Semver types for versions, ranges, comparators, and bump types with factory functions.

13 fn4 int2 type

@hyperfrontend/versioning/@hyperfrontend/versioning/semver/parse

Version and range parsing with strict and coercion modes.

5 fn2 int

@hyperfrontend/versioning/@hyperfrontend/versioning/workspace

Workspace management with package discovery, dependency graphs, and versioning coordination.

47 fn20 int4 type6 var

@hyperfrontend/versioning/@hyperfrontend/versioning/workspace/discovery

Package discovery, changelog finding, and dependency graph construction for monorepos.

17 fn5 int2 type1 var

@hyperfrontend/versioning/@hyperfrontend/versioning/workspace/models

Workspace types for configuration, projects, and query utilities.

19 fn4 int1 type3 var

@hyperfrontend/versioning/@hyperfrontend/versioning/workspace/operations

Workspace operations for cascade bumps, batch updates, and dependency reference management.

10 fn11 int1 type2 var

Related