mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
site: add version update date for component changedoc (#51070)
This commit is contained in:
@@ -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>
|
||||
),
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user