|
1 | 1 | import fs from "fs"; |
2 | | -import { getEvents } from "./fb.js"; |
| 2 | +import { getEvents, getSpeakers, getTags } from "./fb.js"; |
3 | 3 |
|
4 | 4 | export default async function conference(fbDb, htConf, outputDir) { |
5 | 5 | const childDir = `${outputDir}/conferences/${htConf.code}`; |
6 | 6 |
|
7 | 7 | fs.mkdirSync(childDir, { recursive: true }); |
8 | 8 |
|
9 | | - const [htEvents] = await Promise.all([getEvents(fbDb, htConf.code)]); |
| 9 | + const [htEvents, htSpeakers, htTags] = await Promise.all([ |
| 10 | + getEvents(fbDb, htConf.code), |
| 11 | + getSpeakers(fbDb, htConf.code), |
| 12 | + getTags(fbDb, htConf.code), |
| 13 | + ]); |
10 | 14 |
|
11 | 15 | await Promise.all([ |
12 | 16 | fs.promises.writeFile(`${childDir}/events.json`, JSON.stringify(htEvents)), |
| 17 | + fs.promises.writeFile( |
| 18 | + `${childDir}/speakers.json`, |
| 19 | + JSON.stringify(htSpeakers) |
| 20 | + ), |
| 21 | + fs.promises.writeFile(`${childDir}/tags.json`, JSON.stringify(htTags)), |
13 | 22 | ]); |
14 | 23 |
|
15 | | - const eventColors = new Set(htEvents.map((e) => e.type.color)); |
| 24 | + const eventColors = htEvents.map((e) => e.type.color); |
| 25 | + const tagColors = htTags.flatMap((t) => |
| 26 | + t.tags.map((e) => e.color_background) |
| 27 | + ); |
16 | 28 |
|
17 | | - return eventColors; |
| 29 | + return new Set(eventColors, tagColors); |
18 | 30 | } |
0 commit comments