Skip to content

Commit b47cd50

Browse files
committed
Add title to patch release changelog (#17197)
1 parent de30788 commit b47cd50

File tree

3 files changed

+31
-23
lines changed

3 files changed

+31
-23
lines changed

scripts/changelog-for-patch.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import path from "node:path";
44
import minimist from "minimist";
55
import semver from "semver";
66
import {
7+
categories,
78
changelogUnreleasedDirPath,
89
changelogUnreleasedDirs,
910
getEntries,
@@ -15,7 +16,13 @@ const { previousVersion, newVersion } = parseArgv();
1516

1617
const entries = changelogUnreleasedDirs.flatMap((dir) => {
1718
const dirPath = path.join(changelogUnreleasedDirPath, dir.name);
18-
return getEntries(dirPath);
19+
const { title } = categories.find((category) => category.dir === dir.name);
20+
21+
return getEntries(dirPath).map((entry) => {
22+
const content =
23+
entry.content.slice(0, 4) + ` ${title}:` + entry.content.slice(4);
24+
return { ...entry, content };
25+
});
1926
});
2027

2128
console.log(

scripts/draft-blog-post.js

+1-22
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import createEsmUtils from "esm-utils";
66
import fg from "fast-glob";
77
import semver from "semver";
88
import {
9+
categories,
910
changelogUnreleasedDirPath,
1011
changelogUnreleasedDirs,
1112
getEntries,
@@ -36,28 +37,6 @@ const postFile = path.join(
3637
`${new Date().toISOString().replace(/T.+/u, "")}-${nextVersion}.md`,
3738
);
3839

39-
const categories = [
40-
{ dir: "javascript", title: "JavaScript" },
41-
{ dir: "typescript", title: "TypeScript" },
42-
{ dir: "flow", title: "Flow" },
43-
{ dir: "json", title: "JSON" },
44-
{ dir: "css", title: "CSS" },
45-
{ dir: "scss", title: "SCSS" },
46-
{ dir: "less", title: "Less" },
47-
{ dir: "html", title: "HTML" },
48-
{ dir: "vue", title: "Vue" },
49-
{ dir: "angular", title: "Angular" },
50-
{ dir: "lwc", title: "LWC" },
51-
{ dir: "handlebars", title: "Ember / Handlebars" },
52-
{ dir: "graphql", title: "GraphQL" },
53-
{ dir: "markdown", title: "Markdown" },
54-
{ dir: "mdx", title: "MDX" },
55-
{ dir: "yaml", title: "YAML" },
56-
{ dir: "api", title: "API" },
57-
{ dir: "cli", title: "CLI" },
58-
{ dir: "misc", title: "Miscellaneous" },
59-
];
60-
6140
const categoriesByDir = new Map(
6241
categories.map((category) => [category.dir, category]),
6342
);

scripts/utils/changelog.js

+22
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@ export const changelogUnreleasedDirPath = path.join(
1010
"../../changelog_unreleased",
1111
);
1212

13+
export const categories = [
14+
{ dir: "javascript", title: "JavaScript" },
15+
{ dir: "typescript", title: "TypeScript" },
16+
{ dir: "flow", title: "Flow" },
17+
{ dir: "json", title: "JSON" },
18+
{ dir: "css", title: "CSS" },
19+
{ dir: "scss", title: "SCSS" },
20+
{ dir: "less", title: "Less" },
21+
{ dir: "html", title: "HTML" },
22+
{ dir: "vue", title: "Vue" },
23+
{ dir: "angular", title: "Angular" },
24+
{ dir: "lwc", title: "LWC" },
25+
{ dir: "handlebars", title: "Ember / Handlebars" },
26+
{ dir: "graphql", title: "GraphQL" },
27+
{ dir: "markdown", title: "Markdown" },
28+
{ dir: "mdx", title: "MDX" },
29+
{ dir: "yaml", title: "YAML" },
30+
{ dir: "api", title: "API" },
31+
{ dir: "cli", title: "CLI" },
32+
{ dir: "misc", title: "Miscellaneous" },
33+
];
34+
1335
export const changelogUnreleasedDirs = fs
1436
.readdirSync(changelogUnreleasedDirPath, {
1537
withFileTypes: true,

0 commit comments

Comments
 (0)