Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroBailaAndrade committed Jan 8, 2024
1 parent 94787fc commit ddcbd24
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions workspaces/cms-scripts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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 });
Expand Down

0 comments on commit ddcbd24

Please sign in to comment.