Skip to content

Commit 3680740

Browse files
authored
Merge pull request #2 from nhnent/develop
Develop
2 parents 46a4893 + 4ea117a commit 3680740

File tree

3 files changed

+66
-7
lines changed

3 files changed

+66
-7
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2017 NHN Entertainment Corp.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
# tui-release-notes
1+
# tui-release-notes
2+
3+
Gather commits on tag
4+
5+
## Installation
6+
```json
7+
// package.json
8+
devDependencies: {
9+
...
10+
"tui-release-notes": "git+https://github.com/nhnent/tui.release-notes.git"
11+
...
12+
}
13+
```
14+
15+
## Usage
16+
Register `TUI_GITHUB_TOKEN` as a environment variables
17+
18+
**Mac OS**
19+
```sh
20+
# ~/.bash_profile
21+
export TUI_GITHUB_TOKEN=github-personal-access-toke
22+
```
23+
24+
Execute `tuie` on your `project root`
25+
```bash
26+
# latest tag
27+
npm run release
28+
# specific tag
29+
npm run release --tag={specific-tag}
30+
# enterprise
31+
npm run release --apiUrl={github.your-enterprise-url.com/api/v3}
32+
```
33+
34+
## License
35+
This software is licensed under the [MIT License](https://github.com/nhnent/tui.release-notes/blob/master/LICENSE).

src/github-release.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ let githubHelper;
3131
* Get target tags
3232
* Collect commits
3333
* Make release note
34-
* Post Github release
34+
* Post Github release
3535
*/
3636
function release() {
3737
/* check could use github-api */
38-
if (!isValidRepositoryUrl(pkgJson) || !hasGitHubAccessToken()) {
38+
if (!isValidRepositoryUrl(pkg) || !hasGitHubAccessToken()) {
3939
throw new Error();
4040
}
4141

@@ -54,7 +54,7 @@ function release() {
5454

5555
/**
5656
* Get Repository configured with access token, base url
57-
* @returns {Repository} - repository
57+
* @returns {Repository} - repository
5858
* @see https://github.com/github-tools/github/blob/22b889cd48cd281812b020d85f8ea502af69ddfd/lib/Repository.js
5959
*/
6060
function getRepo() {
@@ -69,6 +69,7 @@ function getRepo() {
6969

7070
/**
7171
* Get repository url from package.json
72+
* @param {JSON} pkgJson - json object defined in package.json
7273
* @returns {string} - repository url
7374
*/
7475
function getRepositoryUrl(pkgJson) {
@@ -87,6 +88,7 @@ function getRepositoryUrl(pkgJson) {
8788

8889
/**
8990
* Get Repository username, repository name
91+
* @param {JSON} pkgJson - json object defined in package.json
9092
* @returns {Object} - username and repository name
9193
*/
9294
function getRepositoryInfo(pkgJson) {
@@ -100,12 +102,13 @@ function getRepositoryInfo(pkgJson) {
100102

101103
/**
102104
* test repository url on package.json is valid
105+
* @param {JSON} pkgJson - json object defined in package.json
103106
* @returns {boolean} - url validity
104107
*/
105108
function isValidRepositoryUrl(pkgJson) {
106109
const pass = GIT_REPO_REGEXP.test(getRepositoryUrl(pkgJson));
107110
if (!pass) {
108-
console.error('Wrong repository url on package.json');
111+
console.error('Invalid repository url on package.json');
109112
}
110113

111114
return pass;
@@ -157,7 +160,7 @@ function getCommitLogsUntilTag(tag) {
157160
}
158161

159162
/**
160-
* Change to CommitObject
163+
* Change to CommitObject
161164
* @param {Array} commits - commits
162165
* @returns {Array} - filtered commits
163166
*/
@@ -178,6 +181,7 @@ function filterCommits(commits) {
178181
/**
179182
* Filter commit matches commit message conventions
180183
* @param {string} commitMessage - commit's first line
184+
* @returns {Array} - filtered commit objects
181185
*/
182186
function matchCommitMessage(commitMessage) {
183187
const captureGroup = commitMessage.match(COMMIT_LOG_REGEXP);
@@ -242,7 +246,7 @@ function makeReleaseNote(commits) {
242246
/**
243247
* check commit type by regular expression of available types
244248
* @param {string} type - commit type
245-
* @returns {number}
249+
* @returns {number}
246250
* - index: when commit type is matched by some type's
247251
* - -1: matches nothing
248252
*/

0 commit comments

Comments
 (0)