diff --git a/README.md b/README.md index fc810d6..b79275e 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,16 @@ $ grunt bump --setversion=2.0.1 >> Pushed to origin ``` +If you want to specify an identifier for prerelease versions you can use the ```preid``` tag in the command line. + +```bash +$ grunt bump:prerelease --preid dev +>> Version bumped to 2.0.1-dev.0 +>> Committed as "Release v2.0.1-dev.0" +>> Tagged as "v2.0.1-dev.0" +>> Pushed to origin +``` + Sometimes you want to run another task between bumping the version and committing, for instance generate changelog. You can use `bump-only` and `bump-commit` to achieve that: ```bash diff --git a/package.json b/package.json index dab131c..a6e3cbd 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ }, "license": "MIT", "dependencies": { - "semver": "~2.3.0" + "semver": "~4.1.0" }, "peerDependencies": { "grunt": ">=0.4.0" diff --git a/tasks/bump.js b/tasks/bump.js index f61b83e..99d5dc5 100644 --- a/tasks/bump.js +++ b/tasks/bump.js @@ -56,6 +56,8 @@ module.exports = function(grunt) { exactVersionToSet = false; } + var prereleaseIdentifier = grunt.option('preid'); + var done = this.async(); var queue = []; var next = function() { @@ -99,7 +101,7 @@ module.exports = function(grunt) { var version = null; var content = grunt.file.read(file).replace(VERSION_REGEXP, function(match, prefix, parsedVersion, suffix) { gitVersion = gitVersion && parsedVersion + '-' + gitVersion; - version = exactVersionToSet || gitVersion || semver.inc(parsedVersion, versionType || 'patch'); + version = exactVersionToSet || gitVersion || semver.inc(parsedVersion, versionType || 'patch', false, prereleaseIdentifier); return prefix + version + suffix; });