ReleaseCommandClass

ReleaseCommandClass

The command class that creates a release on a git host (Github / GitLab / BitBucket / etc.).

Constructor

new ReleaseCommandClass(mode)

The command class that implements the "release" step of the workflow.

Source:

The command class that implements the "release" step of the workflow. Please see README.md for the details of what this step involves.

Parameters:
Name Type Description
mode object

Set the current run mode - CLI or API

Methods

(async) _generateChangelog(ctxt, task) → {null}

Generates a CHANGELOG from the relevant Git Log events, and commits the modified file.

Source:
Parameters:
Name Type Description
ctxt object

Task context containing the options object returned by the _mergeOptions method

task object

Reference to the task that is running

Returns:

Nothing.

Type
null

(async) _generateRelease(ctxt, task) → {null}

Creates releases for each of the configured upstreams.

Source:
Parameters:
Name Type Description
ctxt object

Task context containing the options object returned by the _mergeOptions method

task object

Reference to the task that is running

Returns:

Nothing.

Type
null

_initializeGit(ctxt, task) → {null}

Creates a Git client instance for the current project repository and sets it on the context.

Source:
Parameters:
Name Type Description
ctxt object

Task context containing the options object returned by the _mergeOptions method

task object

Reference to the task that is running

Returns:

Nothing.

Type
null

_mergeOptions(configOptions, cliOptions) → {object}

Merges options passed in with configured ones - and puts in sane defaults if neither is available.

Source:
Parameters:
Name Type Description
configOptions object

Options passed in from cosmiConfig / calling module

cliOptions object

Options passed in from the CLI

Returns:

Merged options - input options > configured options.

Type
object

(async) _pushUpstream(ctxt, task) → {null}

Pushes new commits/tags to the configured upstream git remote.

Source:
Parameters:
Name Type Description
ctxt object

Task context containing the options object returned by the _mergeOptions method

task object

Reference to the task that is running

Returns:

Nothing.

Type
null

(async) _restoreCode(ctxt, task) → {null}

If code was stashed earlier in the cycle, pops it out.

Source:
Parameters:
Name Type Description
ctxt object

Task context containing the options object returned by the _mergeOptions method

task object

Reference to the task that is running

Returns:

Nothing.

Type
null

_setupLogger(options) → {object}

Logger for API mode, otherwise null

Source:
Parameters:
Name Type Description
options object

merged options object returned by the _mergeOptions method

Returns:

Logger object with info / error functions.

Type
object

_setupTasks() → {object}

Setup the list of tasks to be run

Source:
Returns:

Tasks as Listr.

Type
object

(async) _stashOrCommit(ctxt, task) → {null}

Depending on the configuration, stashes/commits code in the current branch - if required.

Source:
Parameters:
Name Type Description
ctxt object

Task context containing the options object returned by the _mergeOptions method

task object

Reference to the task that is running

Returns:

Nothing.

Type
null

(async) _summarize(ctxt, task) → {null}

Print success if everything went through, else print error information.

Source:
Parameters:
Name Type Description
ctxt object

Task context containing the options object returned by the _mergeOptions method

task object

Reference to the task that is running

Returns:

Nothing.

Type
null

(async) _tagCode(ctxt, task) → {null}

Tags the codebase.

Source:
Parameters:
Name Type Description
ctxt object

Task context containing the options object returned by the _mergeOptions method

task object

Reference to the task that is running

Returns:

Nothing.

Type
null

(async) execute(configOptions, cliOptions) → {null}

The main method to tag/release the codebase on Github / GitLab / etc.

This method does 3 things:

  • Generates the changelog - features/fixes added to the code since the last tag/release
  • Commits, tags, pushes to Github / GitLab / etc.
  • Creates a release using the tag and the generated changelog

Source:
Parameters:
Name Type Description
configOptions object

Options via cosmiConfig, or via API

cliOptions object

Options via the CLI

Returns:

Nothing.

Type
null