Skip to content

Commit

Permalink
add event info to published JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
dtinth committed Oct 30, 2024
1 parent 1dac0ae commit dbe53ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ export class Event {
get externalOrganizer() {
return this.options.externalOrganizer
}
toJSON() {
return {
id: this.id,
name: this.name,
url: this.url,
externalOrganizer: this.externalOrganizer,
}
}
}

const events = [
Expand Down
10 changes: 6 additions & 4 deletions src/scripts/publish.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { execSync } from 'child_process'
import 'dotenv/config'
import fs from 'fs'
import yargs from 'yargs'
import { Event } from '../Event'
import { Video } from '../Video'
import fs from 'fs'
import 'dotenv/config'
import { execSync } from 'child_process'

const argv = await yargs(process.argv.slice(2))
.options({
Expand All @@ -17,7 +18,8 @@ const argv = await yargs(process.argv.slice(2))
.parse()

const videos = await Video.findAll()
const dataFile = JSON.stringify({ videos }, null, 2)
const events = await Event.findAll()
const dataFile = JSON.stringify({ videos, events }, null, 2)
fs.mkdirSync('.data/gh-pages', { recursive: true })
fs.writeFileSync('.data/gh-pages/videos.json', dataFile)
console.log('Wrote .data/videos.json')
Expand Down

0 comments on commit dbe53ea

Please sign in to comment.