View Source Bun (elixir_bun v0.1.4)
Bun is an installer and runner for bun.
Profiles
You can define multiple bun profiles. By default, there is a
profile called :default
which you can configure its args, current
directory and environment:
config :elixir_bun,
version: "1.0.7",
default: [
args: ~w(build js/app.js --outdir=../priv/static/assets),
cd: Path.expand("../assets", __DIR__),
env: %{}
]
Bun configuration
There are two global configurations for the bun application:
:version
- the expected bun version:cacerts_path
- the directory to find certificates for https connections:path
- the path to find the bun executable at. By default, it is automatically downloaded and placed inside the_build
directory of your current app
Overriding the :path
is not recommended, as we will automatically
download and manage bun
for you. But in case you can't download
it (for example, the npm registry is behind a proxy), you may want to
set the :path
to a configurable system location.
Once you find the location of the executable, you can store it in a
MIX_BUN_PATH
environment variable, which you can then read in
your configuration file:
config :elixir_bun, path: System.get_env("MIX_BUN_PATH")
Summary
Functions
Returns the path to the executable.
Returns the version of the bun executable.
Returns the configuration for the given profile.
Returns the configured bun version.
Installs, if not available, and then runs bun
.
Runs the given command with args
.
Functions
Returns the path to the executable.
The executable may not be available if it was not yet installed.
Returns the version of the bun executable.
Returns {:ok, version_string}
on success or :error
when the executable
is not available.
Returns the configuration for the given profile.
Returns nil if the profile does not exist.
Returns the configured bun version.
Installs, if not available, and then runs bun
.
Returns the same as run/2
.
Runs the given command with args
.
The given args will be appended to the configured args. The task output will be streamed directly to stdio. It returns the status of the underlying call.