From 616fb152883f00870a87f6d6498f5e3345f06767 Mon Sep 17 00:00:00 2001 From: Graham Barber Date: Sat, 6 Jun 2026 17:24:15 -0700 Subject: [PATCH] build(cli): add a compile task that embeds runtime assets deno compile only bundles the statically-analyzed module graph, so a naively compiled binary dropped two classes of runtime-read asset and failed at first render with "Could not find template: .../packages/core/templates/presentation.eta": - The Eta templates (packages/core/templates/**.eta), loaded at runtime via the views dir resolved from import.meta.dirname. - The Terrazzo token JSON (packages/theme/tokens/*.json), read by compileCss() through Deno.readDir + readTextFile on import.meta.url. Only colors.json survived, because values.ts imports it statically with a JSON import attribute; motion/size/type.json were invisible to the graph. The compile task embeds both directories with --include, which makes them readable at runtime through the same import.meta-relative paths. Verified end to end: the compiled binary builds a deck with the shell template, all four token files' CSS variables, and syntax highlighting intact. Shiki language modules need no special handling: the loader's import(`shiki/dist/langs/${name}.mjs`) is a template-literal specifier, which deno_graph embeds as a glob pattern, so every language ships in the binary and lazy-loads at runtime as before. The task bakes in the same permission set as the dev/build tasks plus --unstable-broadcast-channel so the compiled binary's dev subcommand keeps working. The morkdeck / morkdeck.exe output is gitignored. Co-Authored-By: Claude Opus 4.8 --- .gitignore | 4 ++++ deno.json | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 01d80f8..89eb681 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ dist/ .claude/settings.local.json + +# `deno task compile` output (single-binary CLI) +/morkdeck +/morkdeck.exe diff --git a/deno.json b/deno.json index 02d6172..a370e20 100644 --- a/deno.json +++ b/deno.json @@ -9,7 +9,8 @@ ], "tasks": { "build": "deno run --allow-net --allow-env --allow-read --allow-write --allow-run packages/cli/main.ts build", - "dev": "deno run --watch --unstable-broadcast-channel --allow-net --allow-env --allow-read --allow-write --allow-run packages/cli/main.ts dev" + "dev": "deno run --watch --unstable-broadcast-channel --allow-net --allow-env --allow-read --allow-write --allow-run packages/cli/main.ts dev", + "compile": "deno compile --unstable-broadcast-channel --allow-net --allow-env --allow-read --allow-write --allow-run --include packages/core/templates --include packages/theme/tokens --output morkdeck packages/cli/main.ts" }, "compilerOptions": { "lib": [ -- 2.51.2