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

Release 0.5.0 #21

Merged
merged 35 commits into from
Sep 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5218515
Add utils functions
alexcanessa Jun 9, 2016
3404052
Add github info function to retrieve user and repo informations
alexcanessa Jun 9, 2016
a4f079c
Update the main file so is able to get the action dynamically
alexcanessa Jun 9, 2016
5a80af5
Add a CHANGELOG.md file
alexcanessa Jun 9, 2016
afdde16
Update the index.js file to have the changelog function, use user's l…
alexcanessa Jun 9, 2016
50b09e3
Add jshint and tests to the project
alexcanessa Jun 9, 2016
71aed38
Change the dateFormat and the getOptions functions
alexcanessa Jun 9, 2016
a36ec21
Update the exported function name from utils
alexcanessa Jun 9, 2016
b8a8642
Add tests for the utils functions
alexcanessa Jun 9, 2016
344d33b
Add strict mode to the tests
alexcanessa Jun 9, 2016
a428389
Change the inclusion of the utils test file
alexcanessa Jun 9, 2016
274d2e3
Change the name of the index file to gren.js
alexcanessa Jun 9, 2016
95fdc87
Add the check network functionality, Change the way it gets the token
alexcanessa Jun 10, 2016
0c11513
Add @private and @public tags, remove useless comments
alexcanessa Jun 11, 2016
2f67ed6
Add the chance to change an existing release
alexcanessa Jun 11, 2016
0dc2b3f
Remove the milestones functions, saved for next release
alexcanessa Jun 16, 2016
08d015f
Add a default for the includeMessages option
alexcanessa Jun 17, 2016
ceb0590
Update the package.json
alexcanessa Jun 17, 2016
cf08171
Change the token expected reference
alexcanessa Jun 17, 2016
cbb8c7e
Update the README.md file
alexcanessa Jun 17, 2016
3b59b96
Update README.md
alexcanessa Jun 17, 2016
a46d6ec
Make the component global, use Object.assign
alexcanessa Sep 26, 2016
8eab41e
Create a bin/gren.js for the global usage
alexcanessa Sep 26, 2016
488b5ff
Throw error from github if the configuration is not set up
alexcanessa Sep 26, 2016
1b75065
Update the CHANGELOG.md using issues
alexcanessa Sep 26, 2016
70512ab
Update README.md
alexcanessa Sep 26, 2016
d31b1a8
Clean the code for utils.js
alexcanessa Sep 26, 2016
7010a3b
Apply several of the new issues
alexcanessa Sep 26, 2016
d424fd6
Lint js code
alexcanessa Sep 26, 2016
5a8283a
Update documentation
alexcanessa Sep 26, 2016
bbc634b
Update the README.md and use the flags over the git configuration
alexcanessa Sep 26, 2016
0b71007
Change error text
alexcanessa Sep 26, 2016
d8d40b4
Clean gren.js
alexcanessa Sep 26, 2016
3bc4cef
Replace jshint with eslint and add .editorconfig to the repo
alexcanessa Sep 26, 2016
cdc85ed
Lint js code
alexcanessa Sep 26, 2016
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
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Editor code style configuration
# http://editorconfig.org/

root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
26 changes: 26 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"env": {
"node": true
},
"parserOptions": {
"ecmaVersion": 5,
"sourceType": "module",
"ecmaFeatures": {
"impliedStrict": true
},
"allowImportExportEverywhere": false
},

"extends": [
"standard"
],

