mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-14 06:36:46 +00:00
🔧 refactor(changelog): streamline commit history parsing with improved output format and eliminate redundancy
This commit is contained in:
@@ -14,42 +14,18 @@ name('changelog');
|
|||||||
state(['entries' => []]);
|
state(['entries' => []]);
|
||||||
|
|
||||||
mount(function () {
|
mount(function () {
|
||||||
// Führen Sie den Git-Befehl aus, um die Commit-Historie zu erhalten
|
$output = shell_exec('git log -n1000 --pretty=format:"%H|%s|%an|%ad" --date=format:"%Y-%m-%d %H:%M:%S"');
|
||||||
$gitLog = shell_exec('git log --pretty=format:"%h|%an|%ad%n%s%n%b" --date=iso --no-merges');
|
$lines = explode("\n", trim($output));
|
||||||
|
|
||||||
// Parsen Sie die Ausgabe des Git-Befehls
|
|
||||||
$rawEntries = explode("\n\n", $gitLog);
|
|
||||||
$entries = [];
|
$entries = [];
|
||||||
$uniqueMessages = [];
|
|
||||||
|
|
||||||
foreach ($rawEntries as $entry) {
|
foreach ($lines as $line) {
|
||||||
$lines = explode("\n", $entry);
|
[$hash, $message, $author, $date] = explode('|', $line);
|
||||||
if (count($lines) < 3) {
|
$entries[] = [
|
||||||
continue;
|
'hash' => $hash,
|
||||||
}
|
'message' => $message,
|
||||||
|
'author' => $author,
|
||||||
$header = explode('|', array_shift($lines));
|
'date' => $date,
|
||||||
if (count($header) !== 3) {
|
];
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
[$hash, $author, $date] = $header;
|
|
||||||
$message = implode("\n", $lines);
|
|
||||||
|
|
||||||
// Format the date to a human-readable format
|
|
||||||
$dateTime = new DateTime($date);
|
|
||||||
$formattedDate = $dateTime->format('F j, Y, g:i a');
|
|
||||||
|
|
||||||
// Überprüfen, ob die Nachricht bereits existiert
|
|
||||||
if (!in_array($message, $uniqueMessages, true)) {
|
|
||||||
$uniqueMessages[] = $message;
|
|
||||||
$entries[] = [
|
|
||||||
'hash' => $hash,
|
|
||||||
'message' => $message,
|
|
||||||
'author' => $author,
|
|
||||||
'date' => $formattedDate,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$this->entries = $entries;
|
$this->entries = $entries;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user