Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show help text about semver with grunt release:help #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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
```
Expand Down
23 changes: 23 additions & 0 deletions tasks/grunt-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -60,6 +75,11 @@ module.exports = function(grunt){
};
}

if (type === 'help') {
help();
return;
}

// Defaults
var options = grunt.util._.extend({
bump: true,
Expand Down Expand Up @@ -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))
Expand Down