Code-first video & image, rendered natively on WebGPU.
feat(cli): add Noto Color Emoji to framefields init by default
okanasl66e75307550f
diff --git a/.changeset/add-noto-emoji-to-init.md b/.changeset/add-noto-emoji-to-init.mdnew file mode 100644index 00000000..afbf20ba--- /dev/null+++ b/.changeset/add-noto-emoji-to-init.md@@ -0,0 +1,6 @@+---+"framefields": patch+---++Include Noto Color Emoji font by default in `framefields init` alongside Inter and JetBrains Mono.+diff --git a/README.md b/README.mdindex 74872980..3b2ff6b2 100644--- a/README.md+++ b/README.md@@ -83,7 +83,7 @@ Every frame is rendered by framefields directly from TypeScript in [`examples/`]pnpm add framefields```-Starting a new film? `framefields init` sets up the whole project: `package.json`, TypeScript, a `film.ts` to edit and a `render.ts` to render it, `assets/` with Git LFS, and the Inter and JetBrains Mono fonts:+Starting a new film? `framefields init` sets up the whole project: `package.json`, TypeScript, a `film.ts` to edit and a `render.ts` to render it, `assets/` with Git LFS, and the Inter, JetBrains Mono, and Noto Color Emoji fonts:```bashpnpm dlx framefields init my-film --install # or: npx framefields init my-film --installdiff --git a/packages/components/SPEC.md b/packages/components/SPEC.mdindex 37520a28..21dbd197 100644--- a/packages/components/SPEC.md+++ b/packages/components/SPEC.md@@ -2049,7 +2049,7 @@ the project layout the setup skill describes, so a project starts the same way ethe built-in themes name. Both are pinned to google/fonts commit `e7db6ca` and match therepo's `assets/fonts` byte for byte. Their entries register as text families(`FontManager.register({ family, source })`), and Terminal and CodeBlock declare `mono`.- `init` installs both (`--no-fonts` skips them, `--emoji` adds emoji), and the generated+ `init` installs all three by default (`--no-fonts` skips them, `--no-emoji` skips emoji), and the generated`src/components/fonts.ts`, which `theme.ts` calls, is the project's one registrationpoint.- **Never overwrites.** Existing files are reported `unchanged`. `package.json` gains onlydiff --git a/packages/framefields/src/cli.ts b/packages/framefields/src/cli.tsindex e30157a1..e6a55506 100644--- a/packages/framefields/src/cli.ts+++ b/packages/framefields/src/cli.ts@@ -64,8 +64,8 @@ Options for init:--name <name> Package name (default: the folder's name).--pm <manager> npm, pnpm, yarn or bun (default: the one running this).--install Install dependencies afterwards.- --emoji Also install the color emoji font.- --no-fonts Skip Inter and JetBrains Mono.+ --no-fonts Skip fonts (Inter, JetBrains Mono, Noto Color Emoji).+ --no-emoji Skip the color emoji font.--no-git Don't run \`git init\`.Options for add:@@ -98,6 +98,7 @@ async function main(argv: string[]): Promise<number> {dir: { type: "string" },overwrite: { type: "boolean" },"no-fonts": { type: "boolean" },+ "no-emoji": { type: "boolean" },"fonts-dir": { type: "string" },name: { type: "string" },pm: { type: "string" },@@ -184,7 +185,7 @@ async function main(argv: string[]): Promise<number> {packageManager: values.pm as PackageManager | undefined,userAgent: process.env.npm_config_user_agent,fonts: !values["no-fonts"],- emoji: values.emoji,+ emoji: values["no-emoji"] ? false : values.emoji,git: !values["no-git"],install: values.install,onDownload,diff --git a/packages/framefields/src/cli/init.test.ts b/packages/framefields/src/cli/init.test.tsindex f50ecbcb..35df5f82 100644--- a/packages/framefields/src/cli/init.test.ts+++ b/packages/framefields/src/cli/init.test.ts@@ -142,17 +142,26 @@ describe("framefields init", () => {expect(read(root(".gitignore"))).toContain(".env\n");expect(read(root("src/render.ts"))).toContain("process.loadEnvFile(ENV)");expect(read(root("README.md"))).toContain("pnpm frames -- 0 30 60");- // The themes' fonts, recorded and registered where theme.ts imports them.+ // The default fonts, recorded and registered where theme.ts imports them.expect(report.fonts.map((f) => [f.role, f.path, f.status])).toEqual([["sans", "assets/fonts/sans.ttf", "installed"],["mono", "assets/fonts/mono.ttf", "installed"],+ ["emoji", "assets/fonts/emoji.ttf", "installed"],]);expect(readConfig(join(cwd, "My Film")).config).toEqual({components: "src/components",- fonts: { sans: "assets/fonts/sans.ttf", mono: "assets/fonts/mono.ttf" },+ fonts: {+ sans: "assets/fonts/sans.ttf",+ mono: "assets/fonts/mono.ttf",+ emoji: "assets/fonts/emoji.ttf",+ },});const fontsTs = read(root("src/components/fonts.ts"));+ expect(fontsTs).toContain(+ 'registerEmojiFont(\n\t\tasset("../../assets/fonts/emoji.ttf"),',+ );expect(fontsTs).toContain('family: "Inter",');+ expect(fontsTs).toContain('family: "JetBrains Mono",');expect(fontsTs).toContain('source: asset("../../assets/fonts/sans.ttf"),');expect(read(root("src/theme.ts"))).toContain('from "./components/fonts.js"',@@ -219,24 +228,29 @@ describe("framefields init", () => {await expect(init(opts())).rejects.toThrow(/"type": "module"/);});- it("adds emoji on request, skips git when asked, and installs with the chosen manager", async () => {+ it("skips emoji when asked via emoji: false, skips git when asked, and installs with the chosen manager", async () => {const { run, calls } = runner();const report = await init(opts({run,- emoji: true,+ emoji: false,git: false,install: true,packageManager: "bun",}),);- expect(report.fonts.map((f) => f.role)).toEqual(["sans", "mono", "emoji"]);+ expect(report.fonts.map((f) => f.role)).toEqual(["sans", "mono"]);expect(calls).toEqual(["bun install"]);expect(report.installed).toBe(true);expect(json("package.json").packageManager).toBeUndefined();expect(report.runScript("frames")).toBe("bun run frames");});+ it("installs only emoji when fonts is false and emoji is true", async () => {+ const report = await init(opts({ fonts: false, emoji: true }));+ expect(report.fonts.map((f) => f.role)).toEqual(["emoji"]);+ });+it("reports an existing repository and a failed install", async () => {const { run } = runner({"git rev-parse --is-inside-work-tree": 0,diff --git a/packages/framefields/src/cli/init.ts b/packages/framefields/src/cli/init.tsindex 0c8ee729..8d2774af 100644--- a/packages/framefields/src/cli/init.ts+++ b/packages/framefields/src/cli/init.ts@@ -3,8 +3,9 @@* to an existing one. Writes the layout the setup skill describes* (`package.json` with the install-script approvals framefields needs,* `tsconfig.json`, `src/theme.ts` / `film.ts` / `render.ts`, `assets/`,- * LFS `.gitattributes`, `.gitignore`), installs the themes' fonts and keeps- * them registered in `src/components/fonts.ts`.+ * LFS `.gitattributes`, `.gitignore`), installs the default fonts+ * (Inter, JetBrains Mono, and Noto Color Emoji) and keeps them registered+ * in `src/components/fonts.ts`.** It never overwrites: files that exist are left alone, and `package.json`,* `.gitignore` and `.gitattributes` gain only what they're missing.@@ -55,9 +56,9 @@ export interface InitOptions {packageManager?: PackageManager;/** `npm_config_user_agent`, for detecting the package manager and its version. */userAgent?: string;- /** Install the themes' fonts, Inter and JetBrains Mono (default true). */+ /** Install the default fonts: Inter, JetBrains Mono, and Noto Color Emoji (default true). */fonts?: boolean;- /** Also install the color emoji font. */+ /** Also install the color emoji font (default true when fonts is true). */emoji?: boolean;/** `git init` when the folder isn't in a repository yet (default true). */git?: boolean;@@ -196,9 +197,11 @@ export async function init(options: InitOptions): Promise<InitReport> {writeConfig(root, config);report.written.push("framefields.json");}+ const installFonts = options.fonts !== false;+ const installEmoji = options.emoji ?? installFonts;const roles = [- ...(options.fonts === false ? [] : ["sans", "mono"]),- ...(options.emoji ? ["emoji"] : []),+ ...(installFonts ? ["sans", "mono"] : []),+ ...(installEmoji ? ["emoji"] : []),];for (const role of roles)report.fonts.push(diff --git a/plugins/framefields/skills/framefields/SKILL.md b/plugins/framefields/skills/framefields/SKILL.mdindex 38f78be9..d4c9bcd0 100644--- a/plugins/framefields/skills/framefields/SKILL.md+++ b/plugins/framefields/skills/framefields/SKILL.md@@ -30,13 +30,13 @@ This skill takes a project from nothing to a verified first render. For anything## 2. Install-**Fastest path: `npx framefields init`.** It writes everything in sections 2 and 3 for you: `package.json` (with the install-script approvals below, scripts, dependencies, `packageManager`), `tsconfig.json`, `src/theme.ts` / `film.ts` / `render.ts`, `assets/`, the LFS `.gitattributes` and `.gitignore`. It also downloads Inter and JetBrains Mono (pinned, with their OFL licenses), registers them in the generated `src/components/fonts.ts` that `theme.ts` calls, and runs `git init`.+**Fastest path: `npx framefields init`.** It writes everything in sections 2 and 3 for you: `package.json` (with the install-script approvals below, scripts, dependencies, `packageManager`), `tsconfig.json`, `src/theme.ts` / `film.ts` / `render.ts`, `assets/`, the LFS `.gitattributes` and `.gitignore`. It also downloads Inter, JetBrains Mono, and Noto Color Emoji (pinned, with their OFL licenses), registers them in the generated `src/components/fonts.ts` that `theme.ts` calls, and runs `git init`.```bashnpx framefields init my-film --install # a new project; or `init` inside an existing one```-In an existing project it never overwrites: existing files are left alone, and `package.json`, `.gitignore` and `.gitattributes` only gain what they lack (a `"type": "commonjs"` package is refused). Options: `--pm npm|pnpm|yarn|bun` (default: the one running it), `--emoji` (also the color emoji font), `--no-fonts`, `--no-git`, `--name`. It asks no questions, so it runs unattended in CI. The AI gateway key is optional: `init` writes `.env.example` and git-ignores `.env`, and `render.ts` loads `.env` when it exists; the user sets `FRAMEFIELDS_API_KEY` there themselves (never write a key for them). Then go to section 4. The rest of this section and section 3 describe what it writes, for doing it by hand or merging into an unusual setup.+In an existing project it never overwrites: existing files are left alone, and `package.json`, `.gitignore` and `.gitattributes` only gain what they lack (a `"type": "commonjs"` package is refused). Options: `--pm npm|pnpm|yarn|bun` (default: the one running it), `--no-fonts`, `--no-emoji`, `--no-git`, `--name`. It asks no questions, so it runs unattended in CI. The AI gateway key is optional: `init` writes `.env.example` and git-ignores `.env`, and `render.ts` loads `.env` when it exists; the user sets `FRAMEFIELDS_API_KEY` there themselves (never write a key for them). Then go to section 4. The rest of this section and section 3 describe what it writes, for doing it by hand or merging into an unusual setup.Use the package manager the project already uses (look for `pnpm-lock.yaml`, `yarn.lock`, `bun.lock`, or `package-lock.json`).