Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions packages/cli/src/docs/examples.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Templates
# Examples

Built-in templates available via `npx hyperframes init --example <name>`.
Examples available via `npx hyperframes init --example <name>`.

The following example is bundled with the CLI and is always available:

## blank

Empty 1920x1080 composition with GSAP timeline wired up. Start from scratch.

## title-card

Animated title and subtitle with GSAP fade-in/out. Good for intro cards.

## video-edit
## Registry examples

Video element with trimming, audio, and track controls. Starting point for video editing.
Additional examples are fetched from the current registry. Run `npx hyperframes init`
interactively to browse them, or use `npx hyperframes catalog` to inspect the registry
before passing a name to `--example`.

## Custom Templates

Expand Down
25 changes: 25 additions & 0 deletions packages/cli/src/docs/examples.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";

describe("examples documentation", () => {
it("only advertises bundled examples as always available to init", () => {
const markdown = readFileSync(fileURLToPath(new URL("./examples.md", import.meta.url)), "utf8");
const alwaysAvailableSection = markdown.split("## Registry examples")[0];
const documented = [...alwaysAvailableSection.matchAll(/^## ([\w-]+)$/gm)].map(
([, name]) => name,
);
const generators = readFileSync(
fileURLToPath(new URL("../templates/generators.ts", import.meta.url)),
"utf8",
);
const bundledSection = generators.match(
/export const BUNDLED_TEMPLATES:[\s\S]*?= \[([\s\S]*?)\n\];/,
)?.[1];
const bundled = [...(bundledSection ?? "").matchAll(/\bid: "([\w-]+)"/g)].map(
([, name]) => name,
);

expect(documented).toEqual(bundled);
});
});
Loading