Nocturnal Pumpkin Maelstrom
Miss any of our Open RFC calls?Watch the recordings here! »

This package has been deprecated

Author message:

This package is no longer maintained. If you would like to use the functionality offered by this package, please consider publishing a fork of this package under your own npm scope.

shifted-semver-increment

2.0.13 • Public • Published

shifted-semver-increment

Support major version zero incrementing alongside existing semver package behavior.

shifted-semver-increment supports a different incrementing behavior then the semver package when the major version, the first number in major.minor.patch, of a semantic version string, is zero.

When using the standard semver package, a major version zero is treated the same as a any other value for the major version. For example, incrementing a minor for 0.0.0 will increment the middle number by one, just as it would if the initial version had been 1.0.0.

With shifted-semver-increment, incrementing the major version will increment what is traditionally the minor number in the semantic version string, while incrementing the minor or patch version will increment the patch number in the semantic version string.

When the major version is greater than zero, shifted-semver-increment will defer to the inc function provided by the semver package.

Table of Contents

Installation

To install the shifted-semver-increment tool for use in your project please run the following command:

yarn add [--dev] shifted-semver-increment

Usage

const shiftedSemver = require(`shifted-semver-increment`);
 
// When using a version with the major version set to zero.
shiftedSemver(`0.0.0`, `patch`); // `0.0.1`
shiftedSemver(`0.0.0`, `minor`); // `0.0.1`
shiftedSemver(`0.0.0`, `major`); // `0.1.0`
 
// When using a version with the major version greater than zero.
shiftedSemver(`1.0.0`, `patch`); // `1.0.1`
shiftedSemver(`1.0.0`, `minor`); // `1.1.0`
shiftedSemver(`1.0.0`, `major`); // `2.0.0`

By shifting the use of each number developers can continue to use semantic concepts such as releasing breaking changes in a major release, but remain in a pre-1.0.0 release stage (The pre-release stage means the project does not have a stable, publicly consumable, API according to Semantic Versioning 2.0.0).

shifted-semver-increment also supports Prerelease Identifiers for major version zero releases.

const shiftedSemver = require(`shifted-semver-increment`);
 
// When using version with the major version set to zero.
shiftedSemver(`0.0.0`, `prerelease`, `beta`); // `0.0.1-beta.0`
shiftedSemver(`0.0.0`, `prepatch`, `beta`); // `0.0.1-beta.0`
shiftedSemver(`0.0.0`, `preminor`, `beta`); // `0.0.1-beta.0`
shiftedSemver(`0.0.0`, `premajor`, `beta`); // `0.1.0-beta.0`
shiftedSemver(`0.1.0-beta.0`, `prerelease`, `beta`); // `0.1.0-beta.1`
shiftedSemver(`0.1.0-beta.0`, `prepatch`, `beta`); // `0.1.1-beta.0`
shiftedSemver(`0.1.0-beta.0`, `preminor`, `beta`); // `0.1.1-beta.0`
shiftedSemver(`0.1.0-beta.0`, `premajor`, `beta`); // `0.2.0-beta.0`
 
// When using a version with the major version greater than zero.
shiftedSemver(`1.0.0`, `prerelease`, `beta`); // `1.0.1-beta.0`
shiftedSemver(`1.0.0`, `prepatch`, `beta`); // `1.0.1-beta.0`
shiftedSemver(`1.0.0`, `preminor`, `beta`); // `1.1.0-beta.`
shiftedSemver(`1.0.0`, `premajor`, `beta`); // `2.0.0-beta.0`

Debugging

To assist users of shifted-semver-increment with debugging the behavior of this module we use the debug utility package to print information to the console. To enable debug message printing, the environment variable DEBUG, which is the variable used by the debug package, must be set to a value configured by the package containing the debug messages to be printed.

To print debug messages on a unix system set the environment variable DEBUG with the name of this package prior to executing a tool that invokes this module:

DEBUG=shifted-semver-increment [CONSUMING TOOL]

On the Windows command line you may do:

set DEBUG=shifted-semver-increment
[CONSUMING TOOL]

Node Support Policy

We only support Long-Term Support versions of Node.

We specifically limit our support to LTS versions of Node, not because this package won't work on other versions, but because we have a limited amount of time, and supporting LTS offers the greatest return on that investment.

It's possible this package will work correctly on newer versions of Node. It may even be possible to use this package on older versions of Node, though that's more unlikely as we'll make every effort to take advantage of features available in the oldest LTS version we support.

As each Node LTS version reaches its end-of-life we will remove that version from the node engines property of our package's package.json file. Removing a Node version is considered a breaking change and will entail the publishing of a new major version of this package. We will not accept any requests to support an end-of-life version of Node. Any merge requests or issues supporting an end-of-life version of Node will be closed.

We will accept code that allows this package to run on newer, non-LTS, versions of Node. Furthermore, we will attempt to ensure our own changes work on the latest version of Node. To help in that commitment, our continuous integration setup runs against all LTS versions of Node in addition the most recent Node release; called current.

JavaScript package managers should allow you to install this package with any version of Node, with, at most, a warning if your version of Node does not fall within the range specified by our node engines property. If you encounter issues installing this package, please report the issue to your package manager.

Contributing

Please read our contributing guide to see how you may contribute to this project.

Install

npm i shifted-semver-increment

DownloadsWeekly Downloads

993

Version

2.0.13

License

Apache-2.0

Unpacked Size

20.1 kB

Total Files

4

Last publish

Collaborators

  • avatar