From 49950ca60c625701ab6a6df7b2c42de9cb86174a Mon Sep 17 00:00:00 2001 From: Elihuso Quigley Date: Sat, 18 May 2024 18:19:23 +0800 Subject: [PATCH] [+] trigger list --- data/hdata.json | 3 +++ scripts/build.ts | 18 +++--------------- scripts/data.ts | 26 +++++++++++++++++++++----- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/data/hdata.json b/data/hdata.json index ca4eab82..827cbbaa 100644 --- a/data/hdata.json +++ b/data/hdata.json @@ -8,5 +8,8 @@ ], "actualHide": [ "__shi_Yumiaoya__" + ], + "trigger": [ + "__shi_Yumiaoya__" ] } diff --git a/scripts/build.ts b/scripts/build.ts index b74d5e8a..a2fd946c 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -9,6 +9,7 @@ import metadataParser from 'markdown-yaml-metadata-parser'; import { renderMdx } from "./mdx.js"; import moment from "moment"; import { handleFeatures } from "./feature.js"; +import { HData, PeopleMeta } from "./data.js"; const PUBLIC_DIR = "public"; @@ -27,26 +28,12 @@ const people = fs.readdirSync(peopleDir).map(person => ({ distPath: path.join(projectRoot, DIST_DIR, PEOPLE_DIR, person) })); -interface HData { - commentOnly: string[] - exclude: string[] - notShowOnHome: string[] - actualHide: string[] -} - const hdata = JSON.parse(fs.readFileSync(path.join(projectRoot, DATA_DIR, "hdata.json")).toString()) as HData; const commentOnlyList = hdata.commentOnly; const excludeList = commentOnlyList.concat(hdata.exclude); const notShowOnHomeList = hdata.notShowOnHome; const actualHide = hdata.actualHide; - -interface PeopleMeta { - id: string - name: string - profileUrl: string - path: string - sortKey: string -} +const trigger = hdata.trigger; // Transform `info.json5` to `info.json`. // Extract metadata from `people/${dirname}/info.json5` to `dist/people-list.json`. @@ -184,6 +171,7 @@ function copyPeopleAssets() { // Copy files `public` to dist. function copyPublic() { fs.copySync(path.join(projectRoot, PUBLIC_DIR), path.join(projectRoot, DIST_DIR)); + fs.writeFileSync(path.join(DIST_DIR, 'trigger-list.json'), JSON.stringify(trigger as string[])); } function copyComments() { diff --git a/scripts/data.ts b/scripts/data.ts index 00acacb2..af5820c2 100644 --- a/scripts/data.ts +++ b/scripts/data.ts @@ -1,6 +1,22 @@ +export interface HData { + commentOnly: string[]; + exclude: string[]; + notShowOnHome: string[]; + actualHide: string[]; + trigger: string[]; +} + +export interface PeopleMeta { + id: string; + name: string; + profileUrl: string; + path: string; + sortKey: string; +} + export interface BannerData { - type: string, - icon: string, - title: string, - text: string -} \ No newline at end of file + type: string; + icon: string; + title: string; + text: string; +}