Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

1.6 KB
Raw Blame

title: "raea run" summary: "Run a TypeScript program on the engine, headless, and print what it prints." order: 9 sources: ["engine/cli/src/cli.rs"]

raea run bundles a TypeScript file and runs it on the engine's JavaScript, with no window and no composition. If the file's default export is a function, it's called and awaited, and what it returns is printed: a string as it is, anything else as JSON. The program's console goes to the terminal as node's does: console.log and console.info to stdout, console.warn and console.error to stderr. A throw prints the error's name, message and stack, and ends the run with exit code 1. It's how checks such as a room's checkLayout run, and it reaches the engine's native calls (solids, ECS worlds) the way a composition does.

// count.ts: a line on stderr while it works, then its answer as JSON on stdout
export default async function () {
  console.error("counting")
  return { rooms: 3, errors: 0 }
}
raea run checks/layout.ts
raea run bake.ts --timeout 600

Usage

raea run SCRIPT.ts   (a TypeScript program on the engine, headless: its default export is called, what it prints is the answer; a check like a room's checkLayout; also: --timeout S)

Headless: it needs nothing running and opens no window. Takes up to 1 argument besides its flags.

Flags

Flag Takes What it does
--timeout VALUE Stop the program after this many seconds (120 by default).