mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-02 13:12:44 +00:00
refactor(cli): simplify release topic naming and summary generation
This commit is contained in:
1 parent
85b54b565e
commit
8787246db7
1 file changed
+3
-15
@@ -159,17 +159,6 @@ const ET_DAY = new Intl.DateTimeFormat("en-US", {
|
|||||||
month: "short",
|
month: "short",
|
||||||
day: "numeric",
|
day: "numeric",
|
||||||
});
|
});
|
||||||
/**
|
|
||||||
* The release name: the ET day the topic finished (`September 4, 2026`). The
|
|
||||||
* docs changelog titles each entry with it, so the timeline reads by day; the
|
|
||||||
* topic itself leads the body's summary sentence.
|
|
||||||
*/
|
|
||||||
const ET_NAME = new Intl.DateTimeFormat("en-US", {
|
|
||||||
timeZone: "America/New_York",
|
|
||||||
month: "long",
|
|
||||||
day: "numeric",
|
|
||||||
year: "numeric",
|
|
||||||
});
|
|
||||||
|
|
||||||
/** Topic body sections worth carrying into the changelog (skipped while still `TODO`). */
|
/** Topic body sections worth carrying into the changelog (skipped while still `TODO`). */
|
||||||
const NOTES = ["Trigger", "Invariant", "Trap"] as const;
|
const NOTES = ["Trigger", "Invariant", "Trap"] as const;
|
||||||
@@ -214,11 +203,10 @@ function render(f: Finished, tag: string, sha: string, files: Map<number, string
|
|||||||
|
|
||||||
// Blume's changelog derives each page's meta description from the opening
|
// Blume's changelog derives each page's meta description from the opening
|
||||||
// prose, stripping markdown and line breaks without adding a space — so lead
|
// prose, stripping markdown and line breaks without adding a space — so lead
|
||||||
// with one self-contained sentence and keep the fields on one `·` line. The
|
// with one self-contained sentence and keep the fields on one `·` line.
|
||||||
// release name is only the date, so the sentence names the topic.
|
|
||||||
const when = ET_WHEN.format(new Date(f.finishedAt));
|
const when = ET_WHEN.format(new Date(f.finishedAt));
|
||||||
const summary =
|
const summary =
|
||||||
`**${topic.title}** finished ${when} ET: all ${f.core.length} core problems closed, ` +
|
`Finished ${when} ET: all ${f.core.length} core problems closed, ` +
|
||||||
`${onDay.length} ${onDay.length === 1 ? "problem" : "problems"} closed that day.`;
|
`${onDay.length} ${onDay.length === 1 ? "problem" : "problems"} closed that day.`;
|
||||||
const fields: string[] = [];
|
const fields: string[] = [];
|
||||||
const scheduled = bodyField(topic.body, "Scheduled");
|
const scheduled = bodyField(topic.body, "Scheduled");
|
||||||
@@ -281,7 +269,7 @@ for (const f of finished) {
|
|||||||
files.set(Number(lc), [...(files.get(Number(lc)) ?? []), path]);
|
files.set(Number(lc), [...(files.get(Number(lc)) ?? []), path]);
|
||||||
}
|
}
|
||||||
const body = render(f, tag, sha, files);
|
const body = render(f, tag, sha, files);
|
||||||
const name = ET_NAME.format(new Date(f.finishedAt));
|
const name = topic.title;
|
||||||
|
|
||||||
if (existing) {
|
if (existing) {
|
||||||
if (existing.body === body && existing.name === name) {
|
if (existing.body === body && existing.name === name) {
|
||||||
|
|||||||
Reference in new issue
Block a user