2025-03-14 21:59:59 -06:00
|
|
|
# bun
|
|
|
|
|
|
|
|
|
|
> JavaScript runtime and toolkit.
|
|
|
|
|
> Includes a bundler, a test runner, and a package manager.
|
2025-12-16 10:20:31 -07:00
|
|
|
> More information: <https://bun.com/docs>.
|
|
|
|
|
|
|
|
|
|
- Create a new Bun project in the current directory:
|
|
|
|
|
|
|
|
|
|
`bun init`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Run a JavaScript file or a `package.json` script:
|
|
|
|
|
|
|
|
|
|
`bun run {{path/to/file|script_name}}`
|
|
|
|
|
|
|
|
|
|
- Run unit tests:
|
|
|
|
|
|
|
|
|
|
`bun test`
|
|
|
|
|
|
|
|
|
|
- Download and install all the packages listed as dependencies in `package.json`:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`bun {{[i|install]}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Add a dependency to `package.json`:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`bun {{[a|add]}} {{module_name}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Remove a dependency from `package.json`:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`bun {{[rm|remove]}} {{module_name}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Start a REPL (interactive shell):
|
|
|
|
|
|
|
|
|
|
`bun repl`
|
|
|
|
|
|
|
|
|
|
- Upgrade Bun to the latest version:
|
|
|
|
|
|
|
|
|
|
`bun upgrade`
|