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

verup

v1.7.1

Published

Increment and update version in all project files (CLI)

Downloads

227

Readme

verup npm version

v1.7.1

Increment and update version in all project files.

Install

npm i --save-dev verup

For convenience, install it globally too:

npm i -g verup

Actually, it is not required to install verup if you have [email protected] and up.

Just run npx verup after you've added extra.verup field to package.json file.

Here is an example of what package.json might contain:

...
"scripts": {
  "verup": "verup",
  "build": "verup -- 1 && build.sh",
  "version": "verup 0" // this one gets called on `npm version <newver>` to patch other project files
},
"extra": {
  "verup": {
    "files": [...],
    "regs":[...]
  }
}
...

CLI

Now you can run:

npx verup 1       # to increment revision by 1 or
npx verup -2      # to decrement revision by 2 or
npx verup "1.0"   # to increment minor version by 1 or
npx verup "1.0.0" # to increment major version by 1

Or using npm in your project's root, when you have scripts.verup in package.json (see example above):

npm run verup -- 2    # to increment revision by 2 or
npm run verup -- -1   # to decrement revision by 1 or
npm run verup -- -1.0 # to decrement minor version by 1
npm version [<newver> | major | minor | patch | ...] --no-git-tag-version

When verup is installed globally, you could run it in the project folder like this:

verup 1
verup 1.0
verup -1.0

If you have subprojects, and want to avoid confusion as of which project to patch, use -n <projectName> option:

./node_modules/my-subproject/node_modules/verup -n 'main-project' -b 1.0

This will look for package.json with name == 'main-project' in all parent folders, until it finds the right level, and patch the files at that level.

In package.json

The minimum setup for your project is to add the list of file names that contain version string to package.json at extra.verup.files. Here is a sample:

...
"extra": {
  "verup": {
    "files": [
      "manifest.json",
      "index.js",
      "README.MD" ...
    ]
  }
}
...

If the file is a .json, version is expected to be at key version. Otherwise version string is searched line by line using a list of regular expressions. By default it would look for expressions like:

  • var version = 'x.x.x'
  • $version = 'x.x.x'
  • version := 'x.x.x'
  • @version x.x.x
  • const VERSION = 'x.x.x'
  • * vX.X.X

You can define you own list of regular expressions in package.json at extra.verup.regs:

...
"extra": {
  "verup": {
    "regs": [
      "((?:\\$|(?:\\s*\\*?\\s*@)|(?:^\\s*(?:var|,)?\\s+))ver(?:sion)?[\\s\\:='\"]+)([0-9]+(?:\\.[0-9]+){2,2})",
      "^(\\s*\\$(?:_)?version[\\s='\"]+)([0-9]+(?:\\.[0-9]+){2,2})",
      "^(\\s?\\*.*v)([0-9]+(?:\\.[0-9]+){2,2})"
    ]
  }
}
...

Related

Consider reading semver.