title | homepage | tagline |
---|---|---|
Bun |
Bun is a fast all-in-one JavaScript runtime
|
To update or switch versions, run webi bun@<tag>
.
(you can use @beta
for pre-releases, or @x.y.z
for a specific version)
These are the files / directories that are created and/or modified with this install:
~/.config/envman/PATH.env
~/.local/opt/bun/
~/.local/opt/bun-<VERSION>/
Bun is a wicked-fast JavaScript runtime for developer tooling, API servers, and edge computing.
It's built in Zig and provides a more curated, "batteries-included" approach to developing with JavaScript and JavaScript-ish languages - such as TypeScript, JSX, and TSX.
Run some xScript:
bun run ./hello.js
bun run ./hello.jsx
bun run ./hello.ts
bun run ./hello.tsx
Run a package from npm
:
bun x jswt
More goodies:
bun help
(there's also a built-in development server and lots of stuff)
Bun has an official installer:
export BUN_INSTALL="$HOME/.bun"
curl -fsSL https://bun.sh/install | bash
You might want to still use webi if you want to be able to switch between versions.
bun completions
- Create your script
vim ./hello
#!/usr/bin/env bun console.log('hello');
- Make it executable
chmod a+x ./hello
- Run it
./hello
At the time of this writing (bun v0.5.1), you'll still need to publish with
npm
.
npm
is installed with node.
See Getting Started with NPM (as a developer).
You can run it with bun x
:
bun x <whatever>
Or you can put the #!/usr/bin/env bun
shebang before publishing, and install
from npm:
bun install -g <whatever>
<whatever>
As a system service on Linux:
(note: swap 'my-project' and './my-project' for the name of your project and file)
- Install serviceman (compatible with systemd)
webi serviceman source ~/.config/envman/PATH.env
- Go into your program's directory
pushd ./my-project/
- Add your project to the system launcher, running as the current user
sudo env PATH="$PATH" \ serviceman add --path="$PATH" --system \ --username "$(whoami)" --name my-project -- \ bun run ./my-project.js
- Restart the logging service
sudo systemctl restart systemd-journald
For macOS:
- Install serviceman (compatible with
launchctl
)webi serviceman source ~/.config/envman/PATH.env
- Go into your program's directory
pushd ./my-project/
- Add your project to the system launcher, running as the current user
serviceman add --path="$PATH" --user --name my-project -- \ bun run ./my-project.js