runas-plugin-semver

Plugin semver

Usage no npm install needed!

<script type="module">
  import runasPluginSemver from 'https://cdn.skypack.dev/runas-plugin-semver';
</script>

README

Main Index:

Available Commands:

FLOWS

STEPS

PLUGINS

semver (Version dealing with semver)

[Index]

Description

Needs runas-plugin-scm-git plugin!!

Plugin with all the functionality to write version on json files in this.params.jsonFiles (bower.json, package.json,...) according GitFlow terms.

How to use this plugin:

  Promise.resolve()
    .then(() => this.semverConfig(options, true)
    .then((config) => this.semverStrategy(config))
    .then((config) => this.semverSaveVersion(config));

Where options is an array ['prerelease' , 'beta'] ( meaning this [ "strategy" , "prereleaseTag" ] )

Transitive parameters

This parameters should be set on the step:

  • --versionDescription: [String], default: 'chore(): change version file:' : Commentary displayed on commit when files change.
  • --jsonFiles: [Array], default: ['bower.json', 'package.json'] : Sets json files to search in order to be changed, used by runas-plugin-semver

Addons

this.semverGetVersionConfig

No params, return configuration object.

this.semverConfig

Param Description
options See options section
usePretag Boolean: true -> use pre_ tag to get last version
preVersion Version force to be initial version

Return: Promise with config object. The version file is inside this object.

Options: f.i. [ "prerelease", "beta" ].
  1. First element in array is the strategy that is going to be apply when the step in the flow/branch is executed. If the strategy is not valid and error will be thrown.
  2. Second element in array is the prereleaseTag to be append at the end of the version. (f.i. -beta, -alpha, ...)

(1) Strategy could be:

    1. Semver strategies

      All strategies of inc function of this module: https://www.npmjs.com/package/semver (major, premajor, minor, preminor, patch, prepatch, or prerelease)

    1. "auto" Strategy

      Search for the last tag and calculate strategy between the actual version.

    1. "remove" Strategy

      Remove prereleaseTag from version

    1. "timestamp" Strategy

      add .timestamp to any version.

this.semverStrategy

Apply semver strategy configured on options of this.semverConfig

Param Description
config Object with the version file and configurations of the versioning processs

return Promise with the config object.

semverSaveVersion

Write version in the version file and commit the change into the actual branch.

Param Description
config Object with the version file and configurations of the versioning processs

return Promise with the result.

Needed Plugins

  • runas-plugin-scm-git