Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    grunt-bump-build-gitpublic

    grunt bump build git

    Bump the version, build the project and add, commit and tag in git in one step.

    Table of contents

    Getting Started

    This 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-bump-build-git --save-dev

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

    grunt.loadNpmTasks('grunt-bump-build-git');

    The build task

    Overview

    This task allows you to bump your project version, update all available package files (package.json, bower.json, etc.), build the project with your custom tasks and the updated package config version and add, commit and tag the new release in git - all in one step.

    Usage Examples

    Setup

    This task doesn't require any configuration setup, but allows to set custom options the following way:

    In your project's Gruntfile, add a section named build to the data object passed into grunt.initConfig().

    grunt.initConfig({
      build: {
        tasks: ['default'],
        packageConfig: 'pkg',
        packages: '*.json',
        jsonSpace: 2,
        jsonReplacer: undefined,
        gitAdd: '--all'
      },
    })

    Build test

    Build the project and create a new meta version (e.g. 1.2.3+build.1382987826059):

    grunt build

    Releases

    Build the project and bump the major version (major.minor.patch):

    grunt build:major

    Build the project and bump the minor version (major.minor.patch):

    grunt build:minor

    Build the project and bump the patch version (major.minor.patch):

    grunt build:patch

    Build the project and bump the version to a major/minor/patch prerelease:

    grunt build:major-rc.1

    Build the project and bump the prerelease version (major.minor.patch-prerelease):

    grunt build:pre

    Build the project with a specific semver identifier as version:

    grunt build:1.2.3-rc.4+test.5

    Git integration

    Build the project and run git add, git commit and git tag automatically:

    grunt build:patch:"Fixed #42"

    This adds all unstaged files and commits the changes with the given message to the Git repository.
    The message is also used to create an annotated tag with the updated package version as tag name.

    To build and commit a test version without creating a tag, run the following command:

    grunt build::"Test build"

    Colons in commit messages:

    If you want to use colons in commit messages, escape them with a backslash:

    grunt build:minor:"Set visibility\:true by default."

    Options

    build.tasks

    Type: Array
    Default value: ['default']

    The list of custom tasks to run after bumping the package version and before running the git tasks.

    build.packageConfig

    Type: String
    Default value: 'pkg'

    The name of the config object with the package version.

    build.packages

    Type: String
    Default value: '*.json'

    The location of the JSON package files, passed as parameter to grunt.file.expand.

    build.jsonSpace

    Type: Integer
    Default value: 2

    The space parameter to JSON.stringify used to render the JSON package files.

    build.jsonReplacer

    Type: function|Array
    Default value: undefined

    The replacer parameter to JSON.stringify used to render the JSON package files.

    build.gitAdd

    Type: String|Boolean
    Default value: '--all'

    The shell parameters passed to git add.
    Set to false to disable calling git add on build runs.

    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

    • 2013-12-27   v1.1.1   Escape colons in git commit messages.
    • 2013-11-28   v1.1.0   Added gitAdd build option.
    • 2013-10-29   v1.0.0   Initial release.

    install

    npm i grunt-bump-build-git

    Downloadsweekly downloads

    52

    version

    1.1.3

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar