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

raise-version

v0.5.0

Published

Update and commit package version for Gitflow workflow

Downloads

258

Readme

node-raise-version

NPM version CircleCI codecov Downloads/month License

Update and commit package version for Gitflow workflow.

Why

This package makes bumping package version according to semantic versioning easier when using Gitflow workflow just by running a single CLI command. It does the following things automatically:

  • Bump version in package.json in development branch (say, make a patch update from 0.3.2 to 0.4.0).

  • Add release header with updated version and date in text changelog file:

    ## 0.4.0 (2020-12-14)
  • Commit changes in package.json and text changelog file with a message that looks like:

    Raise version: 0.4.0
  • Merge changes to release branch and tag them as 0.4.0.

  • Push local development branch, release branch and new tags to remote repository.

All the things mentioned above are configurable. The package can also be used for centralized workflow.

Before

After

Installation

npm install raise-version --save-dev

or

yarn add raise-version --dev

CLI usage

  1. Initialize raise-version from the root directory of your project (optional — if missed then default configuration will be used):

    • if installed globally:

      raise-version init
    • if installed locally:

      npx raise-version init

    .raiseverrc configuration file will be created.

    raisever is an alias for raise-version CLI command.

  2. Adjust configuration parameters in .raiseverrc, these are default values:

    {
      "changelog": {
        "enabled": true,
        "path": "CHANGELOG.md",
        "encoding": "utf-8",
        "prefix": "##",
        "bullet": "-"
      },
      "git": {
        "enabled": true,
        "release": "master",
        "development": "develop",
        "remote": "origin",
        "commit": true,
        "merge": true,
        "all": false,
        "tag": true,
        "push": false
      }
    }

    They correspond to options of console command:

    • -l, --changelog Update version in changelog file [boolean] [default: true]
    • -f, --changelog-path Path to changelog file [string] [default: "CHANGELOG.md"]
    • -e, --changelog-encoding Encoding of changelog file [string] [default: "utf-8"]
    • -h, --changelog-prefix Prefix for version header in changelog file [string] [default: "##"]
    • -b, --changelog-bullet Bullet character for changes' item in changelog file [string] [default: "-"]
    • -g, --git Commit updates to git [boolean] [default: true]
    • -r, --git-release Git release branch [string] [default: "master"]
    • -d, --git-development Git development branch [string] [default: "develop"]
    • -o, --git-remote Git remote repository name [string] [default: "origin"]
    • -c, --git-commit Commit changes to development branch [boolean] [default: true]
    • -m, --git-merge Merge changes to release branch [boolean] [default: true]
    • -a, --git-all Commit all changes [boolean] [default: false]
    • -t, --git-tag Create git tag [boolean] [default: true]
    • -p, --git-push Push git changes to remote repository [boolean] [default: false]

    More CLI options:

    -s, --skip-update Don't update package.json file

    In order to use raise-version with centralized workflow just set a value of development branch equal to release branch (master). git.merge parameter and --git-merge CLI option make no sense in this case.

  3. Make changes to your source code, describe them in changelog file (if used) and raise a version:

    raise-version [release] [options]
    • release — semver part to update, one of the following: major, minor, patch;
    • options — CLI options overwriting configuration from .raiseverrc.

Examples

Basic usage examples used below considers that .raiseverrc has default configuration (or not created):

  • Update patch version in package.json, make new version and release date heading in CHANGELOG.md prepended with ## (list items of changes are already prepended by -):

    raise-version patch

    Before

    package.json

    {
      "name": "my-package",
      "vesion": "1.0.0"
    }

    CHANGELOG.md

    # Changelog
     
    - New feature is implemented.
    - Some bugs are fixed.
      
    ## 1.0.0 (2020-12-07)
     
    - Initial release.

    After

    package.json

    {
      "name": "my-package",
      "vesion": "1.0.1"
    }

    CHANGELOG.md

    # Changelog
     
    ## 1.0.1 (2020-12-10)
     
    - New feature is implemented.
    - Some bugs are fixed.
      
    ## 1.0.0 (2020-12-07)
     
    - Initial release.
  1. The same as previous but also push commits to remote repository:

    raise-version patch --git-push
  2. Don't update version in package.json and CHANGELOG.md, don't commit but merge from development branch to release branch and push changes to remote repository:

    raise-version --skip-update --changelog=false --git-commit=false --git-push
  3. Don't update, don't commit and don't merge anything, just push to remote repository only:

    raise-version --skip-update --changelog=false --git-commit=false --git-merge=false --git-push

Programmatic usage

const raiseVersion = require('raise-version');
raiseVersion({
  release: 'patch',
  git: {
    push: true
  }
}).catch(function(e) {
  console.error('Something went wrong');
});