site: add version update date for component changedoc (#51070)

This commit is contained in:
thinkasany
2024-09-29 18:02:55 +08:00
committed by GitHub
parent 9b779b1cd8
commit d9c778ca5f
2 changed files with 11 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ interface ChangelogInfo {
version: string;
changelog: string;
refs: string[];
releaseDate: string;
}
function matchDeprecated(v: string): MatchDeprecatedResult {
@@ -243,6 +244,7 @@ const ComponentChangelog: React.FC<ComponentChangelogProps> = (props) => {
</Popover>
)}
</Typography.Title>
{changelogList[0].releaseDate}
<RenderChangelogList changelogList={changelogList} styles={styles} />
</Typography>
),

View File

@@ -92,6 +92,7 @@ const miscKeys = [
// let lastGroup = '';
let lastVersion = '';
let lastReleaseDate = '';
// Split with lines
const lines = content.split(/[\n\r]+/).filter((line) => line.trim());
@@ -99,7 +100,7 @@ const miscKeys = [
// Changelog map
const componentChangelog: Record<
string,
{ version: string; changelog: string; refs: string[] }[]
{ version: string; changelog: string; refs: string[]; releaseDate: string }[]
> = {};
Object.keys(componentNameMap).forEach((name) => {
componentChangelog[name] = [];
@@ -119,6 +120,12 @@ const miscKeys = [
continue;
}
// Get release date
const matchReleaseDate = line.match(/`(\d{4}-\d{2}-\d{2})`/);
if (matchReleaseDate) {
lastReleaseDate = matchReleaseDate[1];
}
// Start when get version
if (!lastVersion) {
continue;
@@ -175,6 +182,7 @@ const miscKeys = [
version: lastVersion,
changelog: changelogLine,
refs,
releaseDate: lastReleaseDate,
});
matched = true;
}