1
0
mirror of https://github.com/one-among-us/data.git synced 2024-11-22 11:14:53 +08:00

[+] birthday list

This commit is contained in:
Elihuso Quigley 2024-05-30 22:45:35 +08:00
parent ff30ff538a
commit 803574e899

View File

@ -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));
}
}