runas-plugin-semver
v0.2.0
Published
Plugin semver
Downloads
15
Readme
Main Index:
Available Commands:
FLOWS
STEPS
PLUGINS
semver (Version dealing with semver)
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" ].
- 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.
- Second element in array is the prereleaseTag to be append at the end of the version. (f.i. -beta, -alpha, ...)
(1) Strategy could be:
Semver strategies
All strategies of inc function of this module: https://www.npmjs.com/package/semver (major, premajor, minor, preminor, patch, prepatch, or prerelease)
"auto" Strategy
Search for the last tag and calculate strategy between the actual version.
"remove" Strategy
Remove prereleaseTag from version
"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