PrepareCommandClass

PrepareCommandClass

The command class that handles all the prepare operations.

Constructor

new PrepareCommandClass(mode)

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

Source:

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

Replaces the old version string with the new version string.

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

_computeNextVersion(ctxt, task) → {null}

Computes the next version to be applied based on current version, the series, and the version ladder - and returns the string representation of it.

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

_getCurrentVersion(ctxt, task) → {null}

Returns the version contained in the package.json 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) _getTargetFileList(ctxt, task) → {null}

Looks at all the files in the project folder/sub-folders, removes files ignored by .gitignore, then removes files in folders marked ignore in the config, and returns the remaining.

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

_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 prepare the codebase for the next release.

This method does 2 things:

  • Generates the next version string based on the current one, the option passed in, and the pre-defined version ladder
  • Parses the source files for the current version string, and replaces it with the next one

Source:
Parameters:
Name Type Description
options object

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

Returns:

Nothing.

Type
null