"rules": {
"semi": [2, "always"],
"no-empty": 2,
"array-callback-return": 2,
"indent": [2, 4, { "SwitchCase": 1 }],
"space-before-function-paren": [2, "never"],
"no-debugger": 0
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
docs/
node_modules/
npm-debug.log
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language:
- node_js

node_js:
- "5.1"

cache:
directories:
- node_modules

before_install:
- npm install -g grunt-cli

script:
- grunt test
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

## 0.4.0 (03/03/2016)

- [**enhancement**] Include Various Types Of Commit Messages [#5](https://github.com/github-tools/github-release-notes/issues/5)

---

## v0.3.2 (07/12/2015)

- [**enhancement**] Cleanse option [#3](https://github.com/github-tools/github-release-notes/issues/3)

---

## v0.1.0 (12/11/2015)

*No changelog for this release.*
37 changes: 37 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';

module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-contrib-nodeunit');

grunt.initConfig({
nodeunit: {
all: ['test/**/*.js']
},
eslint: {
options: {
fix: true
},
target: [
'Gruntfile.js',
'src/**/*.js'
]
},
jsdoc: {
dist: {
src: ['README.md', 'src/*.js'],
readme: 'README.md',
version: true,
options: {
destination: 'docs',
template: 'node_modules/ink-docstrap/template',
configure: 'node_modules/ink-docstrap/template/jsdoc.conf.json'
}
}
}
});

grunt.registerTask('ship', ['eslint', 'jsdoc']);
grunt.registerTask('test', ['eslint', 'nodeunit']);
};
132 changes: 118 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,138 @@
# github-release-notes
# Github Release Notes

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

> 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.
> 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.

## Installation

The plugin requires Node `^0.12.`, since is using Promises.

Install `github-release-notes` via npm:

```shell
npm install github-release-notes --save-dev
npm install github-release-notes -g
```

## Usage

You can run the command via the terminal (the three arguments are all required):
**gren** can be ran through the terminal, but before you can use it, you need to set up a couple of things.

### Github Informations

**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.

Otherwise, you can run it from wherever and specify a different repo as target, with:

```shell
node github-release-notes --token=[token] --username=[username] --repo=[repo name]
gren --username=[username] --repo=[repo name]
```

#### Token

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._

Once generated, you can run the gren command with the token as variable:

```shell
gren --token=your_token_here
```

Or you can add it to your `~/.bash_profile` or `~/.zshrc`) as follows:

```shell
export GREN_GITHUB_TOKEN=your_token_here
```

And you're ready to use it! Just run this command in your terminal:

```shell
gren
```

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!

## Options

Following the options for the module:

- `--action=release|changelog` The **gren** action to run. Default: `release` _(see details below for changelog generator)_
- `--tags=0.1.0|0.2.0,0.1.0` A specific tag or the range of tags to build the release notes from.
- `--time-wrap=latest|history` The release notes you want to include in the changelog. Default: `latest` _Only applicable to the `changelog` action_
- `--changelog-filename=CHANGELOG.md` The name of the changelog file. Default: `CHANGELOG.md`
- `--data-source=issues|commits` The informations you want to use to build release notes. Default: `issues`
- `--draft=true|false` To set the release as a draft. Default: `false`
- `--prerelease=true|false` To set the release as a prerelease. Default: `false`
- `--prefix=v` Add a prefix to the tag version `e.g. v1.0.1`. Default: `null`
- `--include-messages=merges|commits|all` used to filter the messages added to the release notes. Default: `commits`
- `--override=true|false` Override the release notes if existing. Default: `false`

## Examples

The ways to use **gren** are various.

### Simple

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.

```
gren
```

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

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

There are optional arguments such as:
```
gren --data-source=commits
```

### Release specific tags

The flag `--tags` accepts one or two tags.
If you only give one tag, it will get the issues (or commit messages) between that tag and the one before.
If you give two tags it will generate the release notes with the issues (or commit messages) between those two tag dates.

```
gren --tags=2.0.0,1.0.0
```

### Override an existing release

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!*
If you want then to override, simple use:

```
gren --override --tags=0.3.0
```


## Changelog Generator

**gren** can also update generate the changelog.

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.

```shell
gren --action=changelog
```

The generated release notes will be added at the top of the file, and will look like this:

> # Changelog
## v0.4.3 (02/03/2016)
[**bug**] This is a issue name [#123](https://github.com/github-tools/github-tools)

### Generate a full changelog

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).

If you want to override the existing changelog, use `--override`.

The usage would then be:

```
gren --time-wrap=history --override
```

- `--draft=true` To set the release as a draft. Default: `false`
- `--prerelease=true` To set the release as a prerelease. Default: `false`
- `--prefix=v` Add a prefix to the tag version `e.g. v1.0.1`
- `--include-messages=merges/commits/all` used to filter the messages added to the release notes. Default: `commits`
To see a full example of the changelog here [CHANGELOG.md](#)
16 changes: 16 additions & 0 deletions bin/gren.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env node

'use strict';

var GithubReleaseNotes = require('../src/gren');
var gren = new GithubReleaseNotes();
var utils = require('../src/utils');

var action = utils.getBashOptions(process.argv)['action'];

gren.init()
.then(function (success) {
if(success) {
return gren[action || 'release']();
}
});
12 changes: 10 additions & 2 deletions github-release-notes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
'use strict';

var GithubReleaseNotes = require('./src/index');
var GithubReleaseNotes = require('./src/gren');
var gren = new GithubReleaseNotes();
var utils = require('./src/utils');

gren.release();
var action = utils.getBashOptions(process.argv)['action'];

gren.init()
.then(function (success) {
if(success) {
return gren[action || 'release']();
}
});
32 changes: 27 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
{
"name": "github-release-notes",
"version": "0.4.0",
"version": "0.5.0",
"description": "Node module to publish release notes based on commits between the last two tags.",
"main": "./github-release-notes.js",
"scripts": {
"start": "node github-release-notes.js",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "grunt test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/alexcanessa/github-release-notes.git"
},
"preferGlobal": "true",
"bin": {
"gren": "bin/gren.js"
},
"keywords": [
"Github",
"Release",
"notes",
"Release",
"Tag"
"Tag",
"Changelog",
"Changelog Generator",
"Issues",
"Commits"
],
"author": "alexcanessa",
"license": "ISC",
Expand All @@ -25,6 +32,21 @@
},
"homepage": "https://github.com/alexcanessa/github-release-notes#readme",
"dependencies": {
"github-api": "git+https://github.com/alexcanessa/github.git"
"chalk": "^1.1.3",
"es6-promise": "^3.2.1",
"github-api": "^2.1.0",
"is-online": "^5.1.1",
"object-assign": "^4.1.0"
},
"devDependencies": {
"eslint": "^3.6.0",
"eslint-config-standard": "^6.0.1",
"eslint-plugin-promise": "^2.0.1",
"eslint-plugin-standard": "^2.0.0",
"grunt": "^1.0.1",
"grunt-contrib-nodeunit": "^1.0.0",
"grunt-eslint": "^19.0.0",
"grunt-jsdoc": "^2.1.0",
"ink-docstrap": "^1.2.1"
}
}
Loading