neilmasters/semanticreleases
最新稳定版本:v1.0.0
Composer 安装命令:
composer require neilmasters/semanticreleases
包简介
Utility to manage semantic release versions
README 文档
README
The SemanticReleases contains utilities to help maintain semantic release versions.
Versioning()
Encapsulates functionality around bumping version numbers. Versioning::gerIncreasedVersion() Will accept a current
version and increase it depending on it being a major, minor or fix change.
Example usage:
$versioning = new \SemanticReleases\Util\Versioning(); $versioning->getIncreasedVersion('1.0.0'); // $increaseType defaults to major bump 2.0.0 $versioning->getIncreasedVersion('1.0.0', \SemanticReleases\Util\Versioning::MINOR); // 1.1.0 $versioning->getIncreasedVersion('1.0.0', \SemanticReleases\Util\Versioning::FIX); // 1.0.1
You can view the unit tests to see every possible combination you can throw at the getIncreasedVersion() method.
Bad version values
To facilitate conversion from one format to another getIncreasedVersion() will do a lot of work to try and convert the passed version to a semantic format.
In the event that a version passed does not follow major.minor.fix or is just completely wrong, the getIncreasedVersion() method will fix it at best or at worst just give you back a 1.0.0 version.
Examples of non standard input:
$versioning = new \SemanticReleases\Util\Versioning(); $versioning->getIncreasedVersion(1); // 2.0.0 $versioning->getIncreasedVersion(1.1); // 2.0.0 $versioning->getIncreasedVersion('a'); // 1.0.0 $versioning->getIncreasedVersion('a.b'); // 1.0.0 $versioning->getIncreasedVersion('a.b.c'); // 1.0.0
To summarise, you will get a correct major.minor.fix version number, regardless what you throw at it. Now, if that is the value you wanted is a different matter.
Empty version
In the event of an empty version we convert it to 0 so the returned version will be 1.0.0. Useful if you are initialising versions.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-23