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

grunt-version-bump

v1.0.8

Published

A grunt plugin for bumping a version property in JSON files

Downloads

141

Readme

#Overview A grunt plugin for bumping a version property in JSON files

#Getting Started The plugin requires Grunt ~0.4.2

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-version-bump --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-version-bump');

The "version_bump" task

Overview

In your project's Gruntfile, add a section named version_bump.

grunt.initConfig({
  version_bump: {
    files: ['package.json', 'component.json', 'somefile.txt']
  }
});

Usage

grunt version_bump

There is a default version string structure, but you can provide your own structure.

By default, the part with the lowest priority gets bumped. In the default version string structure that would be the build part.

You can specify a different increment type in 1st argument:

grunt version_bump:[incrementType]

The default version string structure pattern is

<major>.<minor>.<patch>-<stage>.<build>

Available increment types provided in the default version string strucutre: Let's assume current version is 1.2.3-SNAPSHOT.4

    grunt version_bump:major // 2.0.0-SNAPSHOT.1
    grunt version_bump:build // 2.0.0-SNAPSHOT.2
    grunt version_bump:minor // 2.1.0-SNAPSHOT.1
    grunt version_bump:build // 2.1.0-SNAPSHOT.2
    grunt version_bump:patch // 2.1.1-SNAPSHOT.1
    grunt version_bump:build // 2.1.1-SNAPSHOT.2
    grunt version_bump:stage // 2.1.0-alpha.1
    grunt version_bump:build // 2.1.0-alpha.2
    grunt version_bump:stage // 2.1.0-beta.1
    grunt version_bump:stage // 2.1.0-RELEASE.1
    grunt version_bump:major --condition=stage:alpha // 2.1.0-RELEASE.1
    grunt version_bump:major --condition=minor:1 // 2.2.0-RELEASE.1

As can be seen, bumping a part results in resetting all parts of lower priority. The priority order of the default version string strcuture is major, minor, stage, patch, build.

Settings

files

Type: String|Array
Default: ['package.json']

File paths of the meta file(s) you wish to operate on.

incrementType

Type: String

The part to increment. Must be defined in the version string structure.

versionStructureFile

Type: String

File path to the version structure file if you wish to override the default.

versionStructure

Type: JSON

A content of a version strcuture. An array of objects with the following fields:

name

Type: String

The name of the part

prefix

Type: String Default: .

A string to put before the part

order

Type: Integer

The order of the part in the version string. Must be consecutive.

priority

Type: Integer

The priority of the part in the version string. Must be consecutive. 1 is for the highest priority.

resettable

Type: Boolean

Whether or not the part should be reset if a higher priority part was requested to be bumped.

resetTo

Type: Integer Default: 0

The number to use when resetting a resettable part.

values

Type: Array

Array of strings ordered by priority of possible values for that part if numbers are not good enough.

callback

Type: Function

Callback function after successfully job, in parameter is set name of new version.

Command Line Options

condition

Type String:String

A condition that only if met a bump will be done. The left part is a name of a part and the right part is the value.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)

Issues

Please use the github issues list to report any issues. If possible, please include a link to an open github repo with the smallest failing example of your issue. Even better, fork the project, create a failing test case and issue a pull request with the issue number referenced in the pull request. Super better, fork the project create a failing test case, fix the problem, and issue a pull request with the test and fix referencing the issue number.