LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

bun-run

Execute files and package scripts

TLDR

Run a JavaScript/TypeScript file
$ bun run [script.ts]
copy
Run a package.json script
$ bun run [start]
copy
Run file in watch mode
$ bun --watch run [script.ts]
copy
List available scripts
$ bun run
copy
Evaluate code string
$ bun run --eval "[console.log('hello')]"
copy
Evaluate and print result
$ bun run --print "[1 + 2]"
copy
Run with environment file
$ bun run --env-file [.env] [script.ts]
copy

SYNOPSIS

bun run [options] file|script [arguments]bun file|script [arguments]

DESCRIPTION

bun run executes JavaScript, TypeScript, and JSX files using Bun's fast native transpiler. It can also run package.json scripts with lifecycle hook support.The command can be shortened to just bun followed by the file or script name, though built-in commands take precedence.

PARAMETERS

--watch

Re-run on file changes. Must be placed before `run` in the command.
--hot
Enable hot reloading instead of full restart on file changes.
--eval, -e code
Evaluate argument as script
--print, -p code
Evaluate and print result
--env-file file
Load environment variables from file
--cwd directory
Set working directory
--silent
Suppress script output
--smol
Reduce memory usage at the cost of performance by running the garbage collector more frequently.
--if-present
Exit without error if the entrypoint or script does not exist.
--filter pattern
Run scripts in matching workspace packages by name pattern.
--bun
Force the script to run through Bun's runtime, overriding shebang lines.

BEHAVIOR

Source files

Paths starting with ./ or absolute paths run as source files
Package scripts
Scripts defined in package.json are executed with lifecycle hooks (pre/post)
Resolution
With bun run, package.json scripts take precedence over files with same name

LIFECYCLE HOOKS

Bun respects pre and post lifecycle hooks. Running bun run build will execute prebuild, build, and postbuild in order. If a pre-script fails, the main script is not executed.

INSTALL

sudo pacman -S bun
copy
brew install bun
copy
nix profile install nixpkgs#bun
copy

CAVEATS

TypeScript and JSX are transpiled on-the-fly without configuration. Startup time is significantly faster than npm run. Some Node.js-specific APIs may not be available.

SEE ALSO

bun(1), bun-test(1), bun-build(1), node(1), npm-run(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid