@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.
- Works seamlessly with @hyperfrontend/project-scope for virtual file system operations
- Looking for cryptographic utilities? See @hyperfrontend/cryptography
License
API Reference§
Module Structure
36 modules · 1579 total exports
@hyperfrontend/versioning/@hyperfrontend/versioning
Version management toolkit with semver, changelog, git operations, and workspace coordination.
@hyperfrontend/versioning/@hyperfrontend/versioning/changelog
Comprehensive Keep-a-Changelog module with parsing, serialization, comparison, and operations.
@hyperfrontend/versioning/@hyperfrontend/versioning/changelog/compare
Changelog equality checks and diff utilities for comparing changelogs, entries, and sections.
@hyperfrontend/versioning/@hyperfrontend/versioning/changelog/models
Changelog data structures and factory functions for entries, sections, and items.
@hyperfrontend/versioning/@hyperfrontend/versioning/changelog/operations
Immutable changelog operations for adding, removing, filtering, merging, and transforming.
@hyperfrontend/versioning/@hyperfrontend/versioning/changelog/parse
Tokenizer and parser for converting Keep-a-Changelog markdown into structured objects.
@hyperfrontend/versioning/@hyperfrontend/versioning/changelog/serialize
Serializers for converting Changelog objects to markdown strings or JSON.
@hyperfrontend/versioning/@hyperfrontend/versioning/commits
Conventional commit parsing and classification with scope derivation and infrastructure matching.
@hyperfrontend/versioning/@hyperfrontend/versioning/commits/classify
Commit classification logic for matching commits to project scopes and infrastructure changes.
@hyperfrontend/versioning/@hyperfrontend/versioning/commits/models
Conventional commit types, factories, and semver bump derivation.
@hyperfrontend/versioning/@hyperfrontend/versioning/commits/parse
Conventional commit message parsing for headers, bodies, and footers.
@hyperfrontend/versioning/@hyperfrontend/versioning/flow
Version flow orchestration with step management, presets, and execution for release workflows.
@hyperfrontend/versioning/@hyperfrontend/versioning/flow/executor
Flow execution engine for running version flows with dry-run and validation support.
@hyperfrontend/versioning/@hyperfrontend/versioning/flow/models
Flow and step type definitions with factory functions and configuration builders.
@hyperfrontend/versioning/@hyperfrontend/versioning/flow/presets
Pre-configured release flows for conventional, independent, and synced release strategies.
@hyperfrontend/versioning/@hyperfrontend/versioning/flow/steps
Individual flow step implementations for registry fetch, commit analysis, and changelog generation.
@hyperfrontend/versioning/@hyperfrontend/versioning/git
Git operations and models for commits, tags, refs, logging, staging, and diff operations.
@hyperfrontend/versioning/@hyperfrontend/versioning/git/models
Git data models for commits, tags, and refs with factory functions and utilities.
@hyperfrontend/versioning/@hyperfrontend/versioning/git/operations
Git shell command wrappers for log, tag, commit, staging, status, and diff operations.
@hyperfrontend/versioning/@hyperfrontend/versioning/registry
Package registry abstraction with NPM client, caching, and version/package info models.
@hyperfrontend/versioning/@hyperfrontend/versioning/registry/models
Registry types and factories for registries, packages, versions, and maintainers.
@hyperfrontend/versioning/@hyperfrontend/versioning/registry/npm
NPM registry client with package escaping and in-memory caching.
@hyperfrontend/versioning/@hyperfrontend/versioning/repository
Repository configuration with platform detection, URL parsing, and compare URL generation.
@hyperfrontend/versioning/@hyperfrontend/versioning/repository/models
Repository types for platforms, resolutions, and configuration with factory functions.
@hyperfrontend/versioning/@hyperfrontend/versioning/repository/parse
Repository URL parsing and package.json inference utilities.
@hyperfrontend/versioning/@hyperfrontend/versioning/repository/url
Compare URL generation for building diff links between versions on supported platforms.
@hyperfrontend/versioning/@hyperfrontend/versioning/semver
Full semver implementation with parsing, comparison, incrementing, and formatting.
@hyperfrontend/versioning/@hyperfrontend/versioning/semver/compare
Version comparison functions for equality, ordering, range satisfaction, and sorting.
@hyperfrontend/versioning/@hyperfrontend/versioning/semver/format
Version formatting for converting semver objects to strings.
@hyperfrontend/versioning/@hyperfrontend/versioning/semver/increment
Version bumping utilities for incrementing versions and calculating diffs.
@hyperfrontend/versioning/@hyperfrontend/versioning/semver/models
Semver types for versions, ranges, comparators, and bump types with factory functions.
@hyperfrontend/versioning/@hyperfrontend/versioning/semver/parse
Version and range parsing with strict and coercion modes.
@hyperfrontend/versioning/@hyperfrontend/versioning/workspace
Workspace management with package discovery, dependency graphs, and versioning coordination.
@hyperfrontend/versioning/@hyperfrontend/versioning/workspace/discovery
Package discovery, changelog finding, and dependency graph construction for monorepos.
@hyperfrontend/versioning/@hyperfrontend/versioning/workspace/models
Workspace types for configuration, projects, and query utilities.
@hyperfrontend/versioning/@hyperfrontend/versioning/workspace/operations
Workspace operations for cascade bumps, batch updates, and dependency reference management.