npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

autovs-scripts

v1.0.0-beta.3

Published

Diassoft Auto Versioning Script

Downloads

13

Readme

Automatic Versioning Scripts

Build Status NPM Version NPM Downloads

A node.js package that contains functions to manage versions.

Installation

npm install autovs-scripts

Usage

After you have installed the autovs-scripts, you can use it on your code. Follow the code below.

// Initialize the versions component
const versions = require('autovs-scripts');

// Create a version object based on the given string
var myVersion = versions.parseVersion('v1.2.3-alpha.1+001250');

console.log(`Current major is: ${myVersion.major}`);
// Current major is: 1

console.log(`Current firm version is: ${myVersion.firmVersion().formattedVersion()}`);
// Current firm version is: v1.2.3

// Bump version
var myBumpedVersion = versions.bumpVersion('v1.2.3-alpha.1+001250', 'major', 2000);

console.log(`Bumped version is: ${myBumpedVersion.formattedVersion()}`);
// Bumped version is: v2.0.0-alpha.1+002000

The versions object will expose the following methods:

| Method | Description | | :-- | :-- | | parseVersion() | Parses a string into a version object | | bumpVersion() | Bump the given version to the next level | | newVersionObject() | Creates a version object based on the given input |

Version Object

Both parseVersion() and bumpVersion() return a version object. This object is composed of the following members:

| Member | Description | | :-- | :-- | | major | The version major | | minor | The version minor | | patch | The version patch | | preReleaseIdentifier | The pre-release identifier (alpha, beta, rc) | | preReleaseVersion | The pre-release version | | preReleaseBuild | The build number (only for pre-releases) |
| formattedVersion() | Returns the formatted version (Example: v1.2.0-alpha.1+001210) | | firmVersion() | Returns the firm version (Example: for v1.2.0-alpha.1+001210, this method will return v1.2.0) |

You can manually create a Version Object by calling the newVersionObject().

Parse Version - parseVersion()

The parseVersion() method will convert a string into a Version Object.

Input Parameters

| name | required | description | | :-- | :--: | :-- | | version | yes | A string containing the version to be parsed. Example v1.2.0-alpha.1+001210. |

Output

The function returns a Version Object containing the individual components of a version.

Bump Version - bumpVersion()

The bumpVersion() method will move the current version into the next level, and return a Version Object.

Input Parameters

| name | required | description | | :-- | :--: | :-- | | currentVersion | yes | A string containing the current version to be bumped. Example v1.2.0-alpha.1+001210. | | level | yes | The level that needs to be bumped for the version. Valid values are: major, minor, patch, prerelease-identifier, prerelease-version. | | buildNumber | no | A number representing the build number to be added to the end of the version. |

Output

The function returns a Version Object containing the bumped version.