# grunt-semver

> Semantic versioning for grunt

Latest version **0.1.9** (published 2018-06-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install grunt-semver
pnpm add grunt-semver
yarn add grunt-semver
bun add grunt-semver
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.9 |
| Published | 2018-06-19 |
| First published | 2013-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 11.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Mikael Karon |
| Maintainers | mikaelkaron |
| Keywords | gruntplugin |

## Links

- npm: https://www.npmjs.com/package/grunt-semver
- Repository: https://github.com/mikaelkaron/grunt-semver
- Issues: https://github.com/mikaelkaron/grunt-semver/issues
- npm.io page: https://npm.io/package/grunt-semver

## Dependencies (4)

- [semver](https://npm.io/package/semver.md) ^5.5.0
- [grunt-util-args](https://npm.io/package/grunt-util-args.md) ^0.0.6
- [grunt-util-options](https://npm.io/package/grunt-util-options.md) ^0.0.4
- [grunt-util-process](https://npm.io/package/grunt-util-process.md) ^0.0.3

## Recent versions

- 0.1.9 (latest) — 2018-06-19
- 0.1.8 — 2018-06-19
- 0.1.7 — 2017-03-17
- 0.1.6 — 2013-08-28
- 0.1.5 — 2013-08-22
- 0.1.4 — 2013-08-21
- 0.1.3 — 2013-08-16
- 0.1.2 — 2013-08-16
- 0.1.1 — 2013-08-16
- 0.1.0 — 2013-08-15
- 0.0.3 — 2013-08-13
- 0.0.2 — 2013-08-12
- 0.0.1 — 2013-08-09

## README

[![Build Status](https://travis-ci.org/mikaelkaron/grunt-semver.png)](https://travis-ci.org/mikaelkaron/grunt-semver)
[![NPM version](https://badge.fury.io/js/grunt-semver.png)](http://badge.fury.io/js/grunt-semver)

# grunt-semver

> Semantic versioner for grunt

## Getting Started
This plugin requires Grunt `~0.4.0`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-semver --save-dev
```

One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-semver');
```

## The "grunt-semver" task

### Overview
In your project's Gruntfile, add a section named `semver` to the data object passed into `grunt.initConfig()`.

```js
grunt.initConfig({
  "semver": {
    "options": {
      // Task-specific options go here.
      space: "\t"
    },
    "your_target": {
      // Target-specific file lists and/or options go here.
      files: [{
          src: "package.json",
          dest: "package.json.out"
      }, { 
          src: "bower.json",
          dest: "bower.json.out"
      }]
    },
  },
})
```

#### Examples

Validate a string as a correct version according to semantic versionning:

```
$ grunt semver:validate:your_target:0.1.2
0.1.2

$ grunt semver:validate:your_target:0.1.2foo
Warning: Invalid Version: 0.1.2foo
```

Validate versions found if the given part's `files`:

```
$ grunt semver:your_target:validate
package.json : 0.1.2
bower.json : 0.1.2
```

Set given version in every files:

```
$ grunt semver:your_target:set:0.1.4
package.json : 0.1.4
bower.json : 0.1.4
```

Bump major/minor/patch/prerelease number (example starts at `0.1.2-pre.1`):

```
$ grunt semver:your_target:validate
package.json : 0.1.2-pre.1
bower.json : 0.1.2-pre.1

$ grunt semver:your_target:bump:major
package.json : 1.0.0
bower.json : 1.0.0

$ grunt semver:your_target:bump:minor
package.json : 0.2.0
bower.json : 0.2.0

$ grunt semver:your_target:bump:patch
package.json : 0.1.3
bower.json : 0.1.3

$ grunt semver:your_target:bump:prerelease
package.json : 0.1.2-pre.2
bower.json : 0.1.2-pre.2```
```

Strip build or prerelease information (example starts at `0.1.2-pre.1+0123456`)::

```
$ grunt semver:your_target:validate
package.json : 0.1.2-pre.1+0123456
bower.json : 0.1.2-pre.1+0123456

$ grunt semver:your_target:strip:prerelease
package.json : 0.1.2+0123456
bower.json : 0.1.2+0123456

$ grunt semver:your_target:strip:build
package.json : 0.1.2-pre.1
bower.json : 0.1.2-pre.1
```

### Options

#### options.space
Type: `String`  
Default value: `\t`

A string value that is used to format the output 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](http://gruntjs.com/).

---
_Source: https://npm.io/package/grunt-semver · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
