-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
8249deb
commit 20c705f
Showing
15 changed files
with
1,442 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.DS_Store | ||
docs/ | ||
node_modules/ | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'](); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'](); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.