Your first script
This walks through one script, from definition to exit code.
1. Declare the command
command is the string a shell receives. Pipes, &&, redirection and quoting work exactly as
they do in a package.json script, because the string reaches the same shell.
2. Reference it from a package
This line is the last edit that file needs for this script. Flags change at the root from now on.
3. Run it
From inside packages/api:
Rune walks up from packages/api looking for rune.config.ts, stopping at the first directory
containing .git. It records two directories from that walk:
What the child process receives
Before spawning, Rune builds the child's environment in four layers. Later layers win.
- The parent environment, unchanged.
PATH, with everynode_modules/.binfrom the package directory up to the config root prepended, most specific first. This is what makes the bare namevitestresolve.RUNE_SCRIPT_NAME,RUNE_ROOTandRUNE_PACKAGE_DIR.- The script's own
envmap.
The child then inherits Rune's standard input, output and error untouched. Colour, progress bars, watch mode and interactive prompts behave as they do without Rune in front of them.
The exit code
Rune exits with the child's exact code. A test run that fails with 1 exits 1, a tsc run that
fails with 2 exits 2, and a POSIX process killed by signal n reports 128 + n. The full table
is on Exit codes.
Passing arguments through
Everything after -- is appended to the resolved command, quoted per element for the shell that
will receive it.
When the name is wrong
Next
Adopting Rune in a monorepo moves an existing set of duplicated scripts into one config.