1/**2 * Every source-controlled file copied from the validated reference app into a3 * new project, by its path relative to both the reference app and the generated4 * project. The contents are read at runtime (see {@link readStarterFile}) rather5 * than imported with `type: "text"`, which JSR does not support when publishing.6 */7export const STARTER_FILES: readonly string[] = [8 "deno.json",9 "tsconfig.json",10 "public/favicon.svg",11 "public/apple-touch-icon.png",12 "public/icon-192.png",13 "public/icon-512.png",14 "public/icon-maskable-512.png",15 "public/icon-monochrome.svg",16 "public/screenshot-narrow.png",17 "public/screenshot-wide.png",18 "public/manifest.webmanifest",19 "src/app.ts",20 "src/env.d.ts",21 "src/permissions.ts",22 "src/schema.ts",23 "src/pages/index.astro",24 "src/styles/global.css",25 "src/islands/AccountGate.tsx",26 "src/islands/TaskList.tsx",27 "src/islands/use-tasks.ts",28 "src/layouts/Shell.astro",29 "tests/auth_e2e_test.ts",30 "tests/author-boundary_test.ts",31 "tests/backup_migration_e2e_test.ts",32 "tests/convergence_e2e_test.ts",33 "tests/testing-contract_test.ts",34];3536/**37 * Reads a starter file's contents, resolving it relative to the reference app.38 * Works both from a source checkout (a `file:` URL read from disk) and from the39 * published package (an `https:` JSR URL fetched over the network).40 */41export async function readStarterFile(relativePath: string): Promise<Uint8Array> {42 const url = new URL(`../apps/reference/${relativePath}`, import.meta.url);43 if (url.protocol === "file:") return await Deno.readFile(url);44 const response = await fetch(url);45 if (!response.ok) {46 throw new Error(`failed to read starter file ${relativePath}: HTTP ${response.status}`);47 }48 return new Uint8Array(await response.arrayBuffer());49}