mirror of
https://github.com/one-among-us/data.git
synced 2024-11-10 13:24:50 +08:00
[+] feature: entry won;t show on the homepage
Feature requested by @Twinsherry
This commit is contained in:
parent
188569aa91
commit
903bc812b6
@ -28,14 +28,14 @@ const people = fs.readdirSync(peopleDir).map(person => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
interface HData {
|
interface HData {
|
||||||
commentOnly: string[],
|
commentOnly: string[]
|
||||||
exclude: string[],
|
exclude: string[]
|
||||||
notShowOnHome: string[]
|
notShowOnHome: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const hdata = JSON.parse(fs.readFileSync(path.join(projectRoot, DATA_DIR, "hdata.json")).toString()) as HData;
|
const hdata = JSON.parse(fs.readFileSync(path.join(projectRoot, DATA_DIR, "hdata.json")).toString()) as HData;
|
||||||
const commentOnlyList = hdata.commentOnly;
|
const commentOnlyList = hdata.commentOnly;
|
||||||
const excludeList = hdata.exclude;
|
const excludeList = commentOnlyList.concat(hdata.exclude);
|
||||||
const notShowOnHomeList = hdata.notShowOnHome;
|
const notShowOnHomeList = hdata.notShowOnHome;
|
||||||
|
|
||||||
interface PeopleMeta {
|
interface PeopleMeta {
|
||||||
@ -57,6 +57,7 @@ function buildPeopleInfoAndList() {
|
|||||||
|
|
||||||
// Compiled meta of list of people for the front page (contains keys id, name, profileUrl)
|
// Compiled meta of list of people for the front page (contains keys id, name, profileUrl)
|
||||||
const peopleList: PeopleMeta[] = [];
|
const peopleList: PeopleMeta[] = [];
|
||||||
|
const peopleHomeList: PeopleMeta[] = [];
|
||||||
|
|
||||||
// For each person
|
// For each person
|
||||||
for (const { dirname, srcPath, distPath } of people) {
|
for (const { dirname, srcPath, distPath } of people) {
|
||||||
@ -118,14 +119,19 @@ function buildPeopleInfoAndList() {
|
|||||||
} as PeopleMeta;
|
} as PeopleMeta;
|
||||||
|
|
||||||
// Add meta to people list
|
// Add meta to people list
|
||||||
if (peopleList.filter(it => it.id == peopleMeta.id).length == 0)
|
if (peopleList.filter(it => it.id == peopleMeta.id).length == 0) {
|
||||||
peopleList.push(peopleMeta);
|
peopleList.push(peopleMeta);
|
||||||
|
if (!hdata.notShowOnHome.includes(peopleMeta.id))
|
||||||
|
peopleHomeList.push(peopleMeta)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peopleList.sort((a, b) => b.sortKey.localeCompare(a.sortKey))
|
peopleList.sort((a, b) => b.sortKey.localeCompare(a.sortKey))
|
||||||
|
peopleHomeList.sort((a, b) => b.sortKey.localeCompare(a.sortKey))
|
||||||
|
|
||||||
// Write people-list.json
|
// 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-list${lang}.json`), JSON.stringify(peopleList));
|
||||||
|
fs.writeFileSync(path.join(projectRoot, DIST_DIR, `people-home-list${lang}.json`), JSON.stringify(peopleHomeList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user