added a changelog section

This commit is contained in:
2026-05-31 19:21:38 +01:00
parent 2c72bac2e2
commit 8e0c34158c
10 changed files with 191 additions and 38 deletions
+1
View File
@@ -7,6 +7,7 @@
<nav class="nav">
<a href="/">Home</a>
<a href="/posts">Posts</a>
<a href="/changelog">Changelog</a>
</nav>
{/snippet}
+1
View File
@@ -1,4 +1,5 @@
<title>Doloro's Site (Which resides on the internet)</title>
<div>
<h1>hi</h1>
</div>
+53
View File
@@ -0,0 +1,53 @@
export const prerender = true;
import { execSync } from 'child_process';
const GITLOGCMD = `
git log --pretty=format:"COMMIT:%h|%ad|%s|%an|%aE" --all --numstat --date=unix | awk '
/^COMMIT:/ {
if (commit) print commit "|" add "|" del
commit = substr($0, 8)
add = 0; del = 0
}
/^[0-9]/ { add += $1; del += $2 }
END { if (commit) print commit "|" add "|" del }'
`
// Example Commit Output
// 2c72bac|1779833088|just file, docker file and website css fixes|Doloro1978|doloroo@proton.me|39|2
export type commit = {
hash: string,
date: Date,
title: string,
auther: string,
email: string,
additions: number,
deletions: number,
}
export async function load() {
const raw = execSync(GITLOGCMD).toString();
const lines = raw.split('\n');
// console.log(lines);
const commits: commit[] = []
for (var x of lines) {
const [hash, unix, title, auther, email, add, del] = x.split("|")
var date = new Date(+unix * 1000);
commits.push({
hash: hash,
date: date,
title: title,
auther: auther,
email: email,
additions: +add,
deletions: +del,
})
}
return {
data: {
commits: commits
}
};
}
+16
View File
@@ -0,0 +1,16 @@
<script>
import { commitCard } from "./commitCard.svelte";
let { data } = $props();
let commits = data.data.commits;
import "./card.scss";
</script>
<table class="commitContainer">
<caption>Git Commits of the website repo</caption>
<tbody>
{#each commits as commit}
{@render commitCard(commit)}
{/each}
</tbody>
</table>
+38
View File
@@ -0,0 +1,38 @@
.commitContainer {
display: flex;
flex-direction: column;
gap: 2px;
align-items: center;
}
.commitCard {
display: flex;
gap: 10px;
flex-direction: row;
padding: 3px;
background-color: var(--card-raised);
border-width: 3px;
border-style: outset;
border-color: var(--card-border);
width: fit-content;
}
.boxedUp {
border-width: 2px;
border-style: inset;
border-color: black;
padding-left: 2px;
padding-right: 2px;
}
.additions {
background-color: var(--success);
}
.deletions {
background-color: var(--error);
}
.field {
background-color: var(--card-field);
}
+30
View File
@@ -0,0 +1,30 @@
<script module lang="ts">
import { commit } from "./+page.server.ts";
import "./card.scss";
export { commitCard };
</script>
{#snippet commitCard(commit: commit)}
{#if commit.additions}
<tr class="boxedUp field">
<th scope="row" class="boxedUp field">
{commit.hash}
</th>
<th class="boxedUp field">
{commit.title}
</th>
<th class="boxedUp field">
{commit.date.getDate()}/{commit.date.getUTCMonth()}/{commit.date.getUTCFullYear()}
- {#if commit.date.getUTCHours() < 10}0{/if}{commit.date.getHours()}:{#if commit.date.getUTCMinutes() < 10}0{/if}{commit.date
.getUTCMinutes()
.toString()}
</th>
<th class="boxedUp additions">
+{commit.additions}
</th>
<th class="boxedUp deletions">
-{commit.deletions}
</th>
</tr>
{/if}
{/snippet}