Skip to content
← Public packages

@kentcdodds/invisible-software-talk

Invisible Software: Kent C. Dodds's AI Coding Summit NYC 2026 talk deck. Agents become software's next billion users.

FollowForkOpen app

Files

check-live.mjs

43 lines · 2.5 KB · JavaScript
// Checks the hosted deck on a live URL: hashed assets are immutable, the page inlines no images or
// fonts, every slide and beat walks without errors, and after one visit the deck works fully offline
// (see scripts/offline-audit.mjs). Usage: node scripts/check-live.mjs https://invisible-software-slides.kentcdodds.com/
import { chromium } from 'playwright'
import { auditOffline } from './offline-audit.mjs'

const base = new URL(process.argv[2] ?? 'https://invisible-software-slides.kentcdodds.com/').href.replace(/\/?$/, '/')
const problems = []
const html = await (await fetch(base, { cache: 'no-store' })).text()
const one = html.match(/c\/img\/[\w.-]+\.[0-9a-f]{8}\.\w+/)?.[0]
const res = one && (await fetch(base + one))
if (!res?.ok || !/immutable/.test(res.headers.get('cache-control') ?? '')) problems.push(`hashed asset ${one} is not served immutable`)
if (/data:image\/(?:png|jpeg|webp)|data:font\//.test(html.replace(/<script>[\s\S]*?<\/script>/g, ''))) problems.push('hosted page still inlines images or fonts')
console.log(`page ${(html.length / 1024).toFixed(0)} KiB; ${one}: ${res?.status} ${res?.headers.get('cache-control')}`)

const browser = await chromium.launch({ executablePath: process.env.CHROMIUM_PATH || undefined })
for (const theme of ['dark', 'light']) {
	const context = await browser.newContext({ viewport: { width: 1920, height: 1080 }, colorScheme: theme })
	const page = await context.newPage()
	const errors = []
	page.on('pageerror', (e) => errors.push(e.message))
	page.on('console', (m) => { if (m.type() === 'error' && !/ERR_INTERNET_DISCONNECTED/.test(m.text())) errors.push(m.text()) })
	await page.goto(base)
	await page.waitForFunction(() => window.__deck?.isReady())
	let beats = 0
	while (true) {
		await page.waitForFunction(() => window.__demoSettled(), null, { timeout: 20000 }).catch(() => errors.push(`demo not settled at ${page.url()}`))
		beats++
		if (await page.evaluate(() => window.__deck.isLastSlide() && !window.__deck.availableFragments().next)) break
		await page.keyboard.press('ArrowRight')
		await page.waitForTimeout(200)
	}
	const audit = await auditOffline(context, page, base)
	problems.push(...errors.map((e) => `${theme}: ${e}`), ...audit.problems.map((p) => `${theme}: ${p}`))
	console.log(`${theme}: ${beats} beats walked online; ${audit.summary}`)
	await context.close()
}
await browser.close()
if (problems.length) {
	console.error(`${problems.length} problem(s):\n${problems.join('\n')}`)
	process.exit(1)
}
console.log('live: all good')