PublishCommandClass

PublishCommandClass

The command class that handles all the publish operations.

Constructor

new PublishCommandClass(mode)

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

Source:

The command class that implements the "publish" 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) _getUpstreamRepositoryInfo(ctxt, task) → {null}

Retrieves the upstream repository information, and sets a POJO with that info into 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

_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(options) → {object}

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

Source:
Parameters:
Name Type Description
options object

Parsed command-line options, or options passed in via API

Returns:

Merged options - input options > configured options.

Type
object

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

Retrieves the release assets from GitHub, and publishes them to NPM.

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}

Creates a logger in CLI mode or uses the passed in logger object in API mode - and returns it.

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) execute(options) → {null}

The main method to publish the Git Host release to NPM.

This method does 2 things:

  • Gets the URL to the compressed asset for the last/specified release from the Git Host
  • Publishes the asset to NPM

Source:
Parameters:
Name Type Description
options object

Parsed command-line options, or options passed in via API

Returns:

Nothing.

Type
null