Add title to patch release changelog (#17197)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-03-03 09:07:40 +08:00
1 parent a9e2afca55
commit 4e64d7fd82
3 files changed
+31 -23

No files matched your search

+8 -1
View File
@@ -4,6 +4,7 @@ import path from "node:path";
import minimist from "minimist";
import semver from "semver";
import {
categories,
changelogUnreleasedDirPath,
changelogUnreleasedDirs,
getEntries,
@@ -15,7 +16,13 @@ const { previousVersion, newVersion } = parseArgv();
const entries = changelogUnreleasedDirs.flatMap((dir) => {
const dirPath = path.join(changelogUnreleasedDirPath, dir.name);
return getEntries(dirPath);
const { title } = categories.find((category) => category.dir === dir.name);
return getEntries(dirPath).map((entry) => {
const content =
entry.content.slice(0, 4) + ` ${title}:` + entry.content.slice(4);
return { ...entry, content };
});
});
console.log(
+1 -22
View File
@@ -6,6 +6,7 @@ import createEsmUtils from "esm-utils";
import fg from "fast-glob";
import semver from "semver";
import {
categories,
changelogUnreleasedDirPath,
changelogUnreleasedDirs,
getEntries,
@@ -36,28 +37,6 @@ const postFile = path.join(
`${new Date().toISOString().replace(/T.+/u, "")}-${nextVersion}.md`,
);
const categories = [
{ dir: "javascript", title: "JavaScript" },
{ dir: "typescript", title: "TypeScript" },
{ dir: "flow", title: "Flow" },
{ dir: "json", title: "JSON" },
{ dir: "css", title: "CSS" },
{ dir: "scss", title: "SCSS" },
{ dir: "less", title: "Less" },
{ dir: "html", title: "HTML" },
{ dir: "vue", title: "Vue" },
{ dir: "angular", title: "Angular" },
{ dir: "lwc", title: "LWC" },
{ dir: "handlebars", title: "Ember / Handlebars" },
{ dir: "graphql", title: "GraphQL" },
{ dir: "markdown", title: "Markdown" },
{ dir: "mdx", title: "MDX" },
{ dir: "yaml", title: "YAML" },
{ dir: "api", title: "API" },
{ dir: "cli", title: "CLI" },
{ dir: "misc", title: "Miscellaneous" },
];
const categoriesByDir = new Map(
categories.map((category) => [category.dir, category]),
);
+22
View File
@@ -10,6 +10,28 @@ export const changelogUnreleasedDirPath = path.join(
"../../changelog_unreleased",
);
export const categories = [
{ dir: "javascript", title: "JavaScript" },
{ dir: "typescript", title: "TypeScript" },
{ dir: "flow", title: "Flow" },
{ dir: "json", title: "JSON" },
{ dir: "css", title: "CSS" },
{ dir: "scss", title: "SCSS" },
{ dir: "less", title: "Less" },
{ dir: "html", title: "HTML" },
{ dir: "vue", title: "Vue" },
{ dir: "angular", title: "Angular" },
{ dir: "lwc", title: "LWC" },
{ dir: "handlebars", title: "Ember / Handlebars" },
{ dir: "graphql", title: "GraphQL" },
{ dir: "markdown", title: "Markdown" },
{ dir: "mdx", title: "MDX" },
{ dir: "yaml", title: "YAML" },
{ dir: "api", title: "API" },
{ dir: "cli", title: "CLI" },
{ dir: "misc", title: "Miscellaneous" },
];
export const changelogUnreleasedDirs = fs
.readdirSync(changelogUnreleasedDirPath, {
withFileTypes: true,