Art and animation, written as code. Illustrations, loops, interactive web art, launch-videos and scored films in dozens of styles, identical on every render.
TypeScript agent-skillsanimationcanvasclaude-codeclaude-pluginclaude-skillscodex-plugincreative-codecreative-codingcreative-toolsdeterministicgenerative-arthand-drawnillustrationlaunch-videomotion-designmotion-graphicspluginprocedural-generationskill
scaffold: a film importing a font by path no longer crashes the first command
Alex Greenshpun8cdabc03e8aa
diff --git a/skills/anidoodle/engine/test/scaffoldRuns.test.ts b/skills/anidoodle/engine/test/scaffoldRuns.test.tsnew file mode 100644index 0000000..3cd65dd--- /dev/null+++ b/skills/anidoodle/engine/test/scaffoldRuns.test.ts@@ -0,0 +1,17 @@+// THE FIRST COMMAND IN SKILL.md. scaffold.mjs walks the engine's import graph to leave anidoodle's own films+// out of a new project. A film that imports a font or JSON file by path once crashed that walk, so the very+// first command a person runs failed. This runs the real scaffold into a temporary folder.+const cp = "node:child_process", fsm = "node:fs", osm = "node:os", pm = "node:path";+const { spawnSync } = await import(cp), { mkdtempSync, rmSync, existsSync } = await import(fsm), { tmpdir } = await import(osm), { join } = await import(pm);+const proc = (globalThis as any).process;++export const name = "scaffold.mjs makes a project that has its film and leaves our own launch films out";+export function run(ok: (cond: boolean, label: string) => void) {+ const dir = mkdtempSync(join(tmpdir(), "anidoodle-scaffold-")), target = join(dir, "art");+ try {+ const r = spawnSync(proc.execPath, ["tools/scaffold.mjs", target, "--film", "intro", "--duration", "4"], { encoding: "utf8" });+ ok(r.status === 0, `RED: the scaffold exits 0 (got ${r.status}: ${(r.stderr || "").split("\n").find((l: string) => /Error/.test(l)) ?? ""})`);+ ok(existsSync(join(target, "src/canvas-core/intro.ts")), "the new film is there");+ ok(!existsSync(join(target, "src/canvas-core/launch3.ts")), "NEGATIVE: anidoodle's own launch film is left out");+ } finally { rmSync(dir, { recursive: true, force: true }); }+}diff --git a/skills/anidoodle/engine/tools/scaffold.mjs b/skills/anidoodle/engine/tools/scaffold.mjsindex d647f19..6cb76dd 100644--- a/skills/anidoodle/engine/tools/scaffold.mjs+++ b/skills/anidoodle/engine/tools/scaffold.mjs@@ -55,7 +55,8 @@ const ownFilmFiles = () => {const walk = (d) => readdirSync(d).flatMap((n) => { const p = join(d, n); return statSync(p).isDirectory() ? walk(p) : p.endsWith(".ts") ? [p] : []; });const files = walk(SRC);const res = (from, spec) => { const b = resolve(dirname(from), spec); for (const e of ["", ".ts", "/index.ts"]) { const c = resolve(b + e); if (existsSync(c) && statSync(c).isFile()) return c; } return null; }; // resolve(): on Windows "dir/index.ts" must become "dir\index.ts" to match the walked file list- const imp = new Map(files.map((f) => [f, new Set([...readFileSync(f, "utf8").matchAll(/(?:from|import)\s*\(?\s*"(\.[^"]+)"/g)].map((m) => res(f, m[1])).filter(Boolean))]));+ const known = new Set(files); // a film can import a font or a JSON file by path: only .ts modules are graph nodes+ const imp = new Map(files.map((f) => [f, new Set([...readFileSync(f, "utf8").matchAll(/(?:from|import)\s*\(?\s*"(\.[^"]+)"/g)].map((m) => res(f, m[1])).filter((t) => t && known.has(t)))]));const page = (f) => join(SRC, "hosts", `page-${f.slice(f.lastIndexOf(sep) + 1)}`);const out = new Set(OWN_FILMS.map((n) => join(SRC, "canvas-core", `${n}.ts`)));for (let grew = true; grew;) { grew = false; for (const f of files) if (!out.has(f) && [...imp.get(f)].some((t) => out.has(t))) { out.add(f); grew = true; } }