From 2c85dc37e697f7e5263f964096ca49eade93c6b7 Mon Sep 17 00:00:00 2001 From: Elihuso Quigley Date: Fri, 15 Mar 2024 16:14:19 +0800 Subject: [PATCH] [+] copyTDORComments --- scripts/build.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/build.ts b/scripts/build.ts index c42404c8..e21cbfee 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -185,10 +185,30 @@ function copyPublic() { fs.copySync(path.join(projectRoot, PUBLIC_DIR), path.join(projectRoot, DIST_DIR)); } +function copyTDORComments() { + const commentPath = path.join(peopleDir, 'tdor', COMMENTS_DIR); + const distPath = path.join(projectRoot, DIST_DIR, PEOPLE_DIR, 'tdor'); + fs.ensureDirSync(commentPath); + var info = { comments: [] }; + info.comments = fs + .readdirSync(commentPath) + .filter((cf) => cf.endsWith(".json")) + .map((cf) => + JSON.parse(fs.readFileSync(path.join(commentPath, cf), "utf-8")) + ); + info.comments.forEach((c) => (c.content = autocorrect.format(c.content))); + fs.ensureDirSync(distPath); + fs.writeFileSync( + path.join(distPath, 'info.json'), + JSON.stringify(info) + ); +} + buildPeopleInfoAndList(); buildPeoplePages(); copyPeopleAssets(); copyPublic(); +copyTDORComments(); /** * Trim a specific char from a string