Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/glenzli/semantic-version-lite

semantic version analyzer
https://github.com/glenzli/semantic-version-lite

Last synced: about 4 hours ago
JSON representation

semantic version analyzer

Awesome Lists containing this project

README

        

# semantic-version-lite
Sometimes we just need a tool to compute the next semantic version of packages without further operations. That's what `semantic-version-lite` for.

`semantic-version-lite` use version tag to compute next version, if version tag not found, version in **package.json** and the last commit changes the version is used as computation reference.

## Features
- Support stable version compute.
- Support pre-release version compute.
- Support version compute between pre-release and stable versions.
- Support pre-release version sorting: alpha -> beta -> rc.
- Support unstable version compute (v0.x.x). (NOTE: unstable version will never bump to stable, you have to update to v1.0.0 manually).

## Install
```
npm install semantic-version-lite
```

## Usage
```typescript
import { nextVersion } from 'semantic-version-lite';

export interface VersionOptions {
/* root dir to locate package.json */
packageRoot?: string;
/* pre-release type, like alpha/beta/rc */
preRelease?: string;
/* initial version to use if not previous version is find */
initialVersion?: string;
/* version bump from stable to pre-release, by default it's a major version bump */
preReleaseBumpDigit?: VersionDigit.Major | VersionDigit.Minor;
}

nextVersion(branchToCompute, versionOptions);
```