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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@origami-network/cli-step-version

v0.0.0

Published

Module that helps generate build and publish version.

Downloads

74

Readme

Build Status Coverage Status

Get Version

Helper command line tool to get version from the package.json file in the current working directory.

It can be used as continuous integration/delivery step to return versions to the pipeline.

Usage

The simple usage is to define custom script that will install and run the command at once.

In the package.json add new script:

{
    ...
    "scripts": {
        "cli-step-version": "npm install --no-save --silent @origami-network/cli-step-version && cli-step-version"
        ...
    }
    ...
}

Now it is possible to get version from command line.

> npm run cli-step-version

As the result the last two lines on the console will display version for:

  • build - including build number and branch that can be used to uniquely associate output with the build process.
  • publish - the version that should be used to publish artifacts in registries. Like node package to NPM registry.

This will allow to run the script without calling npm install before.

Parameters

It is possible to pass additional parameters to the script when calling npm run, by adding -- and the arguments of the script:

  • -n, --build-number <value> - sequential number, added as the last digit in the version number,
  • -b, --build-branch <name> - additional value indicating the branch or label for the version, added after eventual build number separated by "-" character.

In addition, fallowing informational parameters can be used:

  • -h, --help - output usage information,
  • -V, --version - output version of the script.

Examples

Command line

if the package.json has defined version 1.2.3, then calling fallowing command:

> npm run cli-step-version -- -build-number 10 -build-branch feature/new-function

Will provide two last line of the output:


1.2.3.10-feature-new-function
1.2.3

Jenkinsfile

For Windows slave node add fallowing code to Jenkinsfile.

def output = bat (
    script: "npm run cli-step-version -- --build-number ${env.BUILD_NUMBER} --build-branch ${env.BRANCH_NAME}",
    returnStdout: true
).tokenize().takeRight(2)
def version = [
    build: output.first(),
    publish: output.last()
]

On Un*x slave nodes bat step should be replaced with sh step.

By default Jenkins script policy do not allow methods takeRight and first. After first run they need to be accepted.