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

eh-bumpversion

v1.2.5

Published

Bump version number across an entire codebase

Downloads

9

Readme

eh-bumpversion

Updates (bumps) the version key in the local package.json AND wherever else it occurs in the files you specify. Adheres to a subset of Semantic Versioning.

Version License Downloads oclif

Why?

I often need the version number in contexts in addition to package.json, such as README.md or (for example) the footer of a static HTML file.

Shout out to bumpytrack for the inspiration.

Usage

We install an alias, ehbump for the "official" eh-bumpversion command as of version 1.2.0.

Without any parameters, running eh-bumpversion will increment the last version component, meaning "patch".

$ eh-bumpversion
Bumping version from 1.2.3 to 1.2.4

Unless you're on an -alpha, -beta or -rc version, then the "revision" of that level.

$ eh-bumpversion
Bumping version from 1.2.3-alpha.4 to 1.2.3-alpha.5

If you provide one of major, minor, patch as the first argument, it will update that component

$ eh-bumpversion major
Bumping version from 1.2.3 to 2.0.0
$ eh-bumpversion minor
Bumping version from 1.2.3 to 1.3.0
$ eh-bumpversion patch
Bumping version from 1.2.3 to 1.2.4

If you provide alpha, beta or rc, and you're not on one of those already, it moves you there. You can provide major, minor (the deault) or patch as the second argument to tell it which component to update.

$ eh-bumpversion alpha major
Bumping version from 1.2.3 to 2.0.0-alpha.0
$ eh-bumpversion beta minor
Bumping version from 1.2.3 to 1.3.0-beta.0
$ eh-bumpversion rc patch
Bumping version from 1.2.3 to 1.2.4-rc.0

You can go from alpha to beta or rc, or from beta to rc, but not the other way.

$ eh-bumpversion rc
Bumping version from 1.3.0-beta.5 to 1.3.0-rc.0

Finally, if you're in an alpha, beta or rc version, you can move to the "release" version with, you guessed it:

$ eh-bumpversion release
Bumping version from 1.3.0-beta.4 to 1.3.0

Command Line Flags

Long Flag |Short Flag | Effect -- | -- | -- --dry-run |-d | don't change anything, just describe what would happen --force=version |-f | force the version. Overrides arguments --help |-h | show help --quiet |-q | don't output anything, just get on with it --version |-v | show version --init | | init the ehVersioner configuration key in package.json. Just that and nothing more. --no-commit | | don't commit changes --no-push | | don't push changes --no-tag | | don't tag the commit and push the tag

Installation

$ npm install -g eh-bumpversion
... lots of stuff happens here ...
$ eh-bumpversion --version
eh-bumpversion/1.2.3 win32-x64 node-v12.13.1

Note that the configuration below will keep this section up to date with the current version of this package. 😃

Configuration

Configuration lives in package.json under the ehVersioner key:

{
  "ehVersioner": {
    "targets": [
      {
        "comment": "target a (possibly nested) key in a JSON file. This line is instructive, not functional",
        "file": "some-file.json",
        "key": "software.version.key"
      },
      {
        "comment": "target a string in file. This line is instructive, not functional",
        "file": "README.md",
        "search": "eh-bumpversion/{{version}} win32-x64 node-v12.13.1"
      },
      {
        "file": "site/template/footer.inc.html",
        "search": "<p>Site Version {{version}}</p>"
      }
    ]
  }
}

Each file is searched for the corresponding search phrase with the current version, OR for JSON files the indicated key. When found the search text or key is replaced with the NEW version. If the search fails, you get a warning.

(Maybe) To Do

These are things I think would be good for a general-purpose tool, but which I don't particularly need.

  • Add defaults for the command-line flags to the configuration, so you don't have to specify non-default options all the time.
  • Set defaults for the command-line arguments to the configuration (if you don't want "patch" for example).
  • Make the git phase respect --quiet.
  • Add a --verbose mode