mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Add versioning system, changelog page, and release skill
Replace calver (YYYY.MM.DD+sha) with marketing versioning (X.Y.Z), starting at 9.9.0. Add changelog page at /changelog with Keep a Changelog parsing, pre-release banner, and expandable entries linked to GitLab releases. Add VersionCheck component that shows a "What's new" toast when the app version changes. Add release skill for managing versioned releases with changelog and git tagging.
This commit is contained in:
20 files changed
+754
-43
No files matched your search
@@ -0,0 +1,81 @@
|
||||
/** Category types from Keep a Changelog format. */
|
||||
type ChangelogCategory = 'Added' | 'Changed' | 'Deprecated' | 'Removed' | 'Fixed' | 'Security';
|
||||
|
||||
/** A single version entry in the changelog. */
|
||||
interface ChangelogEntry {
|
||||
version: string;
|
||||
date: string;
|
||||
sections: {
|
||||
category: ChangelogCategory;
|
||||
items: string[];
|
||||
}[];
|
||||
}
|
||||
|
||||
/** Apply basic typographic transformations to a changelog item string. */
|
||||
function prettify(text: string): string {
|
||||
return text
|
||||
.replace(/ -- /g, ' \u2014 ') // space-dash-dash-space → em dash
|
||||
.replace(/(\w)--(\w)/g, '$1\u2013$2') // word--word → en dash
|
||||
.replace(/ (\S+)$/, '\u00A0$1'); // prevent orphaned last word
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a Keep a Changelog formatted markdown string into structured data.
|
||||
* @see https://keepachangelog.com/
|
||||
*/
|
||||
function parseChangelog(markdown: string): ChangelogEntry[] {
|
||||
const entries: ChangelogEntry[] = [];
|
||||
let current: ChangelogEntry | null = null;
|
||||
let currentCategory: ChangelogCategory | null = null;
|
||||
|
||||
for (const line of markdown.split('\n')) {
|
||||
// Match version heading: ## [X.Y.Z] - YYYY-MM-DD
|
||||
const versionMatch = line.match(/^## \[([^\]]+)\]\s*-\s*(.+)$/);
|
||||
if (versionMatch) {
|
||||
current = { version: versionMatch[1], date: versionMatch[2].trim(), sections: [] };
|
||||
entries.push(current);
|
||||
currentCategory = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Match category heading: ### Added, ### Changed, etc.
|
||||
const categoryMatch = line.match(/^### (.+)$/);
|
||||
if (categoryMatch && current) {
|
||||
currentCategory = categoryMatch[1].trim() as ChangelogCategory;
|
||||
current.sections.push({ category: currentCategory, items: [] });
|
||||
continue;
|
||||
}
|
||||
|
||||
// Match list item: - Description
|
||||
const itemMatch = line.match(/^- (.+)$/);
|
||||
if (itemMatch && current) {
|
||||
const section = current.sections[current.sections.length - 1];
|
||||
if (section) {
|
||||
section.items.push(prettify(itemMatch[1]));
|
||||
} else {
|
||||
// Item without a category heading — treat as "Changed"
|
||||
current.sections.push({ category: 'Changed', items: [prettify(itemMatch[1])] });
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Lines that don't start with "- " but aren't blank may be a continuation or
|
||||
// freeform text after the version heading (e.g. "Initial release of Shakespeare").
|
||||
const trimmed = line.trim();
|
||||
if (trimmed && current && !trimmed.startsWith('#')) {
|
||||
const section = current.sections[current.sections.length - 1];
|
||||
if (section) {
|
||||
// Append to last item or add new item
|
||||
section.items.push(prettify(trimmed));
|
||||
} else {
|
||||
// Freeform text under version with no category — store in a generic section
|
||||
current.sections.push({ category: 'Changed', items: [prettify(trimmed)] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
export { parseChangelog };
|
||||
export type { ChangelogEntry, ChangelogCategory };
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
import { NPool, NRelay1 } from '@nostrify/nostrify';
|
||||
import type { NostrEvent, NostrSigner } from '@nostrify/nostrify';
|
||||
import type { NostrSigner } from '@nostrify/nostrify';
|
||||
|
||||
import { DotAI } from '../DotAI';
|
||||
import { buildAppEvent } from '../appEvent';
|
||||
|
||||
Reference in new issue
Block a user