UNPKG

@twyr/announce

Version:

CLI Tool and NPM Library for announcing a release on Github / Gitlab / etc. and on NPM

433 lines (428 loc) 17 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>GitLabWrapper - Announce CLI - API Reference</title> <meta name="description" content="Announce CLI - API Reference" /> <meta name="keywords" content="automation announce changelog cli console git github gitlab npm package publish release release-automation release-helper release-workflow semantic-release semantic-version semver semver-release terminal twyr version" /> <meta name="keyword" content="automation announce changelog cli console git github gitlab npm package publish release release-automation release-helper release-workflow semantic-release semantic-version semver semver-release terminal twyr version" /> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <script src="scripts/nav.js" defer></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav class="wrap"> <input type="text" id="nav-search" placeholder="Search" /> <h2><a href="index.html">Home</a></h2> <h2><a href="https://github.com/twyr/announce" target="_blank" class="menu-item" id="github_link">GitHub</a></h2> <h3>Classes</h3> <ul> <li><a href="GitHubWrapper.html">GitHubWrapper</a> <ul class='methods'> <li data-type='method'><a href="GitHubWrapper.html#_fetchData">_fetchData</a></li> <li data-type='method'><a href="GitHubWrapper.html#createRelease">createRelease</a></li> <li data-type='method'><a href="GitHubWrapper.html#fetchCommitAuthorInformation">fetchCommitAuthorInformation</a></li> <li data-type='method'><a href="GitHubWrapper.html#fetchCommitInformation">fetchCommitInformation</a></li> <li data-type='method'><a href="GitHubWrapper.html#fetchReleaseInformation">fetchReleaseInformation</a></li> <li data-type='method'><a href="GitHubWrapper.html#getCommitLink">getCommitLink</a></li> </ul> </li> <li><a href="GitLabWrapper.html">GitLabWrapper</a> <ul class='methods'> <li data-type='method'><a href="GitLabWrapper.html#createRelease">createRelease</a></li> <li data-type='method'><a href="GitLabWrapper.html#fetchCommitAuthorInformation">fetchCommitAuthorInformation</a></li> <li data-type='method'><a href="GitLabWrapper.html#fetchCommitInformation">fetchCommitInformation</a></li> <li data-type='method'><a href="GitLabWrapper.html#fetchReleaseInformation">fetchReleaseInformation</a></li> <li data-type='method'><a href="GitLabWrapper.html#getCommitLink">getCommitLink</a></li> </ul> </li> <li><a href="PrepareCommandClass.html">PrepareCommandClass</a> <ul class='methods'> <li data-type='method'><a href="PrepareCommandClass.html#_bumpVersion">_bumpVersion</a></li> <li data-type='method'><a href="PrepareCommandClass.html#_computeNextVersion">_computeNextVersion</a></li> <li data-type='method'><a href="PrepareCommandClass.html#_getCurrentVersion">_getCurrentVersion</a></li> <li data-type='method'><a href="PrepareCommandClass.html#_getTargetFileList">_getTargetFileList</a></li> <li data-type='method'><a href="PrepareCommandClass.html#_mergeOptions">_mergeOptions</a></li> <li data-type='method'><a href="PrepareCommandClass.html#_setupLogger">_setupLogger</a></li> <li data-type='method'><a href="PrepareCommandClass.html#_setupTasks">_setupTasks</a></li> <li data-type='method'><a href="PrepareCommandClass.html#execute">execute</a></li> </ul> </li> <li><a href="PublishCommandClass.html">PublishCommandClass</a> <ul class='methods'> <li data-type='method'><a href="PublishCommandClass.html#_getUpstreamRepositoryInfo">_getUpstreamRepositoryInfo</a></li> <li data-type='method'><a href="PublishCommandClass.html#_initializeGit">_initializeGit</a></li> <li data-type='method'><a href="PublishCommandClass.html#_mergeOptions">_mergeOptions</a></li> <li data-type='method'><a href="PublishCommandClass.html#_publishToNpm">_publishToNpm</a></li> <li data-type='method'><a href="PublishCommandClass.html#_setupLogger">_setupLogger</a></li> <li data-type='method'><a href="PublishCommandClass.html#_setupTasks">_setupTasks</a></li> <li data-type='method'><a href="PublishCommandClass.html#execute">execute</a></li> </ul> </li> <li><a href="ReleaseCommandClass.html">ReleaseCommandClass</a> <ul class='methods'> <li data-type='method'><a href="ReleaseCommandClass.html#_generateChangelog">_generateChangelog</a></li> <li data-type='method'><a href="ReleaseCommandClass.html#_generateRelease">_generateRelease</a></li> <li data-type='method'><a href="ReleaseCommandClass.html#_initializeGit">_initializeGit</a></li> <li data-type='method'><a href="ReleaseCommandClass.html#_mergeOptions">_mergeOptions</a></li> <li data-type='method'><a href="ReleaseCommandClass.html#_pushUpstream">_pushUpstream</a></li> <li data-type='method'><a href="ReleaseCommandClass.html#_restoreCode">_restoreCode</a></li> <li data-type='method'><a href="ReleaseCommandClass.html#_setupLogger">_setupLogger</a></li> <li data-type='method'><a href="ReleaseCommandClass.html#_setupTasks">_setupTasks</a></li> <li data-type='method'><a href="ReleaseCommandClass.html#_stashOrCommit">_stashOrCommit</a></li> <li data-type='method'><a href="ReleaseCommandClass.html#_summarize">_summarize</a></li> <li data-type='method'><a href="ReleaseCommandClass.html#_tagCode">_tagCode</a></li> <li data-type='method'><a href="ReleaseCommandClass.html#execute">execute</a></li> </ul> </li> </ul> </nav> <div id="main"> <h1 class="page-title">GitLabWrapper</h1> <section> <header> <h2> GitLabWrapper </h2> <div class="class-description usertext"> <p>The command class that wraps GitLab related functionality for Release and Publish.</p> </div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="GitLabWrapper"><span class="type-signature"></span>new GitLabWrapper<span class="signature">(token)</span><span class="type-signature"></span></h4> <p class="summary usertext">The wrapper class that provides an API interface for all GitLab related operations.</p> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="git_host_utilities_gitlab.js.html">git_host_utilities/gitlab.js</a>, <a href="git_host_utilities_gitlab.js.html#line13">line 13</a> </li> </ul> </dd> </dl> <div class="description usertext"> <p>The wrapper class that provides an API interface for all GitLab related operations.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>token</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"> <p>The GitLab Personal Access Token to be used to access the repositories</p> </td> </tr> </tbody> </table> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="createRelease"><span class="type-signature">(async) </span>createRelease<span class="signature">(releaseData)</span><span class="type-signature"> &rarr; {null}</span></h4> <p class="summary usertext"> <p>Given the required data, creates a release on GitLab.</p> </p> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="git_host_utilities_gitlab.js.html">git_host_utilities/gitlab.js</a>, <a href="git_host_utilities_gitlab.js.html#line126">line 126</a> </li> </ul> </dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>releaseData</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>The data required for creating a release on GitLab</p> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Nothing.</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">null</span> </dd> </dl> <h4 class="name" id="fetchCommitAuthorInformation"><span class="type-signature">(async) </span>fetchCommitAuthorInformation<span class="signature">(repository, commitLog)</span><span class="type-signature"> &rarr; {object}</span></h4> <p class="summary usertext"> <p>Given a GitLab repository, returns information about the commit author pointed to by the commitLog object.</p> </p> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="git_host_utilities_gitlab.js.html">git_host_utilities/gitlab.js</a>, <a href="git_host_utilities_gitlab.js.html#line52">line 52</a> </li> </ul> </dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>repository</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>the GitLab repository to query for the release</p> </td> </tr> <tr> <td class="name"><code>commitLog</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"> <p>the git commit object for which the author information needs to be fetched</p> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>The required information about the commit author from GitLab.</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id="fetchCommitInformation"><span class="type-signature">(async) </span>fetchCommitInformation<span class="signature">(repository, commitLog)</span><span class="type-signature"> &rarr; {object}</span></h4> <p class="summary usertext"> <p>Given a GitLab repository, returns information about the commit pointed to by the commitLog object.</p> </p> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="git_host_utilities_gitlab.js.html">git_host_utilities/gitlab.js</a>, <a href="git_host_utilities_gitlab.js.html#line32">line 32</a> </li> </ul> </dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>repository</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>the GitLab repository to query for the release</p> </td> </tr> <tr> <td class="name"><code>commitLog</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"> <p>the git commit object for which commit information needs to be fetched</p> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>The required information about the commit from GitLab.</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id="fetchReleaseInformation"><span class="type-signature">(async) </span>fetchReleaseInformation<span class="signature">(repository, releaseName)</span><span class="type-signature"> &rarr; {object}</span></h4> <p class="summary usertext"> <p>Given a GitLab repository, returns information about the release - either the latest, or the one matching the specified release name.</p> </p> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="git_host_utilities_gitlab.js.html">git_host_utilities/gitlab.js</a>, <a href="git_host_utilities_gitlab.js.html#line79">line 79</a> </li> </ul> </dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>repository</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>the GitLab repository to query for the release</p> </td> </tr> <tr> <td class="name"><code>releaseName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"> <p>the name of the release</p> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>The required information about the release from GitLab.</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id="getCommitLink"><span class="type-signature"></span>getCommitLink<span class="signature">(repository, commitLog)</span><span class="type-signature"> &rarr; {object}</span></h4> <p class="summary usertext"> <p>Given a GitLab repository, and a commit, returns the URL to access the commit directly.</p> </p> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="git_host_utilities_gitlab.js.html">git_host_utilities/gitlab.js</a>, <a href="git_host_utilities_gitlab.js.html#line150">line 150</a> </li> </ul> </dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>repository</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>the GitLab repository to query for the release</p> </td> </tr> <tr> <td class="name"><code>commitLog</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>the commit information</p> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>The URL to access the commit on GitLab.</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. </footer> <script> prettyPrint(); </script> <script src="scripts/polyfill.js"></script> <script src="scripts/linenumber.js"></script> <script src="scripts/search.js" defer></script> </body> </html>