Changelog img generation script tweaks

This commit is contained in:
Kalle
2026-09-20 18:03:21 +03:00
parent 65f29db7e1
commit 68f008079c
3 changed files with 12 additions and 7 deletions

View File

@@ -22,12 +22,12 @@ export const DISCORD_EMOJI_NAMES: Record<NavIcon, string> = {
articles: "articles",
vods: "vods",
art: "art",
"tier-list-maker": "tier_list_maker",
"tier-list-maker": "tierlistmaker",
links: "links",
maps: "maps",
medal: "medal",
t: "t",
u: "u",
u: "user",
associations: "associations",
badges: "badges",
luti: "luti",

View File

@@ -80,7 +80,7 @@ The image posted on social media on update day is built from the entry files in
1) Every commit with a user facing change adds one `changelog/YYYY-MM-DD-<slug>.md` per change. Frontmatter is `navItem` (optional, one of `NAV_ICONS` or a list of them such as `navItem: [calendar, scrims]`, omitted = sendou.ink logo) and `type` (`feature` or `bug`). The body is a one line headline, optionally followed by a markdown bullet list for a bigger release. Entries are never deleted, they are the update history.
2) Preview and tweak the graphic on the `/admin/changelog-image` page (dev only). Without a `?since=<sha>` it renders every entry ever committed.
3) With the dev server running, `pnpm run changelog:image <sha-of-previous-update-commit>` writes `scripts/output/update-<date>.png` from the entries added since that commit, copies the image to the clipboard.
3) With the dev server running, `pnpm run changelog:image <sha-of-previous-update-commit>` (add `--port <port>` if the dev server is not on the default port) writes `scripts/output/update-<date>.png` from the entries added since that commit, copies the image to the clipboard.
## Add a new translation string

View File

@@ -8,7 +8,7 @@ import { execFile } from "node:child_process";
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { promisify } from "node:util";
import { parseArgs, promisify } from "node:util";
import { chromium, type Page } from "@playwright/test";
import { format } from "date-fns";
import sharp from "sharp";
@@ -25,7 +25,12 @@ try {
// .env is optional, the dev server port can also come from the environment
}
const CHANGELOG_IMAGE_PAGE_URL = `http://localhost:${process.env.PORT ?? 5173}/admin/changelog-image`;
const { values: args, positionals } = parseArgs({
options: { port: { type: "string" } },
allowPositionals: true,
});
const CHANGELOG_IMAGE_PAGE_URL = `http://localhost:${args.port ?? process.env.PORT ?? 5173}/admin/changelog-image`;
const OUT_DIR = fileURLToPath(new URL("./output", import.meta.url));
@@ -40,10 +45,10 @@ interface ChangelogEntry {
}
async function main() {
const since = process.argv[2];
const since = positionals[0];
if (!since) {
throw new Error(
"Usage: pnpm run changelog:image <sha-of-previous-update-commit>",
"Usage: pnpm run changelog:image <sha-of-previous-update-commit> [--port <dev-server-port>]",
);
}