From 803574e89972a76cb8775e369c6003fc0f65a630 Mon Sep 17 00:00:00 2001 From: Elihuso Quigley Date: Thu, 30 May 2024 22:45:35 +0800 Subject: [PATCH] [+] birthday list --- scripts/build.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/build.ts b/scripts/build.ts index bba1ead7..94ed04a3 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -48,6 +48,7 @@ function buildPeopleInfoAndList() { // Compiled meta of list of people for the front page (contains keys id, name, profileUrl) const peopleList: PeopleMeta[] = []; const peopleHomeList: PeopleMeta[] = []; + const birthdayList = [] as [string, string][] // For each person for (const { dirname, srcPath, distPath } of people) { @@ -78,6 +79,10 @@ function buildPeopleInfoAndList() { catch (e) { console.log(`Unable to calculate age for ${dirname}`) } } + if (info.id && info.info && info.info.born) { + birthdayList.push([info.id, info.info.born]) + } + // Convert info dict to [[key, value], ...] // And add info k-v pairs from markdown to the info object in json5 info.info = [...Object.entries(mdMeta.info ?? {}), ...Object.entries(info.info ?? {})] @@ -125,6 +130,7 @@ function buildPeopleInfoAndList() { // Write people-list.json fs.writeFileSync(path.join(projectRoot, DIST_DIR, `people-list${lang}.json`), JSON.stringify(peopleList)); fs.writeFileSync(path.join(projectRoot, DIST_DIR, `people-home-list${lang}.json`), JSON.stringify(peopleHomeList)); + fs.writeFileSync(path.join(projectRoot, DIST_DIR, 'birthday-list.json'), JSON.stringify(birthdayList)); } }