Skip to content

Commit 9e64b4a

Browse files
authored
Integrate 0.5.0 (#4)
* Update the module to the latest gren * Update the CHANGELOG.md * Update README.md
1 parent 1831254 commit 9e64b4a

File tree

6 files changed

+108
-41
lines changed

6 files changed

+108
-41
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Editor code style configuration
2+
# http://editorconfig.org/
3+
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[*.md]
14+
trim_trailing_whitespace = false

.jshintrc

Lines changed: 0 additions & 13 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Changelog
2+
3+
## 0.3.0 (03/03/2016)
4+
5+
*No changelog for this release.*
6+
7+
---
8+
9+
## 0.2.1 (19/11/2015)
10+
11+
*No changelog for this release.*
12+
13+
---
14+
15+
## 0.2.0 (19/11/2015)
16+
17+
*No changelog for this release.*

README.md

Lines changed: 62 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
[![npm version](https://badge.fury.io/js/grunt-github-release-notes.svg)](https://badge.fury.io/js/grunt-github-release-notes)
44

5-
> Grunt module to publish release notes based on commits between the last two tags.
5+
> Grunt module to publish release notes based on commits between two tags.
66
This module is using [github-release-notes](https://github.com/alexcanessa/github-release-notes).
77

8-
98
## Getting Started
10-
This plugin requires Grunt `~0.4.5`
9+
This plugin requires Grunt `~0.4.5` and github-release-notes `^0.5.0`
1110

1211
```shell
1312
npm install grunt-github-release-notes --save-dev
@@ -21,29 +20,70 @@ grunt.loadNpmTasks('grunt-github-release-notes');
2120

2221
## The "release" task
2322

24-
### Overview
25-
In your project's Gruntfile, add a section named `gren` to the data object passed into `grunt.initConfig()`.
26-
**`token`, `username` and `repo` are required.**
23+
Before you can use it, you need to set up a couple of things.
24+
25+
### Github Informations
26+
27+
**gren** by default looks for your local git configuration to get the repo informations. This means you can run the command directly from the git repo folder.
28+
29+
Otherwise, you can run it from wherever and specify a different repo as target, with:
2730

2831
```js
29-
gren: {
30-
release: {
31-
options: {
32-
token: 'GITHUB_TOKEN',
33-
username: 'GITHUB_USERNAME',
34-
repo: 'GITHUB_REPO_NAME'
35-
}
36-
}
32+
options: {
33+
username: USERNAME,
34+
repo: REPO_NAME
35+
}
36+
```
37+
38+
#### Token
39+
40+
To work, **gren** needs a `github token` (that can be easily generated following [this link](https://help.github.com/articles/creating-an-access-token-for-command-line-use/)). _You only need "repo" scope._
41+
42+
Once generated, you can run the gren command with the token as variable:
43+
44+
```js
45+
options: {
46+
token: YOUR_TOKEN_HERE
3747
}
3848
```
3949

40-
To generate a github token, follow [this link](https://help.github.com/articles/creating-an-access-token-for-command-line-use/);
50+
Or you can add it to your `~/.bash_profile` or `~/.zshrc`) as follows:
4151

42-
### Optionals
43-
There are optional arguments such as:
52+
```shell
53+
export GREN_GITHUB_TOKEN=your_token_here
54+
```
55+
56+
## Options
57+
58+
The options are the same as [github-release-notes](https://github.com/alexcanessa/github-release-notes), in camelCase:
59+
60+
- `tags: 0.1.0|0.2.0,0.1.0` A specific tag or the range of tags to build the release notes from.
61+
- `timeWrap: latest|history` The release notes you want to include in the changelog. Default: `latest` _Only applicable to the `changelog` action_
62+
- `changelogFilename: CHANGELOG.md` The name of the changelog file. Default: `CHANGELOG.md`
63+
- `dataSource: issues|commits` The informations you want to use to build release notes. Default: `issues`
64+
- `draft: true|false` To set the release as a draft. Default: `false`
65+
- `prerelease: true|false` To set the release as a prerelease. Default: `false`
66+
- `prefix: v` Add a prefix to the tag version `e.g. v1.0.1`. Default: `null`
67+
- `includeMessages: merges|commits|all` used to filter the messages added to the release notes. Default: `commits`
68+
- `override: true|false` Override the release notes if existing. Default: `false`
69+
70+
### Example
4471

45-
- `draft: true` To set the release as a draft. Default: `false`
46-
- `prerelease: true` To set the release as a prerelease. Default: `false`
47-
- `prefix: 'v'` Add a prefix to the tag version `e.g. v1.0.1`.
48-
- `force: true` Doesn't fail the task if the task presents any errors. Default: `false`
49-
- `includeMessages: merges/commits/all` used to filter the messages added to the release notes. Default: `commits`
72+
The module accepts two targets: *release* and *changelog*.
73+
74+
The *release* task will generate the last release, while the *changelog* will add the release notes to the changelog (without committing the file);
75+
76+
```js
77+
gren: {
78+
release: {
79+
options: {
80+
prefix: 'v'
81+
}
82+
},
83+
changelog: {
84+
options: {
85+
changelogFilename: 'CHANGELOG.md'
86+
}
87+
}
88+
}
89+
```

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "grunt-github-release-notes",
33
"description": "Grunt plugin for the npm github-release-notes",
4-
"version": "0.3.0",
4+
"version": "0.4.0",
55
"homepage": "https://github.com/alexcanessa/grunt-github-release-notes",
66
"author": {
77
"name": "Alex Canessa",
@@ -36,6 +36,6 @@
3636
"gruntplugin"
3737
],
3838
"dependencies": {
39-
"github-release-notes": "^0.4.0"
39+
"github-release-notes": "^0.5.0"
4040
}
4141
}

tasks/gren.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
'use strict';
1010

11-
var Gren = require('github-release-notes/src/index.js');
11+
var GithubReleaseNotes = require('github-release-notes/src/gren.js');
1212

1313
module.exports = function(grunt) {
1414

@@ -18,11 +18,20 @@ module.exports = function(grunt) {
1818
grunt.registerMultiTask('gren', 'Grunt plugin for the npm github-release-notes', function() {
1919
var options = this.options({});
2020
var done = this.async();
21+
var gren = new GithubReleaseNotes(options);
2122

22-
var gren = new Gren(options);
23+
if (this.target !== 'release' && this.target !== 'changelog') {
24+
throw new Error('The target needs to be either release or changelog');
25+
}
2326

24-
gren.release().then(done);
27+
var component = this;
2528

29+
gren.init()
30+
.then(function (success) {
31+
if(success) {
32+
return gren[component.target]();
33+
}
34+
}).then(done);
2635
});
2736

28-
};
37+
};

0 commit comments

Comments
 (0)