Skip to content

Commit 20c705f

Browse files
authored
Release 0.5.0 (#22)
* Release 0.5.0 (#21) * Add utils functions * Add github info function to retrieve user and repo informations * Update the main file so is able to get the action dynamically * Add a CHANGELOG.md file * Update the index.js file to have the changelog function, use user's local informations and use issues as data * Add jshint and tests to the project * Change the dateFormat and the getOptions functions * Update the exported function name from utils * Add tests for the utils functions * Add strict mode to the tests * Change the inclusion of the utils test file * Change the name of the index file to gren.js * Add the check network functionality, Change the way it gets the token * Add @Private and @public tags, remove useless comments * Add the chance to change an existing release * Remove the milestones functions, saved for next release * Add a default for the includeMessages option * Update the package.json * Change the token expected reference * Update the README.md file * Update README.md * Make the component global, use Object.assign * Create a bin/gren.js for the global usage * Throw error from github if the configuration is not set up * Update the CHANGELOG.md using issues * Update README.md * Clean the code for utils.js * Apply several of the new issues * Lint js code * Update documentation * Update the README.md and use the flags over the git configuration * Change error text * Clean gren.js * Replace jshint with eslint and add .editorconfig to the repo * Lint js code * Update README.md * Replace let with var * Log the tags for the release
1 parent 8249deb commit 20c705f

File tree

15 files changed

+1442
-307
lines changed

15 files changed

+1442
-307
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

.eslintrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"env": {
3+
"node": true
4+
},
5+
"parserOptions": {
6+
"ecmaVersion": 5,
7+
"sourceType": "module",
8+
"ecmaFeatures": {
9+
"impliedStrict": true
10+
},
11+
"allowImportExportEverywhere": false
12+
},
13+
14+
"extends": [
15+
"standard"
16+
],
17+
18+
"rules": {
19+
"semi": [2, "always"],
20+
"no-empty": 2,
21+
"array-callback-return": 2,
22+
"indent": [2, 4, { "SwitchCase": 1 }],
23+
"space-before-function-paren": [2, "never"],
24+
"no-debugger": 0
25+
}
26+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.DS_Store
2+
docs/
23
node_modules/
34
npm-debug.log

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language:
2+
- node_js
3+
4+
node_js:
5+
- "5.1"
6+
7+
cache:
8+
directories:
9+
- node_modules
10+
11+
before_install:
12+
- npm install -g grunt-cli
13+
14+
script:
15+
- grunt test

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.4.0 (03/03/2016)
4+
5+
- [**enhancement**] Include Various Types Of Commit Messages [#5](https://github.com/github-tools/github-release-notes/issues/5)
6+
7+
---
8+
9+
## v0.3.2 (07/12/2015)
10+
11+
- [**enhancement**] Cleanse option [#3](https://github.com/github-tools/github-release-notes/issues/3)
12+
13+
---
14+
15+
## v0.1.0 (12/11/2015)
16+
17+
*No changelog for this release.*

Gruntfile.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use strict';
2+
3+
module.exports = function(grunt) {
4+
grunt.loadNpmTasks('grunt-eslint');
5+
grunt.loadNpmTasks('grunt-jsdoc');
6+
grunt.loadNpmTasks('grunt-contrib-nodeunit');
7+
8+
grunt.initConfig({
9+
nodeunit: {
10+
all: ['test/**/*.js']
11+
},
12+
eslint: {
13+
options: {
14+
fix: true
15+
},
16+
target: [
17+
'Gruntfile.js',
18+
'src/**/*.js'
19+
]
20+
},
21+
jsdoc: {
22+
dist: {
23+
src: ['README.md', 'src/*.js'],
24+
readme: 'README.md',
25+
version: true,
26+
options: {
27+
destination: 'docs',
28+
template: 'node_modules/ink-docstrap/template',
29+
configure: 'node_modules/ink-docstrap/template/jsdoc.conf.json'
30+
}
31+
}
32+
}
33+
});
34+
35+
grunt.registerTask('ship', ['eslint', 'jsdoc']);
36+
grunt.registerTask('test', ['eslint', 'nodeunit']);
37+
};

README.md

Lines changed: 118 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,138 @@
1-
# github-release-notes
1+
# Github Release Notes
22

33
[![npm version](https://badge.fury.io/js/github-release-notes.svg)](https://badge.fury.io/js/github-release-notes)
4+
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com)
5+
[![Build Status](https://travis-ci.org/github-tools/github-release-notes.svg)](https://travis-ci.org/github-tools/github-release-notes)
46

5-
> Node module which generates a release from the latest tag and compiles release notes based on commit messages between the last tag and the latest release.
7+
> Node module that generates release notes based on commit messages or closed issues between tags. It also can create a full changelog or add the latest release notes to the existing changelog file.
68
79
## Installation
810

9-
The plugin requires Node `^0.12.`, since is using Promises.
10-
1111
Install `github-release-notes` via npm:
1212

1313
```shell
14-
npm install github-release-notes --save-dev
14+
npm install github-release-notes -g
1515
```
1616

1717
## Usage
1818

19-
You can run the command via the terminal (the three arguments are all required):
19+
**gren** can be ran through the terminal, but before you can use it, you need to set up a couple of things.
20+
21+
### Github Informations
22+
23+
**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.
24+
25+
Otherwise, you can run it from wherever and specify a different repo as target, with:
2026

2127
```shell
22-
node github-release-notes --token=[token] --username=[username] --repo=[repo name]
28+
gren --username=[username] --repo=[repo name]
29+
```
30+
31+
#### Token
32+
33+
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._
34+
35+
Once generated, you can run the gren command with the token as variable:
36+
37+
```shell
38+
gren --token=your_token_here
39+
```
40+
41+
Or you can add it to your `~/.bash_profile` or `~/.zshrc`) as follows:
42+
43+
```shell
44+
export GREN_GITHUB_TOKEN=your_token_here
45+
```
46+
47+
And you're ready to use it! Just run this command in your terminal:
48+
49+
```shell
50+
gren
51+
```
52+
53+
The module will look for the last tag, get all the issues closed in the time between that tag and the one before, and it will build release notes and draft the new release!
54+
55+
## Options
56+
57+
Following the options for the module:
58+
59+
- `--action=release|changelog` The **gren** action to run. Default: `release` _(see details below for changelog generator)_
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+
- `--time-wrap=latest|history` The release notes you want to include in the changelog. Default: `latest` _Only applicable to the `changelog` action_
62+
- `--changelog-filename=CHANGELOG.md` The name of the changelog file. Default: `CHANGELOG.md`
63+
- `--data-source=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+
- `--include-messages=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+
## Examples
71+
72+
The ways to use **gren** are various.
73+
74+
### Simple
75+
76+
The simple way, just looks for the last tag, gets all the issues closed between that tag and the one before and creates the new release with the generated body.
77+
78+
```
79+
gren
2380
```
2481

25-
To generate a github token, follow [this link](https://help.github.com/articles/creating-an-access-token-for-command-line-use/);
82+
### Commit messages
2683

27-
### Optionals
84+
Adding the flag `--data-source=commits` will change the source of the release notes to be the commit messages.
2885

29-
There are optional arguments such as:
86+
```
87+
gren --data-source=commits
88+
```
89+
90+
### Release specific tags
91+
92+
The flag `--tags` accepts one or two tags.
93+
If you only give one tag, it will get the issues (or commit messages) between that tag and the one before.
94+
If you give two tags it will generate the release notes with the issues (or commit messages) between those two tag dates.
95+
96+
```
97+
gren --tags=2.0.0,1.0.0
98+
```
99+
100+
### Override an existing release
101+
102+
If you trying to create an existing release, **gren** will throw an error *"0.3.0 is a release, use --override flag to override an existing release!*
103+
If you want then to override, simple use:
104+
105+
```
106+
gren --override --tags=0.3.0
107+
```
108+
109+
110+
## Changelog Generator
111+
112+
**gren** can also update generate the changelog.
113+
114+
The following command, will generate the release notes for the latest release, and add it to an existing file or create it in the same directory where you run the command.
115+
116+
```shell
117+
gren --action=changelog
118+
```
119+
120+
The generated release notes will be added at the top of the file, and will look like this:
121+
122+
> # Changelog
123+
## v0.4.3 (02/03/2016)
124+
[**bug**] This is a issue name [#123](https://github.com/github-tools/github-tools)
125+
126+
### Generate a full changelog
127+
128+
If tou want to generate the whole changelog, you need to use the `--time-wrap=history`. This will generate a changelog based on issues (or on commit messages if the `--data-source=commits` is present).
129+
130+
If you want to override the existing changelog, use `--override`.
131+
132+
The usage would then be:
133+
134+
```
135+
gren --time-wrap=history --override
136+
```
30137

31-
- `--draft=true` To set the release as a draft. Default: `false`
32-
- `--prerelease=true` To set the release as a prerelease. Default: `false`
33-
- `--prefix=v` Add a prefix to the tag version `e.g. v1.0.1`
34-
- `--include-messages=merges/commits/all` used to filter the messages added to the release notes. Default: `commits`
138+
To see a full example of the changelog here [CHANGELOG.md](https://github.com/github-tools/github-release-notes/blob/develop/CHANGELOG.md)

bin/gren.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
3+
'use strict';
4+
5+
var GithubReleaseNotes = require('../src/gren');
6+
var gren = new GithubReleaseNotes();
7+
var utils = require('../src/utils');
8+
9+
var action = utils.getBashOptions(process.argv)['action'];
10+
11+
gren.init()
12+
.then(function (success) {
13+
if(success) {
14+
return gren[action || 'release']();
15+
}
16+
});

github-release-notes.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
'use strict';
22

3-
var GithubReleaseNotes = require('./src/index');
3+
var GithubReleaseNotes = require('./src/gren');
44
var gren = new GithubReleaseNotes();
5+
var utils = require('./src/utils');
56

6-
gren.release();
7+
var action = utils.getBashOptions(process.argv)['action'];
8+
9+
gren.init()
10+
.then(function (success) {
11+
if(success) {
12+
return gren[action || 'release']();
13+
}
14+
});

package.json

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
{
22
"name": "github-release-notes",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "Node module to publish release notes based on commits between the last two tags.",
55
"main": "./github-release-notes.js",
66
"scripts": {
77
"start": "node github-release-notes.js",
8-
"test": "echo \"Error: no test specified\" && exit 1"
8+
"test": "grunt test"
99
},
1010
"repository": {
1111
"type": "git",
1212
"url": "git+https://github.com/alexcanessa/github-release-notes.git"
1313
},
14+
"preferGlobal": "true",
15+
"bin": {
16+
"gren": "bin/gren.js"
17+
},
1418
"keywords": [
1519
"Github",
1620
"Release",
1721
"notes",
18-
"Release",
19-
"Tag"
22+
"Tag",
23+
"Changelog",
24+
"Changelog Generator",
25+
"Issues",
26+
"Commits"
2027
],
2128
"author": "alexcanessa",
2229
"license": "ISC",
@@ -25,6 +32,21 @@
2532
},
2633
"homepage": "https://github.com/alexcanessa/github-release-notes#readme",
2734
"dependencies": {
28-
"github-api": "git+https://github.com/alexcanessa/github.git"
35+
"chalk": "^1.1.3",
36+
"es6-promise": "^3.2.1",
37+
"github-api": "^2.1.0",
38+
"is-online": "^5.1.1",
39+
"object-assign": "^4.1.0"
40+
},
41+
"devDependencies": {
42+
"eslint": "^3.6.0",
43+
"eslint-config-standard": "^6.0.1",
44+
"eslint-plugin-promise": "^2.0.1",
45+
"eslint-plugin-standard": "^2.0.0",
46+
"grunt": "^1.0.1",
47+
"grunt-contrib-nodeunit": "^1.0.0",
48+
"grunt-eslint": "^19.0.0",
49+
"grunt-jsdoc": "^2.1.0",
50+
"ink-docstrap": "^1.2.1"
2951
}
3052
}

0 commit comments

Comments
 (0)