Official Semantic Versioning Parser and Validator for VTubers.TV services. This package provides a robust implementation of SemVer 2.0.0 with VTubers.TV-specific extensions for version management.
- π― Full SemVer 2.0.0 specification compliance
- π§ Custom theme-based versioning system
- π‘οΈ Strict version validation
- π¦ Zero dependencies
- π Well-documented API
- β¨ Public version mapping support
- π Version comparison and increment utilities
- π₯οΈ Command-line interface (CLI)
Since this is an internal package, install it directly from the GitHub repository:
# Using npm
# Install globally to use the CLI
npm install -g git://github.com/vtuberstv/semver.git
# or locally as a dependency
npm install git://github.com/vtuberstv/semver.git
# Using Yarn
# Install globally to use the CLI
yarn global add git://github.com/vtuberstv/semver.git
# or locally as a dependency
yarn add git://github.com/vtuberstv/semver.git
# Using pnpm
# Install globally to use the CLI
pnpm add -g git://github.com/vtuberstv/semver.git
# or locally as a dependency
pnpm add git://github.com/vtuberstv/semver.git
import SemVer from '@vtubers.tv/semver'
// Parse and validate versions
const version = SemVer.parse('1.2.3-beta.1+build.123')
console.log(version)
// {
// major: 1,
// minor: 2,
// patch: 3,
// prerelease: ['beta', '1'],
// buildMetadata: 'build.123'
// }
// Parse public versions
const publicVer = SemVer.parsePublicVersion('Aurora-1.0-beta')
console.log(publicVer)
// {
// theme: 'Aurora',
// version: '1.0',
// status: 'beta'
// }
// Compare versions
console.log(SemVer.compare('1.2.0', '1.1.9')) // 1
console.log(SemVer.compare('1.1.0', '1.1.0')) // 0
console.log(SemVer.compare('1.0.0-alpha', '1.0.0')) // -1
// Increment versions
console.log(SemVer.increment('1.2.3', 'minor')) // '1.3.0'
console.log(SemVer.increment('1.2.3', 'major', 'alpha')) // '2.0.0-alpha'
The package includes a command-line interface for common version management tasks:
# Validate versions (both semantic and public)
semver validate 1.0.0
semver validate Aurora-1.0-beta
# Compare two versions
semver compare 1.0.0 2.0.0
semver compare 1.0.0-alpha 1.0.0-beta
# Increment versions
semver increment 1.0.0 major
semver increment 1.0.0 minor --pre=beta
semver increment 1.0.0 patch --build=20240301
# Show help
semver --help
semver <command> --help
Available Commands:
validate <version>
- Validate a semantic or public version stringcompare <version1> <version2>
- Compare two version stringsincrement <version> (major|minor|patch) [--pre=alpha] [--build=001]
- Increment a version number
The package includes comprehensive documentation for all features:
- Getting Started - Basic usage and concepts
- Version Parsing - Detailed parsing rules
- Public Versions - Theme-based versioning system
- Version Comparison - Comparison rules and examples
- Version Mapping - Internal to public version mapping
- API Reference - Complete API documentation
- CLI Guide - Command-line interface documentation
See the full documentation for detailed examples and usage guidelines.
parse(version: string): Version
- Parse a SemVer stringparsePublicVersion(version: string): PublicVersion
- Parse a public version stringisValid(version: string): boolean
- Validate a SemVer stringisValidPublicVersion(version: string): boolean
- Validate a public version stringcompare(v1: string, v2: string): number
- Compare two versionsincrement(version: string, type: 'major' | 'minor' | 'patch'): string
- Increment a version
createVersionMapping(internal: string, public: string, date: string): VersionMapping
getVersionData(publicVersion: string): PublicVersionData
getLatestStableVersion(): PublicVersionData
- TypeScript >= 4.5
- Node.js >= 16.0.0
- Fork the repository
- Create your feature branch
- Add your changes and tests
- Update documentation
- Submit a pull request
This project is licensed under the AGPL-3.0 License and the VTubers.TV Commercial License (VCL) v1.0. See the LICENSE and LICENSE-VCL file for details.
For support, please open an issue in the GitHub repository.