mix vitex.install.bun_integration (Vitex v0.2.4)

View Source

Handles the special integration with the Elixir bun package.

This is different from system package managers because:

  • Bun is managed by Mix (not system-installed)
  • The bun executable is auto-downloaded to _build/bun
  • It can use Bun workspaces for Phoenix JS dependencies
  • Mix tasks handle the bun installation lifecycle

The Elixir bun package is similar to how Phoenix manages esbuild and tailwind, providing a controlled, versioned JavaScript runtime within the Elixir ecosystem.

Summary

Functions

Returns the Bun-specific configuration for various operations.

Returns the command to run for package installation based on whether Bun is being used.

Integrates Bun into the project when --bun flag is specified.

Checks if Bun integration should be performed.

Updates package.json to include Bun workspaces configuration.

Checks if the project is using Bun integration.

Functions

config()

Returns the Bun-specific configuration for various operations.

install_command(igniter)

Returns the command to run for package installation based on whether Bun is being used.

integrate(igniter)

Integrates Bun into the project when --bun flag is specified.

This performs all Bun-specific setup in a coordinated way:

  1. Adds the bun Mix dependency
  2. Configures bun version and assets profile
  3. Sets up Bun-specific mix aliases
  4. Configures the development watcher to use _build/bun
  5. Updates package.json to use Bun workspaces
  6. Adds helpful notice about Bun configuration

should_integrate?(igniter)

Checks if Bun integration should be performed.

update_package_json(package_json, igniter)

Updates package.json to include Bun workspaces configuration.

using_bun?(igniter)

Checks if the project is using Bun integration.