Skip to content
← Public packages

@kentcdodds/transistor

Authenticated Transistor.fm helpers for shows, episodes, episode metadata, and morning-briefing-ready podcast analytics.

src/shows.ts

75 lines · 2.5 KB · TypeScript
/** Which Kent YouTube channel hosts video for a Transistor show (podcast stays on Transistor). */
export type TransistorShowYouTubeTarget = 'main' | 'plus'

export type TransistorShowInfo = {
	showId: string
	slug: string
	title: string
	/** null = no dedicated YouTube channel mapping */
	youtubeChannel: TransistorShowYouTubeTarget | null
	notes?: string
}

/**
 * Kent's Transistor shows and their YouTube video homes.
 * Podcast RSS/audio hosting remains on Transistor — this mapping is for YouTube uploads and links only.
 */
export const TRANSISTOR_SHOWS: TransistorShowInfo[] = [
	{
		showId: '78601',
		slug: 'become-an-epic-product-engineer',
		title: 'Become an Epic Product Engineer',
		youtubeChannel: 'plus',
		notes:
			'Rebrand of Chats with Kent (Season 7+). Full episodes and promo Shorts upload to kentcdodds-plus.',
	},
	{
		showId: '78602',
		slug: 'better-with-kent',
		title: 'Better with Kent',
		youtubeChannel: 'main',
		notes: 'BWK YouTube video (when published) goes on the main Kent C. Dodds channel.',
	},
	{
		showId: '21932',
		slug: 'call-kent',
		title: 'The Call Kent Podcast',
		youtubeChannel: null,
	},
]

/**
 * Return Kent's static Transistor show catalog with YouTube channel mapping metadata.
 *
 * @returns `{ shows }` — show list with ids, slugs, titles, and YouTube targets.
 *
 * @example
 * import shows from 'kody:@kentcdodds/transistor/shows'
 * const result = shows()
 * // => { shows: [{ showId: '78601', slug: 'become-an-epic-product-engineer', ... }] }
 */
export function listTransistorShows(): TransistorShowInfo[] {
	return TRANSISTOR_SHOWS.map((show) => ({ ...show }))
}

export function resolveTransistorShow(input: { showId?: string; slug?: string } | string) {
	const key = typeof input === 'string' ? input.trim() : input.showId?.trim() || input.slug?.trim()
	if (!key) throw new Error('Pass showId or slug to resolveTransistorShow.')
	const match = TRANSISTOR_SHOWS.find((show) => show.showId === key || show.slug === key)
	if (!match) throw new Error(`Unknown Transistor show "${key}".`)
	return { ...match }
}

/**
 * Return Kent's static Transistor show catalog with YouTube channel mapping metadata.
 *
 * @returns `{ shows }` — show list with ids, slugs, titles, and YouTube targets.
 *
 * @example
 * import shows from 'kody:@kentcdodds/transistor/shows'
 * const result = shows()
 * // => { shows: [{ showId: '78601', slug: 'become-an-epic-product-engineer', ... }] }
 */
export default function transistorShows() {
	return { shows: listTransistorShows() }
}