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

chore: Add Licenss and update README #1

Merged
merged 1 commit into from Aug 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2017 NHN Entertainment Corp.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
36 changes: 35 additions & 1 deletion README.md
@@ -1 +1,35 @@
# tui-release-notes
# tui-release-notes

Gather commits on tag

## Installation
```json
// package.json
devDependencies: {
...
"tui-release-notes": "git+https://github.com/nhnent/tui.release-notes.git"
...
}
```

## Usage
Register `TUI_GITHUB_TOKEN` as a environment variables

**Mac OS**
```sh
# ~/.bash_profile
export TUI_GITHUB_TOKEN=github-personal-access-toke
```

Execute `tuie` on your `project root`
```bash
# latest tag
npm run release
# specific tag
npm run release --tag={specific-tag}
# enterprise
npm run release --apiUrl={github.your-enterprise-url.com/api/v3}
```

## License
This software is licensed under the [MIT License](https://github.com/nhnent/tui.release-notes/blob/master/LICENSE).
16 changes: 10 additions & 6 deletions src/github-release.js
Expand Up @@ -31,11 +31,11 @@ let githubHelper;
* Get target tags
* Collect commits
* Make release note
* Post Github release
* Post Github release
*/
function release() {
/* check could use github-api */
if (!isValidRepositoryUrl(pkgJson) || !hasGitHubAccessToken()) {
if (!isValidRepositoryUrl(pkg) || !hasGitHubAccessToken()) {
throw new Error();
}

Expand All @@ -54,7 +54,7 @@ function release() {

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

/**
* Get repository url from package.json
* @param {JSON} pkgJson - json object defined in package.json
* @returns {string} - repository url
*/
function getRepositoryUrl(pkgJson) {
Expand All @@ -87,6 +88,7 @@ function getRepositoryUrl(pkgJson) {

/**
* Get Repository username, repository name
* @param {JSON} pkgJson - json object defined in package.json
* @returns {Object} - username and repository name
*/
function getRepositoryInfo(pkgJson) {
Expand All @@ -100,12 +102,13 @@ function getRepositoryInfo(pkgJson) {

/**
* test repository url on package.json is valid
* @param {JSON} pkgJson - json object defined in package.json
* @returns {boolean} - url validity
*/
function isValidRepositoryUrl(pkgJson) {
const pass = GIT_REPO_REGEXP.test(getRepositoryUrl(pkgJson));
if (!pass) {
console.error('Wrong repository url on package.json');
console.error('Invalid repository url on package.json');
}

return pass;
Expand Down Expand Up @@ -157,7 +160,7 @@ function getCommitLogsUntilTag(tag) {
}

/**
* Change to CommitObject
* Change to CommitObject
* @param {Array} commits - commits
* @returns {Array} - filtered commits
*/
Expand All @@ -178,6 +181,7 @@ function filterCommits(commits) {
/**
* Filter commit matches commit message conventions
* @param {string} commitMessage - commit's first line
* @returns {Array} - filtered commit objects
*/
function matchCommitMessage(commitMessage) {
const captureGroup = commitMessage.match(COMMIT_LOG_REGEXP);
Expand Down Expand Up @@ -242,7 +246,7 @@ function makeReleaseNote(commits) {
/**
* check commit type by regular expression of available types
* @param {string} type - commit type
* @returns {number}
* @returns {number}
* - index: when commit type is matched by some type's
* - -1: matches nothing
*/
Expand Down