SPB Git

Repository Public

helpers.ts 886 B 20 lines typescript

1import { readFileSync } from "node:fs";2import { Manifest, type Capsule } from "@/modules/content-schema";34export const loadManifest = () => Manifest.parse(JSON.parse(readFileSync("content/course.manifest.json", "utf8")));56export const capsule = (over: Partial<Capsule> = {}): Capsule => ({7  id: "capsule-1", title: "Capsule", order: 0, optional: false, durationSeconds: 300, synthetic: false, visibility: "public", download: false,8  media: { hls: "S01/capsule-1/master.m3u8", captions: [] }, ...over,9});1011/** A copy of the real manifest in which S01 is fully published, to test what publication would expose. */12export function withPublishedS01() {13  const m = loadManifest();14  const s = m.sessions.find((x) => x.id === "S01")!;15  s.publication = "published";16  for (const ref of Object.values(s.sections)) ref!.visibility = "public";17  s.capsules.push(capsule());18  return m;19}20
Files main
Menu

Theme