forked from graphql/graphql.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount-speakers-without-details.ts
More file actions
40 lines (32 loc) · 1.12 KB
/
count-speakers-without-details.ts
File metadata and controls
40 lines (32 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env tsx
import { join } from "node:path"
import { readFile } from "node:fs/promises"
import type { SchedSpeaker } from "@/app/conf/_api/sched-types"
/**
* We count the number of speakers we didn't sync details for
* to make sure we have social URLs for everybody.
*/
;(async function main() {
try {
const speakersFilePath = join(import.meta.dirname, "speakers.json")
console.log("Reading speakers.json...")
const speakersData = await readFile(speakersFilePath, "utf-8")
const speakers: SchedSpeaker[] = JSON.parse(speakersData)
const speakersWithoutDetails = speakers.filter(
speaker => !speaker["~syncedDetailsAt"],
)
console.log(`Total speakers: ${speakers.length}`)
console.log(
`Speakers without ~syncedDetailsAt: ${speakersWithoutDetails.length}`,
)
if (speakersWithoutDetails.length > 0) {
console.log("\nSpeakers missing details:")
for (const speaker of speakersWithoutDetails) {
console.log(`- ${speaker.username} (${speaker.name || "No name"})`)
}
}
} catch (error) {
console.error("Error:", error)
process.exit(1)
}
})()