← Public packages
@kentcdodds/the-last-software-engineer
The Last Software Engineer: Kent C. Dodds's React Summit US 2026 talk deck. Judgment and product engineering in an AI era.
Files
// Builds the Reveal.js deck from src/deck.html + src/slides/*.html (file-name order). Reveal.js and
// its notes plugin come from the pinned npm package and are inlined with the CSS and JS. Writes
// dist/index.html (fully self-contained, fonts and images inlined: opens from disk with no network)
// and app/assets.generated.ts (the hosted page plus content-hashed asset files, served by the app).
import { readdirSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs'
import { join, extname } from 'node:path'
import { createHash } from 'node:crypto'
const root = new URL('..', import.meta.url).pathname
const src = join(root, 'src')
const types = { '.png': 'image/png', '.svg': 'image/svg+xml', '.woff2': 'font/woff2', '.ico': 'image/x-icon', '.webp': 'image/webp', '.jpg': 'image/jpeg' }
const dataUri = (rel) => {
const file = join(src, 'c', rel)
const type = types[extname(file)]
if (!type) throw new Error(`No content type for ${rel}`)
return `data:${type};base64,${readFileSync(file).toString('base64')}`
}
// Rewrites `@scope { a, b { ... } }` into rules prefixed with the slide's selector.
function scopeCss(css, sel) {
// Drop comments first: commas inside a comment would otherwise split into bogus selectors.
css = css.replace(/\/\*[\s\S]*?\*\//g, '')
return css.replace(/@scope\s*\{([\s\S]*)\}\s*$/m, (_, body) =>
body.replace(/([^{}]+)\{([^{}]*)\}/g, (_, selectors, decls) => {
const out = selectors.split(',').map((s) => s.trim()).filter(Boolean).map((s) =>
s.includes(':scope') ? s.replace(':scope', sel) : `${sel} ${s}`,
)
return `\n${out.join(', ')} {${decls}}`
}),
)
}
// House style for everything we write: no em or en dashes and ASCII quotes only.
{
const files = [
...readdirSync(join(src, 'slides')).filter((f) => f.endsWith('.html')).map((f) => join(src, 'slides', f)),
...['README.md', 'AGENTS.md', 'BEATS.md', 'src/deck.html', 'src/c/deck.css', 'src/c/deck.js', 'src/sw.js'].map((f) => join(root, f)),
]
const bad = []
for (const file of files) {
let text
try { text = readFileSync(file, 'utf8') } catch { continue }
text.split('\n').forEach((line, i) => {
const m = line.match(/[–—‘’“”]/)
if (m) bad.push(`${file.slice(root.length)}:${i + 1}: ${JSON.stringify(m[0])}`)
})
}
if (bad.length) throw new Error(`house style (no em/en dashes, ASCII quotes):\n${bad.join('\n')}`)
}
// Brand marks and Kody Iconic glyphs, inlined so they follow the theme via currentColor.
const snippets = {
KODY_MARK: readFileSync(join(src, 'c/kody-mark.svg.html'), 'utf8').trim(),
EPE_MARK: readFileSync(join(src, 'c/epe-mark.svg.html'), 'utf8').trim(),
...JSON.parse(readFileSync(join(src, 'c/icons.json'), 'utf8')),
}
// Each inlined copy of an SVG with internal ids (the EpicProduct.engineer gradient) gets its own
// ids: a url(#id) that points at a copy inside a hidden slide would render nothing.
let snippetCopy = 0
const fill = (html) => html.replace(/\{\{([A-Z_]+)\}\}/g, (m, k) => {
if (!(k in snippets)) throw new Error(`unknown snippet ${m}`)
const n = ++snippetCopy
return snippets[k].replace(/id="([\w-]+)"/g, (_, id) => `id="${id}-${n}"`).replace(/url\(#([\w-]+)\)/g, (_, id) => `url(#${id}-${n})`)
})
const slideFiles = readdirSync(join(src, 'slides')).filter((f) => f.endsWith('.html')).sort()
const labels = new Set()
const slidesHtml = slideFiles.map((f) => {
let html = readFileSync(join(src, 'slides', f), 'utf8').trim()
const label = html.match(/^<section id="([\w-]+)"/)?.[1]
if (!label) throw new Error(`${f}: must start with <section id="...">`)
if (labels.has(label)) throw new Error(`${f}: duplicate label ${label}`)
if (!/<aside class="notes">[\s\S]*?\S[\s\S]*?<\/aside>/.test(html)) throw new Error(`${f}: missing speaker notes`)
labels.add(label)
return fill(html).replace(/<style>([\s\S]*?)<\/style>/g, (_, css) => `<style>${scopeCss(css, `.reveal .slides section#${label}`)}</style>`)
}).join('\n')
const readAsset = (f) => (f.startsWith('vendor:') ? readFileSync(join(root, 'node_modules', f.slice(7)), 'utf8') : readFileSync(join(src, 'c', f), 'utf8'))
const inlineJs = (t) => t.replace(/<\/script/gi, '<\\/script').replace(/^\/\/# sourceMappingURL=.*$/gm, '')
const inlineCss = (t) => t.replace(/^\/\*# sourceMappingURL=.*$/gm, '')
let page = readFileSync(join(src, 'deck.html'), 'utf8')
.replace(/<link rel="stylesheet" href="([\w.:/-]+)">/g, (_, f) => `<style>\n${inlineCss(readAsset(f))}\n</style>`)
.replace(/<script src="([\w.:/-]+)"><\/script>/g, (_, f) => `<script>\n${inlineJs(readAsset(f))}\n</script>`)
.replace('<!-- slides -->', () => slidesHtml)
// Two outputs from the same markup:
// - dist/index.html: fully self-contained (every asset inlined as a data: URI), so the file opens
// straight from disk with zero network. This is the at-the-venue fallback.
// - the hosted page (served by the Kody app): assets are separate content-hashed files under a/,
// served immutable, so the page is small and an edit doesn't re-download every image. The
// service worker precaches the page and every a/ file, so it works fully offline after one visit.
const composed = page
page = composed
.replace(/url\('(fonts|img)\/([\w.-]+)'\)/g, (_, d, f) => `url('${dataUri(d + '/' + f)}')`)
.replace(/(src|href)="c\/([\w./-]+)"/g, (_, attr, p) => `${attr}="${dataUri(p)}"`)
const markup = page.replace(/<script>[\s\S]*?<\/script>/g, '').replace(/<a ([^>]*?)href="https:\/\/[^"]+"/g, '<a $1')
// url(#id) is a same-document SVG reference (the EpicProduct.engineer gradient), not a fetch.
const bad = markup.match(/(?:src|href)="(?!data:|#)[^"]*"|url\((?!['"]?(?:data:|#))[^)]*\)/)
if (bad) throw new Error(`page still references an external or relative resource: ${bad[0].slice(0, 120)}`)
mkdirSync(join(root, 'dist'), { recursive: true })
writeFileSync(join(root, 'dist/index.html'), page)
// Hosted page: hashed asset files.
const files = {} // published name -> { type, base64 }
const hashed = (rel) => {
const file = join(src, 'c', rel)
const type = types[extname(file)]
if (!type) throw new Error(`No content type for ${rel}`)
const bytes = readFileSync(file)
const name = `${rel.split('/').pop().replace(/\.[^.]+$/, '')}.${createHash('sha256').update(bytes).digest('hex').slice(0, 10)}${extname(file)}`
files[name] ??= { type, base64: bytes.toString('base64') }
return `a/${name}`
}
// The app also answers at /<mount> without a trailing slash; add it before anything relative
// loads, so a/ URLs resolve inside the mount.
const slashFix = `<script>if (/^https?:$/.test(location.protocol) && !location.pathname.endsWith('/')) history.replaceState(null, '', location.pathname + '/' + location.search + location.hash)</script>`
const hosted = composed
.replace('<meta charset="utf-8">', () => `<meta charset="utf-8">\n${slashFix}`)
.replace(/url\('(fonts|img)\/([\w.-]+)'\)/g, (_, d, f) => `url('${hashed(d + '/' + f)}')`)
.replace(/(src|href)="c\/([\w./-]+)"/g, (_, attr, p) => `${attr}="${hashed(p)}"`)
{
const m = hosted.replace(/<script>[\s\S]*?<\/script>/g, '').replace(/<a ([^>]*?)href="https:\/\/[^"]+"/g, '<a $1')
const stray = m.match(/(?:src|href)="(?!data:|#|a\/)[^"]*"|url\((?!['"]?(?:data:|#|a\/))[^)]*\)/)
if (stray) throw new Error(`hosted page references something it doesn't publish: ${stray[0].slice(0, 120)}`)
for (const ref of m.matchAll(/(?:src|href)="a\/([^"]+)"|url\('a\/([^']+)'\)/g)) if (!files[ref[1] ?? ref[2]]) throw new Error(`missing hashed file ${ref[0]}`)
}
// PWA: the cache name is versioned by the hosted page's hash, so each publish replaces it. The
// worker precaches the page, the PWA files and every hashed asset.
const version = createHash('sha256').update(hosted).digest('hex').slice(0, 12)
const precache = ['', 'favicon.ico', 'manifest.webmanifest', 'icon-192.png', 'icon-512.png', ...Object.keys(files).map((n) => `a/${n}`)]
const sw = readFileSync(join(src, 'sw.js'), 'utf8').replace('__VERSION__', version).replace("'__PRECACHE__'", JSON.stringify(precache))
const manifest = JSON.stringify({
name: 'The Last Software Engineer',
short_name: 'Last SWE',
description: "Kent C. Dodds's talk deck. Works offline once loaded.",
start_url: './',
scope: './',
display: 'fullscreen',
display_override: ['fullscreen', 'standalone'],
background_color: '#111417',
theme_color: '#111417',
icons: [
{ src: 'icon-192.png', sizes: '192x192', type: 'image/png', purpose: 'any' },
{ src: 'icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'any' },
],
}, null, '\t')
const assets = {
'index.html': { type: 'text/html; charset=utf-8', text: hosted },
'favicon.ico': { type: 'image/x-icon', base64: readFileSync(join(src, 'c/icons/favicon.ico')).toString('base64') },
'sw.js': { type: 'text/javascript; charset=utf-8', text: sw },
'manifest.webmanifest': { type: 'application/manifest+json', text: manifest },
'icon-192.png': { type: 'image/png', base64: readFileSync(join(src, 'c/icons/icon-192.png')).toString('base64') },
'icon-512.png': { type: 'image/png', base64: readFileSync(join(src, 'c/icons/icon-512.png')).toString('base64') },
...Object.fromEntries(Object.entries(files).map(([n, f]) => [`a/${n}`, f])),
}
writeFileSync(join(root, 'app/assets.generated.ts'), `// Generated by scripts/build.mjs. Do not edit by hand.
export type Asset = { type: string; text?: string; base64?: string }
export const slideCount = ${slideFiles.length}
export const assets: Record<string, Asset> = ${JSON.stringify(assets, null, '\t')}
`)
console.log(`Composed ${slideFiles.length} slides (${[...labels].join(', ')}). dist/index.html (self-contained) is ${(page.length / 1024).toFixed(0)} KiB; hosted page is ${(hosted.length / 1024).toFixed(0)} KiB + ${Object.keys(files).length} hashed files.`)