Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/glenzli/semantic-version-lite
- Owner: glenzli
- License: mit
- Created: 2021-01-07T12:54:59.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-30T02:22:11.000Z (almost 4 years ago)
- Last Synced: 2024-10-31T17:36:24.274Z (17 days ago)
- Language: TypeScript
- Size: 33.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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);
```