@skypilot/versioner
TypeScript icon, indicating that this package has built-in type declarations

1.3.9 • Public • Published

@skypilot/versioner

npm stable stable build npm next next build Codacy grade downloads license: ISC

A collection of functions and classes for managing version numbers.

Installation

$ yarn add @skypilot/versioner
# or
$ npm install @skypilot/versioner

Basic usage

TypeScript

import { bumpVersion, ChangeLevel } from '@skypilot/versioner';

bumpVersion(
  version: string,
  changeLevel: ChangeLevel,
  channel?: string,
  previousVersions?: string[]
)

TypeScript examples

bumpVersion('1.0.1', ChangeLevel.patch)
// '1.0.2'

bumpVersion('1.0.1', ChangeLevel.minor)
// '1.1.0'

bumpVersion('1.0.1', ChangeLevel.major)
// '2.0.0'

bumpVersion('1.0.1', ChangeLevel.minor, 'alpha')
// '1.1.0-alpha.0'

bumpVersion('1.0.1', ChangeLevel.minor, 'alpha', ['1.1.0-alpha.1', '1.1.0-alpha.2'])
// '1.1.0-alpha.3'

ES6

import { bumpVersion } from '@skypilot/versioner';

bumpVersion(
  version, // string
  changeLevel, // 'major' | 'minor' | 'patch' | 'fix'
  channel, // [optional] string
  previousVersions // [optional] string[]
)

ES6 examples

bumpVersion('1.0.1', 'patch')
// '1.0.2'

bumpVersion('1.0.1', 'minor')
// '1.1.0'

bumpVersion('1.0.1', 'major')
// '2.0.0'

bumpVersion('1.0.1', 'minor', 'alpha')
// '1.1.0-alpha.0'

bumpVersion('1.0.1', 'minor', 'alpha', ['1.1.0-alpha.1', '1.1.0-alpha.2'])
// '1.1.0-alpha.3'

Advanced usage

The library exposes the following exports:

Classes

  • PrereleaseVersion
  • ReleaseVersion

Constants & enums

  • ChangeLevel

Functions

  • parseChangeLevel(changeLevel: string): ChangeLevel

TODO: Document class and function API.

Package Sidebar

Install

npm i @skypilot/versioner

Weekly Downloads

9

Version

1.3.9

License

ISC

Unpacked Size

35.4 kB

Total Files

24

Last publish

Collaborators

  • williamthorsen