Skip to content
← Public packages

@kentcdodds/kody-connect-talk

Kent C. Dodds's Cloudflare Connect 2026 talk: why your agents' stuff needs a common house, and how Kody builds one on Cloudflare.

FollowForkOpen app

Files

release.mjs

33 lines · 1.3 KB · JavaScript
import { spawnSync } from 'node:child_process'
import { fileURLToPath } from 'node:url'
import { verifyLive } from './verify-live.mjs'

const message = process.argv.slice(2).join(' ').trim()
if (!message) {
	console.error('Usage: npm run release -- "Describe the deck changes"')
	process.exit(1)
}
process.chdir(fileURLToPath(new URL('../', import.meta.url)))

function run(command, args) {
	const result = spawnSync(command, args, { stdio: 'inherit' })
	if (result.error) throw result.error
	if (result.status !== 0) throw new Error(`${command} ${args.join(' ')} failed (${result.status ?? result.signal}). Release stopped.`)
}

try {
	for (const script of ['typecheck', 'check', 'build']) run('npm', ['run', script])
	run('git', ['diff', '--check'])
	// This dedicated deck repository ships sources and generated assets together.
	run('git', ['add', '-A', '--', '.'])
	const staged = spawnSync('git', ['diff', '--cached', '--quiet'])
	if (staged.status === 1) run('git', ['commit', '-m', message])
	else if (staged.status !== 0) throw new Error('Could not inspect staged changes.')
	else console.log('No new changes to commit; publishing the current commit.')
	run('git', ['push'])
	run('npx', ['--yes', '@kodycodes/cli', 'package', 'publish', '@kentcdodds/kody-connect-talk'])
	await verifyLive()
} catch (error) {
	console.error(error.message)
	process.exitCode = 1
}