mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-07 18:42:49 +08:00
refactor: 版本内容整理使用统一的类型配置
This commit is contained in:
@@ -25,6 +25,20 @@ class VersionBase extends Command
|
|||||||
'- 升级权限管理模式',
|
'- 升级权限管理模式',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected const COMMIT_TYPES = [
|
||||||
|
'feat' => '新功能',
|
||||||
|
'fix' => '修复',
|
||||||
|
'docs' => '文档',
|
||||||
|
'style' => '样式',
|
||||||
|
'refactor' => '重构',
|
||||||
|
'perf' => '性能优化',
|
||||||
|
'test' => '测试',
|
||||||
|
'build' => '构建',
|
||||||
|
'ci' => '持续集成',
|
||||||
|
'chore' => '其他',
|
||||||
|
'revert' => '回退',
|
||||||
|
];
|
||||||
|
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
// 指令配置
|
// 指令配置
|
||||||
@@ -127,26 +141,11 @@ class VersionBase extends Command
|
|||||||
|
|
||||||
$commits = explode("\n", $commits);
|
$commits = explode("\n", $commits);
|
||||||
|
|
||||||
// 定义提交类型
|
|
||||||
$types = [
|
|
||||||
'feat' => '新功能',
|
|
||||||
'fix' => '修复',
|
|
||||||
'docs' => '文档',
|
|
||||||
'style' => '样式',
|
|
||||||
'refactor' => '重构',
|
|
||||||
'perf' => '性能优化',
|
|
||||||
'test' => '测试',
|
|
||||||
'build' => '构建',
|
|
||||||
'ci' => '持续集成',
|
|
||||||
'chore' => '其他',
|
|
||||||
'revert' => '回退',
|
|
||||||
];
|
|
||||||
|
|
||||||
// 按类型分组提交
|
// 按类型分组提交
|
||||||
$groupedCommits = [];
|
$groupedCommits = [];
|
||||||
foreach ($commits as $commit) {
|
foreach ($commits as $commit) {
|
||||||
$matched = false;
|
$matched = false;
|
||||||
foreach ($types as $type => $desc) {
|
foreach (static::COMMIT_TYPES as $type => $desc) {
|
||||||
if (preg_match("/^{$type}:/i", $commit)) {
|
if (preg_match("/^{$type}:/i", $commit)) {
|
||||||
$message = preg_replace("/^{$type}:/i", '', $commit);
|
$message = preg_replace("/^{$type}:/i", '', $commit);
|
||||||
$groupedCommits[$desc][] = trim($message);
|
$groupedCommits[$desc][] = trim($message);
|
||||||
@@ -227,21 +226,6 @@ class VersionBase extends Command
|
|||||||
|
|
||||||
$commits = explode("\n", $commits);
|
$commits = explode("\n", $commits);
|
||||||
|
|
||||||
// 定义提交类型
|
|
||||||
$types = [
|
|
||||||
'feat' => '新功能',
|
|
||||||
'fix' => '修复',
|
|
||||||
'docs' => '文档',
|
|
||||||
'style' => '样式',
|
|
||||||
'refactor' => '重构',
|
|
||||||
'perf' => '性能优化',
|
|
||||||
'test' => '测试',
|
|
||||||
'build' => '构建',
|
|
||||||
'ci' => '持续集成',
|
|
||||||
'chore' => '其他',
|
|
||||||
'revert' => '回退',
|
|
||||||
];
|
|
||||||
|
|
||||||
// 按类型分组提交
|
// 按类型分组提交
|
||||||
$groupedCommits = [];
|
$groupedCommits = [];
|
||||||
foreach ($commits as $commit) {
|
foreach ($commits as $commit) {
|
||||||
@@ -254,7 +238,7 @@ class VersionBase extends Command
|
|||||||
$date = $matches[2];
|
$date = $matches[2];
|
||||||
$message = $matches[3];
|
$message = $matches[3];
|
||||||
|
|
||||||
foreach ($types as $type => $desc) {
|
foreach (static::COMMIT_TYPES as $type => $desc) {
|
||||||
if (preg_match("/^{$type}:/i", $message)) {
|
if (preg_match("/^{$type}:/i", $message)) {
|
||||||
$cleanMessage = preg_replace("/^{$type}:/i", '', $message);
|
$cleanMessage = preg_replace("/^{$type}:/i", '', $message);
|
||||||
$groupedCommits[$desc][] = [
|
$groupedCommits[$desc][] = [
|
||||||
|
|||||||
Reference in New Issue
Block a user