Skip to content

Commit

Permalink
Release 0.5.0 (#22)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alexcanessa authored Sep 26, 2016
1 parent 8249deb commit 20c705f
Show file tree
Hide file tree
Showing 15 changed files with 1,442 additions and 307 deletions.
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](https://github.com/github-tools/github-release-notes/blob/develop/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

0 comments on commit 20c705f

Please sign in to comment.