mirror of
https://github.com/hanzoai/frames.git
synced 2026-09-24 00:08:03 +00:00
Forked from HyperFrames (Apache-2.0), full history preserved. Hosts are mapped explicitly and BEFORE the identifier rename, because hyperframes.heygen.com is not decoration: 175 of its occurrences are $schema identifiers that a validator dereferences. A blind rename would have left them naming a host that never serves them. The schema files are in this repo under docs/schema, so the mapped host is one we can actually serve -- that is the condition that makes the rewrite safe, and serving them is a deploy task, not an edit. docs/schema/hyperframes.json is renamed to frames.json to match the identifier it is now published under. api.heygen.com and the CLI auth against heygen.com are left UNRENAMED on purpose. They are a dependency on HeyGen's SaaS, not a name of ours to take, and the right move is to remove that integration rather than rebrand it. LICENSE and CREDITS.md are untouched; NOTICE records the lineage. Co-authored-by: Hanzo Dev <[email protected]>
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import { afterEach, describe, expect, it } from "vitest";
|
|
import { createStudioDevRenderBodyScripts } from "./vite.studioMotion";
|
|
|
|
describe("createStudioDevRenderBodyScripts", () => {
|
|
let projectDir: string | null = null;
|
|
|
|
afterEach(() => {
|
|
if (!projectDir) return;
|
|
rmSync(projectDir, { recursive: true, force: true });
|
|
projectDir = null;
|
|
});
|
|
|
|
function createProject(): string {
|
|
projectDir = mkdtempSync(join(tmpdir(), "hf-studio-motion-"));
|
|
mkdirSync(join(projectDir, ".frames"), { recursive: true });
|
|
return projectDir;
|
|
}
|
|
|
|
it("injects both manual edit and Studio GSAP motion render scripts in dev", () => {
|
|
const dir = createProject();
|
|
writeFileSync(
|
|
join(dir, ".frames/studio-manual-edits.json"),
|
|
JSON.stringify({
|
|
version: 1,
|
|
edits: [{ kind: "text", target: { sourceFile: "index.html" } }],
|
|
}),
|
|
);
|
|
writeFileSync(
|
|
join(dir, ".frames/studio-motion.json"),
|
|
JSON.stringify({
|
|
version: 1,
|
|
motions: [
|
|
{
|
|
kind: "gsap-motion",
|
|
target: { sourceFile: "index.html", selector: ".card" },
|
|
start: 0,
|
|
duration: 0.6,
|
|
ease: "power3.out",
|
|
from: { y: 32, autoAlpha: 0 },
|
|
to: { y: 0, autoAlpha: 1 },
|
|
},
|
|
],
|
|
}),
|
|
);
|
|
|
|
const scripts = createStudioDevRenderBodyScripts(dir, {
|
|
activeCompositionPath: "compositions/scene.html",
|
|
});
|
|
|
|
expect(scripts).toHaveLength(2);
|
|
expect(scripts[0]).toContain("__hfStudioManualEditsApply");
|
|
expect(scripts[1]).toContain("__hfStudioMotionApply");
|
|
expect(scripts.join("\n")).toContain("compositions/scene.html");
|
|
});
|
|
});
|