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

@release-it/bumper

v6.0.1

Published

Version read/write plugin for release-it

Downloads

92,512

Readme

Version read/write plugin for release-it

This plugin reads and/or writes version/manifest files.

npm install --save-dev @release-it/bumper

In release-it config:

"plugins": {
  "@release-it/bumper": {
    "in": "composer.json",
    "out": "composer.json",
  }
}
  • Use only the in option to read the version from this file in the release-it process.
  • Use only the out option to write the version that was determined by release-it to this file.
  • Use both to read and write the version property from/to this file.

The version from the in file will take precedence over the latest Git tag (and the version from package.json if it exists) in release-it to determine the latest version.

Note that using package.json as out file may conflict with the npm plugin in release-it. Remove it from the out file(s), or use --npm.allowSameVersion.

The supported file types are:

| Type | Extension(s) | Mime-type | | ---- | ----------------- | ----------------------------------- | | JSON | .json | application/json | | YAML | .yaml or .yml | text/yaml or application-x-yaml | | TOML | .toml | text/toml or application/toml | | INI | .ini | text/x-properties | | TEXT | .txt | text/* |

Explicitly providing the (mime) type takes precedence over the file extension.

The fallback type is text if the file extension and/or type is not known (e.g. index.php).

"plugins": {
  "@release-it/bumper": {
    "in": {
      "file": "VERSION",
      "type": "text/plain"
    },
    "out": {
      "file": "VERSION",
      "type": "text/plain"
    }
  }
}

To replace all occurences of the current version with the new version in any text file:

"plugins": {
  "@release-it/bumper": {
    "out": {
      "file": "file.php",
      "type": "text/php"
    }
  }
}

:warning: the operation is a search-and-replace; if the current version is not found in the file, the new version cannot be written out.

To instead always consume the entire file, that is, the whole and only content of the file is the version number, set consumeWholeFile: true for the out option:

"plugins": {
  "@release-it/bumper": {
    "out": {
      "file": "VERSION",
      "type": "text/plain",
      "consumeWholeFile": true
    }
  }
}

The version number is then written to the output file, overwriting it completely instead of a search-and-replace.

:bulb: Setting consumeWholeFile: true precludes the use of prefixes, such as v1.0.1 in the output file.

The out option can also be an array of files:

"plugins": {
  "@release-it/bumper": {
    "out": ["manifest.json", "bower.json"]
  }
}

The out option is parsed with fast-glob, so glob patterns can be used to match files to write to:

"plugins": {
  "@release-it/bumper": {
    "out": "dist/*.json"
  }
}

The path option (default: "version") can be used to change a different property. The following example will set the current.version property to the new version in manifest.json:

"plugins": {
  "@release-it/bumper": {
    "out": {
      "file": "manifest.json",
      "path": "current.version"
    }
  }
}

Multiple paths can be provided using an array.

The versionPrefix option (default: '') can be used in cases where you'd like to maintain a specific prefix for your version number (for example, in package.json where you might want versions like ^1.0.0). This will prepend the specified prefix to the bumped version:

"plugins": {
  "@release-it/bumper": {
    "out": {
      "file": "package.json",
      "path": "version",
      "prefix": "^"
    }
  }
}

With the above configuration, if release-it determines the new version to be 1.0.0, it'll be saved as ^1.0.0 in the targeted file.

Command-line

Options for this plugin can be set from the command line. Some examples:

release-it --plugins.@release-it/bumper.in=composer.json
release-it --plugins.@release-it/bumper.out=composer.json --plugins.@release-it/bumper.out=manifest.json
  • Keys are separated by dots.
  • Values can be negated by prefixing the key with no-.
  • Arguments may need to be single-quoted (') such as --'deep.key=value' or '--deep.key=value'

Depending on your shell or OS this may differ.