ixnode / php-branch-diagram-builder
PHP 分支图构建器
v1.2.2
2023-07-21 21:30 UTC
Requires
- php: ^8.0
- ext-imagick: *
- adhocore/cli: ^v1.0.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.2
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2024-09-21 23:53:09 UTC
README
一个库,通过配置文件将分支策略可视化为图像,并将其包含在如 README.md 等文档文件中。
安装
$ composer require ixnode/php-branch-diagram-builder --dev
用法
创建一个名为 .pbdb.yml
的文件,内容如下
title: Trunk Based Development width: 1500 branches: - name: 'main' system: 'Productive system' color-light: '#0151ad' color-dark: '#024796' - name: 'development' system: 'Development system' color-light: '#01aaad' color-dark: '#029496' - name: ['feature', 1] system: 'Local development' color-light: '#70b964' color-dark: '#46733f' - name: ['feature', 2] system: 'Local development' color-light: '#f9a61b' color-dark: '#c48416' - name: ['feature', 3] system: 'Local development' color-light: '#ed1164' color-dark: '#b30c4c' steps: - type: 'init' source: null target: 'main' - type: 'checkout' source: 'main' target: 'development' - type: 'checkout' source: 'development' target: ['feature', 1] - type: 'commit' source: ['feature', 1] - type: 'checkout' source: 'development' target: ['feature', 2] - type: 'commit' source: ['feature', 2] - type: 'merge' source: ['feature', 1] target: 'development' - type: 'checkout' source: 'development' target: 'main' - type: 'merge' source: 'development' target: ['feature', 2] - type: 'commit' source: ['feature', 2] - type: 'merge' source: ['feature', 2] target: 'development' - type: 'merge' source: 'development' target: 'main' - type: 'checkout' source: 'development' target: ['feature', 3] - type: 'commit' source: ['feature', 3] - type: 'merge' source: ['feature', 3] target: 'development' - type: 'merge' source: 'development' target: 'main'
执行以下命令
$ vendor/bin/pbdb-builder build .pbdb.yml
它将创建以下图像
这可以轻松地添加到您的 README.md 文件中

开发
克隆应用程序
❯ git clone git@github.com:ixnode/php-branch-diagram-builder.git && \ cd php-branch-diagram-builder
Composer 安装
❯ php -v PHP 8.0.11 (cli) (built: Sep 23 2021 22:03:11) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.11, Copyright (c) Zend Technologies with Zend OPcache v8.0.11, Copyright (c), by Zend Technologies ❯ composer -V Composer version 2.1.9 2021-10-05 09:47:38 ❯ composer install ...
运行测试
❯ composer test
结果
> phpunit tests --testdox PHPUnit 9.5.10 by Sebastian Bergmann and contributors. Branch (Ixnode\PHPBranchDiagramBuilder\Tests\Branch) ✔ Branch ✔ Branch name ✔ Branch title Step (Ixnode\PHPBranchDiagramBuilder\Tests\Step) ✔ 1) Test StepTest class (unknown: NULL -> master). ✔ 2) Test StepTest class (init: master -> master). ✔ 3) Test StepTest class (init: NULL -> master). ✔ 4) Test StepTest class (checkout: NULL -> master). ✔ 5) Test StepTest class (checkout: master -> NULL). ✔ 6) Test StepTest class (checkout: master -> master). ✔ 7) Test StepTest class (checkout: master -> develop). ✔ 8) Test StepTest class (commit: NULL -> master). ✔ 9) Test StepTest class (commit: master -> NULL). ✔ 10) Test StepTest class (commit: master -> master). ✔ 11) Test StepTest class (commit: master -> develop). ✔ 12) Test StepTest class (merge: NULL -> master). ✔ 13) Test StepTest class (merge: develop -> NULL). ✔ 14) Test StepTest class (merge: develop -> develop). ✔ 15) Test StepTest class (merge: develop -> master). Time: 00:00.015, Memory: 6.00 MB OK (18 tests, 35 assertions) > phpstan analyse --level 8 --memory-limit 256M src tests 24/24 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% [OK] No errors > vendor/bin/php-cs-fixer --dry-run --using-cache=no --rules=@PSR12 fix src Loaded config default. Checked all files in 0.262 seconds, 14.000 MB memory used > vendor/bin/php-cs-fixer --dry-run --using-cache=no --rules=@PSR12 fix tests Loaded config default. Checked all files in 0.035 seconds, 12.000 MB memory used
检查应用程序的当前版本
# Git version ❯ git describe v1.0.1 # VERSION file version ❯ cat VERSION 1.0.1
更改版本
根据您的需求增加版本号: <MAJOR>
.<MINOR>
.<PATCH>
增加版本
# Show version ❯ cat VERSION 1.0.2 # Push changed VERSION file ❯ git add VERSION ❯ git commit -m "Add version $(cat VERSION)" ❯ git push
标记应用程序(git)
# Tag and push new git tag ❯ git tag -a "v$(cat VERSION)" -m "version v$(cat VERSION)" ❯ git push origin "v$(cat VERSION)"
packagist.org
如果您已将您的存储库连接到 packagist.org,请检查结果
A. 作者
- Björn Hempel bjoern@hempel.li - 初始工作 - https://github.com/bjoern-hempel
B. 许可证
本教程根据 MIT 许可证授权 - 有关详细信息,请参阅 LICENSE.md 文件
C. 结束语
祝您玩得开心! :)