Skip to content

Kody is live

Watch the launch video — what Kody is, and why it exists.

← Public packages

@kentcdodds/package-app-kit

Design tokens, PWA install/update, About/version, cache helpers, and optional realtime notes sync for Kody package apps.

app/controllers/manifest.ts

28 lines · 930 B · TypeScript
import type { BuildAction } from 'remix/router'
import { KodyRuntime } from 'kody:runtime'
import { buildWebManifest } from '../../src/sw.ts'
import { defaultManifestIcons } from '../../src/icons.ts'
import { routes } from '../routes.ts'

export default {
	async handler(context) {
		const { packageContext } = context.get(KodyRuntime)
		const appBasePath = packageContext?.appBasePath ?? ''
		const body = buildWebManifest({
			appBasePath,
			name: 'Package App Kit',
			shortName: 'App Kit',
			description:
				'Demo of design tokens, install, About, and update toast from package-app-kit.',
			themeColor: '#fafafa',
			backgroundColor: '#fafafa',
			icons: defaultManifestIcons(appBasePath),
		})
		return new Response(JSON.stringify(body), {
			headers: {
				'content-type': 'application/manifest+json; charset=utf-8',
				'cache-control': 'no-store',
			},
		})
	},
} satisfies BuildAction<'ANY', typeof routes.manifest>