mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 12:44:11 -10:00
raea run's program said nothing: its console went to the log, and raea run's headless App has no log, so every console line was dropped. The default export's return value was dropped too. A throw printed its stack alone, which on JavaScriptCore is only the frames, so the message was missing. - runtime/calls: CONSOLE. While it's on (and ECHO), a script's console goes to the terminal as node's does: log and info to stdout, warn and error to stderr (raea-runtime-react's __raea_log). print takes err for a line meant for stderr. - raea-runtime-export: run_bundle_to_terminal turns it on for raea run, raea test and raea blender run. raea check's asks and a spec's read keep run_bundle, whose stdout is their answer. - raea-runtime-bundle: bundle_script's entry (script_entry.ts) prints what the default export returns, a string as it is and anything else as indented JSON. A throw prints as error: Name: message, then the stack, on stderr, exit 1. Checked with the issue's cases on this build: console lines before and after an await, both streams, a returned object and a returned string, a throw (exit 1, message and stack on stderr), a script with no default export. raea test's output is unchanged (random-colors.test.ts, 9 pass). The manual's raea run page says all of it, with an example.
1.6 KiB
1.6 KiB
title, summary, order, sources
| title | summary | order | sources | |
|---|---|---|---|---|
| raea run | Run a TypeScript program on the engine, headless, and print what it prints. | 8 |
|
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). |