From d5aa119358106f0b34fe6464d0b908105cf77ca3 Mon Sep 17 00:00:00 2001 From: Pierre Vanduynslager Date: Mon, 1 Jan 2018 18:57:05 -0500 Subject: [PATCH] fix: fix typos and capitalization --- README.md | 27 +++++++++++++-------------- index.js | 12 ++++++------ lib/publish.js | 2 +- lib/verify.js | 8 ++++---- package.json | 2 +- test/integration.test.js | 16 ++++++++-------- test/publish.test.js | 10 +++++----- test/verify.test.js | 4 ++-- 8 files changed, 40 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index f9dd2b9b..ab139fd0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # @semantic-release/github -Set of [semantic-release](https://github.com/semantic-release/semantic-release) plugins for publishing a -[Github release](https://help.github.com/articles/about-releases). +Set of [Semantic-release](https://github.com/semantic-release/semantic-release) plugins for publishing a +[GitHub release](https://help.github.com/articles/about-releases). [![Travis](https://img.shields.io/travis/semantic-release/github.svg)](https://travis-ci.org/semantic-release/github) [![Codecov](https://img.shields.io/codecov/c/github/semantic-release/github.svg)](https://codecov.io/gh/semantic-release/github) @@ -14,17 +14,16 @@ the [assets](#assets) option configuration. ## publish -Publish a [Github release](https://help.github.com/articles/about-releases), optionally uploading files. +Publish a [GitHub release](https://help.github.com/articles/about-releases), optionally uploading files. ## Configuration -### Github Repository authentication +### GitHub authentication -The `Github` authentication configuration is **required** and can be set via +The GitHub authentication configuration is **required** and can be set via [environment variables](#environment-variables). -Only the [personal token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line) -authentication is supported. +Follow the [Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line) documentation to obtain an authentication token. The token has to be made available in your CI environment via the `GH_TOKEN` environment variable. ### Environment variables @@ -50,8 +49,8 @@ Can be a [glob](https://github.com/isaacs/node-glob#glob-primer) or and `Array` | Property | Description | Default | | -------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------ | | `path` | **Required.** A [glob](https://github.com/isaacs/node-glob#glob-primer) to identify the files to upload. | - | -| `name` | The name of the downloadable file on the Github release. | File name extracted from the `path`. | -| `label` | Short description of the file displayed on the Github release. | - | +| `name` | The name of the downloadable file on the GitHub release. | File name extracted from the `path`. | +| `label` | Short description of the file displayed on the GitHub release. | - | Each entry in the `assets` `Array` is globbed individually. A [glob](https://github.com/isaacs/node-glob#glob-primer) can be a `String` (`"dist/**/*.js"` or `"dist/mylib.js"`) or an `Array` of `String`s that will be globbed together @@ -59,7 +58,7 @@ can be a `String` (`"dist/**/*.js"` or `"dist/mylib.js"`) or an `Array` of `Stri If a directory is configured, all the files under this directory and its children will be included. -Files can be included enven if they have a match in `.gitignore`. +Files can be included even if they have a match in `.gitignore`. ##### `assets` examples @@ -70,15 +69,15 @@ files. `[{path: 'dist/MyLibrary.js', label: 'MyLibrary JS distribution'}, {path: 'dist/MyLibrary.css', label: 'MyLibrary CSS distribution'}]`: include the `dist/MyLibrary.js` and `dist/MyLibrary.css` files, and label them `MyLibrary JS -distribution` and `MyLibrary CSS distribution` in the Github release. +distribution` and `MyLibrary CSS distribution` in the GitHub release. `[['dist/**/*.{js,css}', '!**/*.min.*'], {path: 'build/MyLibrary.zip', label: 'MyLibrary'}]`: include all the `js` and `css` files in the `dist` directory and its sub-directories excluding the minified version, plus the -`build/MyLibrary.zip` file and label it `MyLibrary` in the Github release. +`build/MyLibrary.zip` file and label it `MyLibrary` in the GitHub release. ### Usage -The plugins are used by default by [semantic-release](https://github.com/semantic-release/semantic-release) so no +The plugins are used by default by [Semantic-release](https://github.com/semantic-release/semantic-release) so no specific configuration is required if `githubUrl` and `githubApiPathPrefix` are set via environment variable. Each individual plugin can be disabled, replaced or used with other plugins in the `package.json`: @@ -93,7 +92,7 @@ Each individual plugin can be disabled, replaced or used with other plugins in t } ``` -Options can be set within the plugin definition in the `semantic-release` configuration file: +Options can be set within the plugin definition in the Semantic-release configuration file: ```json { diff --git a/index.js b/index.js index 23418b94..68e1d919 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,10 @@ -const verifyGithub = require('./lib/verify'); -const publishGithub = require('./lib/publish'); +const verifyGitHub = require('./lib/verify'); +const publishGitHub = require('./lib/publish'); let verified; async function verifyConditions(pluginConfig, {options, logger}) { - // If the Github publish plugin is used and has `assets` configured, validate it now in order to prevent any release if the configuration is wrong + // If the GitHub publish plugin is used and has `assets` configured, validate it now in order to prevent any release if the configuration is wrong if (options.publish) { const publishPlugin = (Array.isArray(options.publish) ? options.publish : [options.publish]).find( config => config.path && config.path === '@semantic-release/github' @@ -14,16 +14,16 @@ async function verifyConditions(pluginConfig, {options, logger}) { } } - await verifyGithub(pluginConfig, options, logger); + await verifyGitHub(pluginConfig, options, logger); verified = true; } async function publish(pluginConfig, {nextRelease, options, logger}) { if (!verified) { - await verifyGithub(pluginConfig, options, logger); + await verifyGitHub(pluginConfig, options, logger); verified = true; } - await publishGithub(pluginConfig, options, nextRelease, logger); + await publishGitHub(pluginConfig, options, nextRelease, logger); } module.exports = {verifyConditions, publish}; diff --git a/lib/publish.js b/lib/publish.js index e59422cb..26da0600 100644 --- a/lib/publish.js +++ b/lib/publish.js @@ -36,7 +36,7 @@ module.exports = async (pluginConfig, {branch, repositoryUrl}, {version, gitHead } const {data: {html_url: htmlUrl, upload_url: uploadUrl}} = await github.repos.createRelease(release); - logger.log('Published Github release: %s', htmlUrl); + logger.log('Published GitHub release: %s', htmlUrl); if (assets && assets.length > 0) { const globbedAssets = await globAssets(assets); diff --git a/lib/verify.js b/lib/verify.js index 8ae2a97e..a9cf6e2e 100644 --- a/lib/verify.js +++ b/lib/verify.js @@ -29,15 +29,15 @@ module.exports = async (pluginConfig, {repositoryUrl}, logger) => { const {name: repo, owner} = parseGithubUrl(repositoryUrl); if (!owner || !repo) { throw new SemanticReleaseError( - `The git repository URL ${repositoryUrl} is not a valid Github URL.`, + `The git repository URL ${repositoryUrl} is not a valid GitHub URL.`, 'EINVALIDGITURL' ); } if (githubUrl) { - logger.log('Verify Github authentication (%s)', urlJoin(githubUrl, githubApiPathPrefix)); + logger.log('Verify GitHub authentication (%s)', urlJoin(githubUrl, githubApiPathPrefix)); } else { - logger.log('Verify Github authentication'); + logger.log('Verify GitHub authentication'); } const github = getClient(githubToken, githubUrl, githubApiPathPrefix); @@ -47,7 +47,7 @@ module.exports = async (pluginConfig, {repositoryUrl}, logger) => { ({data: {permissions: {push}}} = await github.repos.get({repo, owner})); } catch (err) { if (err.code === 401) { - throw new SemanticReleaseError('Invalid Github token.', 'EINVALIDGHTOKEN'); + throw new SemanticReleaseError('Invalid GitHub token.', 'EINVALIDGHTOKEN'); } else if (err.code === 404) { throw new SemanticReleaseError(`The repository ${owner}/${repo} doesn't exist.`, 'EMISSINGREPO'); } diff --git a/package.json b/package.json index 8eb712cb..0deeab7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@semantic-release/github", - "description": "Set of semantic-release plugins for publishing a Github release", + "description": "Set of semantic-release plugins for publishing a GitHub release", "version": "0.0.0-development", "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)", "bugs": { diff --git a/test/integration.test.js b/test/integration.test.js index 63ca5671..118693bf 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -36,7 +36,7 @@ test.afterEach.always(() => { nock.cleanAll(); }); -test.serial('Verify Github auth', async t => { +test.serial('Verify GitHub auth', async t => { process.env.GITHUB_TOKEN = 'github_token'; const owner = 'test_user'; const repo = 'test_repo'; @@ -50,7 +50,7 @@ test.serial('Verify Github auth', async t => { t.true(github.isDone()); }); -test.serial('Verify Github auth with publish options', async t => { +test.serial('Verify GitHub auth with publish options', async t => { process.env.GITHUB_TOKEN = 'github_token'; const owner = 'test_user'; const repo = 'test_repo'; @@ -67,7 +67,7 @@ test.serial('Verify Github auth with publish options', async t => { t.true(github.isDone()); }); -test.serial('Verify Github auth and assets config', async t => { +test.serial('Verify GitHub auth and assets config', async t => { process.env.GH_TOKEN = 'github_token'; const owner = 'test_user'; const repo = 'test_repo'; @@ -153,8 +153,8 @@ test.serial('Publish a release with an array of assets', async t => { await t.context.m.publish({assets}, {nextRelease, options, logger: t.context.logger}); - t.deepEqual(t.context.log.args[0], ['Verify Github authentication']); - t.deepEqual(t.context.log.args[1], ['Published Github release: %s', releaseUrl]); + t.deepEqual(t.context.log.args[0], ['Verify GitHub authentication']); + t.deepEqual(t.context.log.args[1], ['Published GitHub release: %s', releaseUrl]); t.deepEqual(t.context.log.args[2], ['Published file %s', assetUrl]); t.deepEqual(t.context.log.args[3], ['Published file %s', otherAssetUrl]); t.true(github.isDone()); @@ -162,7 +162,7 @@ test.serial('Publish a release with an array of assets', async t => { t.true(githubUpload2.isDone()); }); -test.serial('Verify Github auth and release', async t => { +test.serial('Verify GitHub auth and release', async t => { process.env.GH_TOKEN = 'github_token'; const owner = 'test_user'; const repo = 'test_repo'; @@ -212,8 +212,8 @@ test.serial('Verify Github auth and release', async t => { await t.notThrows(t.context.m.verifyConditions({}, {options, logger: t.context.logger})); await t.context.m.publish({assets}, {nextRelease, options, logger: t.context.logger}); - t.deepEqual(t.context.log.args[0], ['Verify Github authentication']); - t.deepEqual(t.context.log.args[1], ['Published Github release: %s', releaseUrl]); + t.deepEqual(t.context.log.args[0], ['Verify GitHub authentication']); + t.deepEqual(t.context.log.args[1], ['Published GitHub release: %s', releaseUrl]); t.deepEqual(t.context.log.args[2], ['Published file %s', otherAssetUrl]); t.deepEqual(t.context.log.args[3], ['Published file %s', assetUrl]); t.true(github.isDone()); diff --git a/test/publish.test.js b/test/publish.test.js index ed4296ec..68aca938 100644 --- a/test/publish.test.js +++ b/test/publish.test.js @@ -60,7 +60,7 @@ test.serial('Publish a release', async t => { await publish(pluginConfig, options, nextRelease, t.context.logger); - t.deepEqual(t.context.log.args[0], ['Published Github release: %s', releaseUrl]); + t.deepEqual(t.context.log.args[0], ['Published GitHub release: %s', releaseUrl]); t.true(github.isDone()); }); @@ -89,7 +89,7 @@ test.serial('Publish a release with an existing tag', async t => { await publish(pluginConfig, options, nextRelease, t.context.logger); - t.deepEqual(t.context.log.args[0], ['Published Github release: %s', releaseUrl]); + t.deepEqual(t.context.log.args[0], ['Published GitHub release: %s', releaseUrl]); t.true(github.isDone()); }); @@ -130,7 +130,7 @@ test.serial('Publish a release with one asset', async t => { await publish(pluginConfig, options, nextRelease, t.context.logger); - t.deepEqual(t.context.log.args[0], ['Published Github release: %s', releaseUrl]); + t.deepEqual(t.context.log.args[0], ['Published GitHub release: %s', releaseUrl]); t.deepEqual(t.context.log.args[1], ['Published file %s', assetUrl]); t.true(github.isDone()); t.true(githubUpload.isDone()); @@ -182,7 +182,7 @@ test.serial('Publish a release with one asset and custom github url', async t => await publish(pluginConfig, options, nextRelease, t.context.logger); - t.deepEqual(t.context.log.args[0], ['Published Github release: %s', releaseUrl]); + t.deepEqual(t.context.log.args[0], ['Published GitHub release: %s', releaseUrl]); t.deepEqual(t.context.log.args[1], ['Published file %s', assetUrl]); t.true(github.isDone()); t.true(githubUpload.isDone()); @@ -216,7 +216,7 @@ test.serial('Publish a release with an array of missing assets', async t => { await publish(pluginConfig, options, nextRelease, t.context.logger); - t.deepEqual(t.context.log.args[0], ['Published Github release: %s', releaseUrl]); + t.deepEqual(t.context.log.args[0], ['Published GitHub release: %s', releaseUrl]); t.deepEqual(t.context.error.args[0], [ 'The asset %s cannot be read, and will be ignored.', 'test/fixtures/missing.txt', diff --git a/test/verify.test.js b/test/verify.test.js index 531e6e17..a0cd5da8 100644 --- a/test/verify.test.js +++ b/test/verify.test.js @@ -63,7 +63,7 @@ test.serial('Verify package, token and repository access and custom URL', async ); t.true(github.isDone()); - t.deepEqual(t.context.log.args[0], ['Verify Github authentication (%s)', 'https://othertesturl.com:9090/prefix']); + t.deepEqual(t.context.log.args[0], ['Verify GitHub authentication (%s)', 'https://othertesturl.com:9090/prefix']); }); test.serial('Verify package, token and repository with environment variables', async t => { @@ -79,7 +79,7 @@ test.serial('Verify package, token and repository with environment variables', a await t.notThrows(verify({}, {repositoryUrl: `git@othertesturl.com:${owner}/${repo}.git`}, t.context.logger)); t.true(github.isDone()); - t.deepEqual(t.context.log.args[0], ['Verify Github authentication (%s)', 'https://othertesturl.com:443/prefix']); + t.deepEqual(t.context.log.args[0], ['Verify GitHub authentication (%s)', 'https://othertesturl.com:443/prefix']); }); test.serial('Verify package, token and repository access with alternative environment varialbes', async t => {