@flyinghippo/grunt-setver

0.0.10 • Public • Published

grunt-setver

Set version according to git tags.

Getting Started

This plugin requires Grunt ~0.4.5

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-setver --save-dev

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

grunt.loadNpmTasks('grunt-setver');

The "setver" task

Overview

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

grunt.initConfig({
  setver: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
});

The "setver" task will run without explictt configuration, updating package.json

Options

options.key

Type: String Default value: version

The key to set in the JSON file.

options.file

Type: String Default value: package.json

The filename to set version informaiton.

Usage Examples

Default Options

Set 'version' in package.json.

grunt.initConfig({
});

Custom Options

Set 'version2' in package2.json.

grunt.initConfig({
  setver: {
    options: {
      key: 'version2 ',
      file: 'package2.json',
    },
  },
});

Setting versions in multiple files

Use "setverM" multitask to work on multiple files.

grunt.initConfig({
  setverM: {
    options: {},
    src: [
      'package.json',
      'submodule1/package.json',
      'submodule2/package.json',
    ],
  },
});

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)

Readme

Keywords

Package Sidebar

Install

npm i @flyinghippo/grunt-setver

Weekly Downloads

0

Version

0.0.10

License

none

Unpacked Size

11.4 kB

Total Files

10

Last publish

Collaborators

  • parleer