feat: improve changelog readbility
Some checks failed
🚀 Lint & Test & Deploy / release (push) Failing after 2m41s
Some checks failed
🚀 Lint & Test & Deploy / release (push) Failing after 2m41s
This commit is contained in:
@@ -60,6 +60,8 @@ Maintenance / CI
|
|||||||
|
|
||||||
## v0.0.2 (2026-02-04)
|
## v0.0.2 (2026-02-04)
|
||||||
|
|
||||||
|
Fixes
|
||||||
|
|
||||||
fix(ci): actually deploy on tags
|
fix(ci): actually deploy on tags
|
||||||
fix(app): correctly handle false value in settings
|
fix(app): correctly handle false value in settings
|
||||||
-> This caused a bug where random seed could not be false.
|
-> This caused a bug where random seed could not be false.
|
||||||
@@ -68,6 +70,8 @@ fix(app): correctly handle false value in settings
|
|||||||
|
|
||||||
## v0.0.1 (2026-02-03)
|
## v0.0.1 (2026-02-03)
|
||||||
|
|
||||||
|
Chore
|
||||||
|
|
||||||
chore: format
|
chore: format
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,15 +1,23 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
type Change = { type: string; content: string };
|
import { Details } from '@nodarium/ui';
|
||||||
|
|
||||||
|
type ReleaseBlock = {
|
||||||
|
header: string;
|
||||||
|
sections: { title: string; items: { type: string; text?: string; url?: string; linkText?: string; linkUrl?: string; message?: string; content?: string }[] }[];
|
||||||
|
commits: { type: string; linkText: string; linkUrl: string; message: string }[];
|
||||||
|
};
|
||||||
|
|
||||||
const typeMap: Record<string, string> = {
|
const typeMap: Record<string, string> = {
|
||||||
fix: 'bg-layer-2 bg-red-800',
|
fix: 'bg-red-800',
|
||||||
feat: 'bg-layer-2 bg-green-800',
|
feat: 'bg-green-800',
|
||||||
chore: 'bg-layer-2 bg-gray-800',
|
chore: 'bg-gray-800',
|
||||||
docs: 'bg-layer-2 bg-blue-800',
|
docs: 'bg-blue-800',
|
||||||
refactor: 'bg-layer-2 bg-purple-800',
|
refactor: 'bg-purple-800',
|
||||||
default: 'bg-layer-2 text-text'
|
default: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const sectionHeaders = ['Features', 'Fixes', 'Maintenance / CI', 'Maintenance'];
|
||||||
|
|
||||||
async function fetchChangelog() {
|
async function fetchChangelog() {
|
||||||
const res = await fetch('/CHANGELOG.md');
|
const res = await fetch('/CHANGELOG.md');
|
||||||
return await res.text();
|
return await res.text();
|
||||||
@@ -20,59 +28,84 @@
|
|||||||
return await res.json();
|
return await res.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseChangelog(md: string) {
|
function parseChangelog(md: string): ReleaseBlock[] {
|
||||||
const lines = md.split('\n');
|
const lines = md.split('\n');
|
||||||
const parsed: (string | Change)[] = [];
|
const releases: ReleaseBlock[] = [];
|
||||||
|
let currentRelease: ReleaseBlock | null = null;
|
||||||
|
|
||||||
for (let line of lines) {
|
for (const rawLine of lines) {
|
||||||
line = line.trim();
|
const line = rawLine.trim();
|
||||||
if (!line) continue;
|
if (!line) continue;
|
||||||
|
|
||||||
if (line === '---') {
|
if (line === '---') {
|
||||||
parsed.push({ type: 'hr', content: '' });
|
currentRelease = null;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Headers
|
|
||||||
if (line.startsWith('## ')) {
|
if (line.startsWith('## ')) {
|
||||||
parsed.push(line.replace('## ', ''));
|
currentRelease = {
|
||||||
|
header: line.replace('## ', ''),
|
||||||
|
sections: [],
|
||||||
|
commits: []
|
||||||
|
};
|
||||||
|
releases.push(currentRelease);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit type
|
if (!currentRelease) continue;
|
||||||
const match = line.match(/^(fix|feat|chore|docs|refactor)(\(|:)/i);
|
|
||||||
if (match) {
|
if (line.startsWith('### ')) {
|
||||||
parsed.push({ type: match[1].toLowerCase(), content: line });
|
currentRelease.commits = [];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other lines
|
const commitMatch = line.match(/^- \[([^\]]+)\]\(([^)]+)\)(.+)$/);
|
||||||
parsed.push({ type: 'default', content: line });
|
if (commitMatch) {
|
||||||
|
currentRelease.commits.push({
|
||||||
|
type: 'commit',
|
||||||
|
linkText: commitMatch[1],
|
||||||
|
linkUrl: commitMatch[2],
|
||||||
|
message: commitMatch[3].trim()
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sectionHeaders.includes(line)) {
|
||||||
|
currentRelease.sections.push({ title: line, items: [] });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lastSection = currentRelease.sections.at(-1);
|
||||||
|
if (lastSection) {
|
||||||
|
const match = line.match(/^(fix|feat|chore|docs|refactor)(\(|:)/i);
|
||||||
|
if (match) {
|
||||||
|
lastSection.items.push({ type: match[1].toLowerCase(), content: line });
|
||||||
|
} else {
|
||||||
|
lastSection.items.push({ type: 'default', content: line });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove trailing horizontal rule
|
return releases;
|
||||||
let lastLine = parsed.at(-1);
|
|
||||||
if (
|
|
||||||
lastLine !== undefined
|
|
||||||
&& typeof lastLine !== 'string'
|
|
||||||
&& lastLine.type === 'hr'
|
|
||||||
) {
|
|
||||||
parsed.pop();
|
|
||||||
}
|
|
||||||
|
|
||||||
return parsed;
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="p-4 font-mono text-text">
|
<div class="p-4 font-mono text-text overflow-y-auto max-h-full">
|
||||||
{#await Promise.all([fetchChangelog(), fetchGitInfo()])}
|
{#await Promise.all([fetchChangelog(), fetchGitInfo()])}
|
||||||
<p>Loading...</p>
|
<p>Loading...</p>
|
||||||
{:then [md, git]}
|
{:then [md, git]}
|
||||||
<div class="mb-4 p-3 bg-layer-2 text-xs">
|
<div class="mb-4 p-3 bg-layer-2 text-xs rounded">
|
||||||
<p><strong>Branch:</strong> {git.branch}</p>
|
<p><strong>Branch:</strong> {git.branch}</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Commit:</strong>
|
<strong>Commit:</strong>
|
||||||
{git.sha.slice(0, 7)} – {git.commit_message}
|
<a
|
||||||
|
href="https://git.max-richter.dev/max/nodarium/commit/{git.sha}"
|
||||||
|
class="link"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{git.sha.slice(0, 7)}
|
||||||
|
</a>
|
||||||
|
– {git.commit_message}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Commits since last release:</strong>
|
<strong>Commits since last release:</strong>
|
||||||
@@ -84,27 +117,48 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#each parseChangelog(md) as item (item)}
|
{#each parseChangelog(md) as release}
|
||||||
{#if typeof item === 'string'}
|
<hr class="border-outline my-4" />
|
||||||
<h2 class="text-xl font-semibold mt-4 mb-4 text-layer-1">{item}</h2>
|
<h2 class="text-xl font-semibold mt-4 mb-3 text-layer-1">{release.header}</h2>
|
||||||
{:else if item.type === 'hr'}{:else}
|
|
||||||
<p class="py-1 mb-1 leading-8 border-b border-b-outline last:border-b-0">
|
{#each release.sections as section}
|
||||||
{#if item.type !== 'default'}
|
<h3 class="text-base font-semibold mt-3 mb-2 text-layer-2">{section.title}</h3>
|
||||||
<span
|
{#each section.items as item}
|
||||||
class="
|
{#if item.type === 'default'}
|
||||||
p-1 rounded-sm opacity-80 font-semibold {typeMap[
|
<p class="py-1 leading-7">{item.content}</p>
|
||||||
item.type
|
|
||||||
]}
|
|
||||||
"
|
|
||||||
>
|
|
||||||
{item.content.split(':')[0]}
|
|
||||||
</span>
|
|
||||||
{item.content.split(':').slice(1).join(':').trim()}
|
|
||||||
{:else}
|
{:else}
|
||||||
{item.content}
|
<p class="py-1 leading-7">
|
||||||
|
<span
|
||||||
|
class="p-1 rounded-sm opacity-80 font-semibold {typeMap[item.type] ?? 'bg-layer-2'}"
|
||||||
|
>
|
||||||
|
{item.content?.split(':')[0]}
|
||||||
|
</span>
|
||||||
|
{item.content?.split(':').slice(1).join(':').trim()}
|
||||||
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
</p>
|
{/each}
|
||||||
|
{/each}
|
||||||
|
|
||||||
|
{#if release.commits.length > 0}
|
||||||
|
<Details title="All Commits" transparent>
|
||||||
|
{#each release.commits as item}
|
||||||
|
<p class="py-1 leading-7">
|
||||||
|
<a href={item.linkUrl} class="link" target="_blank">{item.linkText}</a>
|
||||||
|
{' '}{item.message}
|
||||||
|
</p>
|
||||||
|
{/each}
|
||||||
|
</Details>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
{/await}
|
{/await}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.link {
|
||||||
|
color: #60a5fa;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
1
app/static/.gitignore
vendored
1
app/static/.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
nodes/
|
nodes/
|
||||||
CHANGELOG.md
|
CHANGELOG.md
|
||||||
|
git.json
|
||||||
|
|||||||
Reference in New Issue
Block a user