1.2.0 • Published 3 years ago

semantic-version-lite v1.2.0

Weekly downloads
10
License
MIT
Repository
github
Last release
3 years ago

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

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);
1.2.0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago