diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d680812 --- /dev/null +++ b/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. diff --git a/README.md b/README.md index 631401e..a45cfb5 100644 --- a/README.md +++ b/README.md @@ -1 +1,35 @@ -# tui-release-notes \ No newline at end of file +# 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). diff --git a/src/github-release.js b/src/github-release.js index c020ebe..726a2ae 100755 --- a/src/github-release.js +++ b/src/github-release.js @@ -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(); } @@ -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() { @@ -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) { @@ -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) { @@ -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; @@ -157,7 +160,7 @@ function getCommitLogsUntilTag(tag) { } /** - * Change to CommitObject + * Change to CommitObject * @param {Array} commits - commits * @returns {Array} - filtered commits */ @@ -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); @@ -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 */