From ddcbd2406db880bf5f2107aa7e85d3455eb61bba Mon Sep 17 00:00:00 2001 From: PedroBailaAndrade Date: Mon, 8 Jan 2024 17:52:19 +0000 Subject: [PATCH] test --- workspaces/cms-scripts/src/index.ts | 45 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/workspaces/cms-scripts/src/index.ts b/workspaces/cms-scripts/src/index.ts index b30986fd58..364cf96358 100644 --- a/workspaces/cms-scripts/src/index.ts +++ b/workspaces/cms-scripts/src/index.ts @@ -59,23 +59,22 @@ const createAnnouncementDetails = async () => { const jsonFilesInDir = filesInDir.filter((file) => file.endsWith(".json")); - if (jsonFilesInDir.length > 0) { - for (const fileName of jsonFilesInDir) { - const fileData = await fs.readFile( - path.join( - process.cwd(), - "public/data/announcements", - locale, - fileName - ), - "utf8" - ); - const { blocks, gitlog, sourceFilepath, objectID, ...roadmapDetails }: AnnouncementsPost = JSON.parse(fileData.toString()); - roadmapPosts.push(roadmapDetails); - } - await write(path.join("public/data/announcements-details", `${locale}.json`), roadmapPosts); + for (const fileName of jsonFilesInDir) { + const fileData = await fs.readFile( + path.join( + process.cwd(), + "public/data/announcements", + locale, + fileName + ), + "utf8" + ); + + const { blocks, gitlog, sourceFilepath, objectID, ...roadmapDetails }: AnnouncementsPost = JSON.parse(fileData.toString()); + roadmapPosts.push(roadmapDetails); } + await write(path.join("public/data/announcements-details", `${locale}.json`), roadmapPosts); } } @@ -226,14 +225,14 @@ for (const data of roadmapPosts.filenameMap.values()) { ); } -if (announcements.filenames.length > 0) { - for (const data of announcements.filenameMap.values()) { - await write( - `public/data/announcements/${data.locale}/${data.slug}.json`, - data - ); - } -} +// if (announcements.filenames.length > 0) { +// for (const data of announcements.filenameMap.values()) { +// await write( +// `public/data/announcements/${data.locale}/${data.slug}.json`, +// data +// ); +// } +// } for (const locale of locales) { await fs.mkdir(`public/data/pages/${locale}`, { recursive: true });