[+] trigger list

pull/226/head
Elihuso Quigley 2024-05-18 18:19:23 +08:00
parent 7c50a77b98
commit 49950ca60c
3 changed files with 27 additions and 20 deletions

View File

@ -8,5 +8,8 @@
], ],
"actualHide": [ "actualHide": [
"__shi_Yumiaoya__" "__shi_Yumiaoya__"
],
"trigger": [
"__shi_Yumiaoya__"
] ]
} }

View File

@ -9,6 +9,7 @@ import metadataParser from 'markdown-yaml-metadata-parser';
import { renderMdx } from "./mdx.js"; import { renderMdx } from "./mdx.js";
import moment from "moment"; import moment from "moment";
import { handleFeatures } from "./feature.js"; import { handleFeatures } from "./feature.js";
import { HData, PeopleMeta } from "./data.js";
const PUBLIC_DIR = "public"; const PUBLIC_DIR = "public";
@ -27,26 +28,12 @@ const people = fs.readdirSync(peopleDir).map(person => ({
distPath: path.join(projectRoot, DIST_DIR, PEOPLE_DIR, 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 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 = commentOnlyList.concat(hdata.exclude); const excludeList = commentOnlyList.concat(hdata.exclude);
const notShowOnHomeList = hdata.notShowOnHome; const notShowOnHomeList = hdata.notShowOnHome;
const actualHide = hdata.actualHide; const actualHide = hdata.actualHide;
const trigger = hdata.trigger;
interface PeopleMeta {
id: string
name: string
profileUrl: string
path: string
sortKey: string
}
// Transform `info.json5` to `info.json`. // Transform `info.json5` to `info.json`.
// Extract metadata from `people/${dirname}/info.json5` to `dist/people-list.json`. // Extract metadata from `people/${dirname}/info.json5` to `dist/people-list.json`.
@ -184,6 +171,7 @@ function copyPeopleAssets() {
// Copy files `public` to dist. // Copy files `public` to dist.
function copyPublic() { function copyPublic() {
fs.copySync(path.join(projectRoot, PUBLIC_DIR), path.join(projectRoot, DIST_DIR)); 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() { function copyComments() {

View File

@ -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 { export interface BannerData {
type: string, type: string;
icon: string, icon: string;
title: string, title: string;
text: string text: string;
} }