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 🙏

© 2025 – Pkg Stats / Ryan Hefner

use-pkg-version

v0.1.9

Published

Update any static file with the version number from the package.json file

Readme

Build Status Coverage Status Greenkeeper badge NPM version Vue 2 Vue CLI 3 Commitizen friendly Contributions welcome Hit count License MIT

Update any static file with the version number from the package.json file.

Ever had the problem that you have a version number in a static file that needs to be updated when a new version is released? This module is intended for this use case. I use it for example with the _coverpage.md of docsify and the version number in this README.md file.

Installation

Global

Install as a globally available CLI tool using npm:

npm install --global use-pkg-version

Or install using yarn:

yarn global add use-pkg-version

Local

Install as a devDependency using npm:

npm install --save-dev use-pkg-version

Or install using yarn:

yarn add --dev use-pkg-version

The following entry will be added to the devDependencies section in the package.json file.

{
  "devDependencies": {
    "use-pkg-version": "^0.1.8"
  }
}

Add the following entry to the scripts section in the package.json file:

{
  "scripts": {
    "upd-version": "use-pkg-version"
  }
}

Now you can run npm run build:upd-version from the command line. You can pass it arguments using double dashes (--), e.g. npm run build:upd-version -- info.

Go to Table of Contents

Usage

Minimum configuration

The easiest way to use this module is adding it as a prebuild script in the package.json file. The following example demonstrates how to run use-pkg-version when before the build process starts. It uses sane defaults, if no package.json file is specified it assumes the package.json is in the current directory.

{
  "scripts": {
    "prebuild": "use-pkg-version update --search-for "^[0-9].[0-9].[0-9]" --replace-with "^{{version}}" README.md",
    "build": "<your-build-command>"
  }
}

You can call this script directly by executing npm run prebuild or yarn prebuild.

Go to Table of Contents

Using a configuration file

You can also use a configuration file instead of passing options as commandline arguments. Change the script to the following.

{
  "scripts": {
    "prebuild": "use-pkg-version update README.md",
    "build": "<your-build-command>"
  }
}

Create a .use-pkg-versionrc.json file with the following configuration object.

{
  "search-for": "\\^[0-9].[0-9].[0-9]",
  "replace-with": "^{{version}}"
}

IMPORTANT Commandline options overrule settings in the configuration object.

The configuration can be a configuration object specified in one of the following ways.

  1. A use-pkg-version section to the package.json file
{
  "use-pkg-version": {
    "search-for": "\\^[0-9].[0-9].[0-9]",
    "replace-with": "^{{version}}"
  }
}
  1. A .use-pkg-versionrc file with JSON or YAML syntax
  2. A .use-pkg-versionrc.json file
  3. A .use-pkg-versionrc.yaml, .use-pkg-versionrc.yml or .use-pkg-versionrc.js file
  4. A .use-pkg-versionrc.config.js file

Files must be located in the root directory of the project. The order specified is the order the configuration will be looked for, the first match is used.

If the configuration file has a name that does not match the above, then you can use the `-c to specify it.

The names of the configuration object properties are the same as the commandline options.

Go to Table of Contents

Other options

  • --help: Using npm run build:upd-version -- --help will list the available commands.

  • <command> --help: Using npm run build:upd-version -- <command> --help will display information about the specified command and its options.

  • info: Using npm run build:upd-version -- info will display information about your operating system and other environment information that is useful if you need to submit an issue.

Go to Table of Contents

Roadmap

Currently there is nothing on the roadmap. Suggestions? Please submit an issue.

Go to Table of Contents

Contributing

We welcome pull requests! What follows is the simplified version of the contribution process, please read here to fully understand our contribution policy and here to understand our code of conduct.

  1. Fork the repository here!
  2. Create your feature branch: git checkout -b my-new-feature
  3. If relevant, don't forget to add your tests
  4. Commit your changes: npm run commit
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request :-)

Go to Table of Contents

Support & brag about us

If you like this project, please support us by starring ⭐ this repository. Thx!

Please let the world know about us! Brag about us using Twitter, email, blog, Discord, Slack, forums, etc. etc. Thx!

Go to Table of Contents

Author

nidkil © nidkil, released under the MIT license. Authored and maintained by nidkil with help from contributors.

Website · GitHub @nidkil · Twitter @nidkil