diff --git a/README.md b/README.md index d3315c4..4d05bfb 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,12 @@ grunt.loadNpmTasks('grunt-release'); ``` ## Using grunt-release +Version numbers should always be bumped in accordance to +[semver](http://semver.org/). If you ever forget which part of the version +number should be changed, you can run `grunt release:help` for a quick summary. **Patch Release:** +Patch releases are done when making backwards-compatible bug fixes. ```shell grunt release ``` @@ -51,11 +55,14 @@ grunt release:patch ``` **Minor Release:** +If you've added functionality in a backwards-compatible manner, a minor release +is the right thing to do. ```shell grunt release:minor ``` **Major Release:** +Should you have made incompatible API changes, it's time for a major release. ```shell grunt release:major ``` diff --git a/tasks/grunt-release.js b/tasks/grunt-release.js index 1bc11c0..74ebe26 100644 --- a/tasks/grunt-release.js +++ b/tasks/grunt-release.js @@ -14,6 +14,21 @@ var Q = require('q'); module.exports = function(grunt){ grunt.registerTask('release', 'Bump version, git tag, git push, npm publish', function(type){ + function help(type) { + var helpText = { + major: 'Release a MAJOR version when you make incompatible API changes.', + minor: 'Release a MINOR version when you add functionality in a backwards-compatible manner.', + patch: 'Release a PATCH version when you make backwards-compatible bug fixes.' + }; + + if (type in helpText) { + grunt.log.ok(helpText[type]); + } else { + for (type in helpText) { + grunt.log.ok(helpText[type]); + } + } + } function setup(file, type){ var pkg = grunt.file.readJSON(file); @@ -60,6 +75,11 @@ module.exports = function(grunt){ }; } + if (type === 'help') { + help(); + return; + } + // Defaults var options = grunt.util._.extend({ bump: true, @@ -311,6 +331,9 @@ module.exports = function(grunt){ return fn; } + // Show help for the current release type + help(type || 'patch'); + new Q() .then(ifEnabled('beforeBump', runTasks('beforeBump'))) .then(ifEnabled('bump', bump))