(withContent?: boolean)
| 14 | } |
| 15 | |
| 16 | export async function getAllEvents(withContent?: boolean) { |
| 17 | const directory = "data/events"; |
| 18 | |
| 19 | const files = (await readdir(path.join(process.cwd(), directory))).filter( |
| 20 | (file) => path.extname(file) === ".mdx" |
| 21 | ); |
| 22 | |
| 23 | const events = await Promise.all( |
| 24 | files.map(async (file) => { |
| 25 | const fullPath = path.join(process.cwd(), directory, file); |
| 26 | const [fileContents, resultMdx] = await Promise.all([ |
| 27 | readFile(fullPath, "utf8"), |
| 28 | import(`data/events/${file}`), |
| 29 | ]); |
| 30 | |
| 31 | return { |
| 32 | ...resultMdx.meta, |
| 33 | title: extractTitleFromMarkdown(fileContents), |
| 34 | slug: path.parse(file).name, |
| 35 | Mdx: withContent && resultMdx.default, |
| 36 | }; |
| 37 | }) |
| 38 | ); |
| 39 | return events.sort(sortByEventStartDate); |
| 40 | } |
| 41 | |
| 42 | async function getSpeakerLink(login: string) { |
| 43 | const contributors = getAllContributors(); |
no test coverage detected