mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +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()
|
||||
{
|
||||
// 指令配置
|
||||
@@ -127,26 +141,11 @@ class VersionBase extends Command
|
||||
|
||||
$commits = explode("\n", $commits);
|
||||
|
||||
// 定义提交类型
|
||||
$types = [
|
||||
'feat' => '新功能',
|
||||
'fix' => '修复',
|
||||
'docs' => '文档',
|
||||
'style' => '样式',
|
||||
'refactor' => '重构',
|
||||
'perf' => '性能优化',
|
||||
'test' => '测试',
|
||||
'build' => '构建',
|
||||
'ci' => '持续集成',
|
||||
'chore' => '其他',
|
||||
'revert' => '回退',
|
||||
];
|
||||
|
||||
// 按类型分组提交
|
||||
$groupedCommits = [];
|
||||
foreach ($commits as $commit) {
|
||||
$matched = false;
|
||||
foreach ($types as $type => $desc) {
|
||||
foreach (static::COMMIT_TYPES as $type => $desc) {
|
||||
if (preg_match("/^{$type}:/i", $commit)) {
|
||||
$message = preg_replace("/^{$type}:/i", '', $commit);
|
||||
$groupedCommits[$desc][] = trim($message);
|
||||
@@ -227,21 +226,6 @@ class VersionBase extends Command
|
||||
|
||||
$commits = explode("\n", $commits);
|
||||
|
||||
// 定义提交类型
|
||||
$types = [
|
||||
'feat' => '新功能',
|
||||
'fix' => '修复',
|
||||
'docs' => '文档',
|
||||
'style' => '样式',
|
||||
'refactor' => '重构',
|
||||
'perf' => '性能优化',
|
||||
'test' => '测试',
|
||||
'build' => '构建',
|
||||
'ci' => '持续集成',
|
||||
'chore' => '其他',
|
||||
'revert' => '回退',
|
||||
];
|
||||
|
||||
// 按类型分组提交
|
||||
$groupedCommits = [];
|
||||
foreach ($commits as $commit) {
|
||||
@@ -254,7 +238,7 @@ class VersionBase extends Command
|
||||
$date = $matches[2];
|
||||
$message = $matches[3];
|
||||
|
||||
foreach ($types as $type => $desc) {
|
||||
foreach (static::COMMIT_TYPES as $type => $desc) {
|
||||
if (preg_match("/^{$type}:/i", $message)) {
|
||||
$cleanMessage = preg_replace("/^{$type}:/i", '', $message);
|
||||
$groupedCommits[$desc][] = [
|
||||
|
||||
Reference in New Issue
Block a user