ExTauri (ex_tauri v0.4.2)

View Source

ExTauri provides integration between Phoenix and Tauri for building native desktop applications.

This module provides core functionality for running Tauri commands and managing the Tauri installation. For installation and setup, use Mix.Tasks.ExTauri.Install. For running commands, use the dedicated Mix tasks like Mix.Tasks.ExTauri.Dev and Mix.Tasks.ExTauri.Build.

Summary

Functions

Returns the path to the Tauri installation.

Returns the latest version of Tauri available.

The name of the release Burrito wraps into the sidecar binary.

Runs a Tauri CLI command after building a full production release.

Runs a Tauri CLI command in development mode.

Runs a Tauri CLI command without building the Elixir release.

Returns the ex_tauri package version.

Functions

installation_path()

Returns the path to the Tauri installation.

The executable may not be available if it was not yet installed.

latest_version()

Returns the latest version of Tauri available.

release_name()

The name of the release Burrito wraps into the sidecar binary.

Burrito unpacks a shipped release into .burrito/<release>_erts-<vsn>_<app vsn>/, named after the release and nothing else. mix ex_tauri.install used to scaffold that release as :desktop for every app it touched, so two ex_tauri apps on one machine shared a single unpack directory — and anything reasoning about a sidecar from its path alone, ExTauri.Sidecar.Orphan included, could not tell whose process it was looking at. Four sidecars of one app were found there and read as abandoned instances of another.

New installs are given a name derived from the application, which makes the collision impossible rather than merely detectable. The default stays "desktop" so that every app installed before this keeps building, and its :desktop release keeps working untouched.

config :ex_tauri, release_name: "my_app_desktop"

run(args)

Runs a Tauri CLI command after building a full production release.

This function builds the Elixir release (with Burrito wrapping), then executes the Tauri CLI. Use this for production builds only.

For development, use run_dev/1 which skips Burrito for faster iteration. For commands that don't need a release at all, use run_simple/1.

Examples

ExTauri.run(["build", "--target", "x86_64-apple-darwin"])

run_dev(args, opts \\ [])

Runs a Tauri CLI command in development mode.

By default (sidecar: :phx_server) the sidecar is a small wrapper that runs the configured dev-server command — mix phx.server unless overridden via config :ex_tauri, :dev_command — directly, so code reloading, live reload, and dev config work inside the Tauri window.

Pass sidecar: :release to instead build a standard Elixir release (no Burrito) and run that as the sidecar. Use it to exercise release boot, runtime config, and migrations without waiting for a full production build.

Any name registered under config :ex_tauri, :sidecars (or a module implementing ExTauri.Sidecar) may also be passed. See ExTauri.Sidecar.

The configured :port is exported as EX_TAURI_PORT so the generated Rust code uses it instead of picking a free port (dev server config has a fixed port).

Examples

ExTauri.run_dev(["dev", "--no-dev-server-wait"])
ExTauri.run_dev(["dev", "--no-dev-server-wait"], sidecar: :release)

run_simple(args)

Runs a Tauri CLI command without building the Elixir release.

Use this for commands that don't require a sidecar binary, such as:

  • info - Display project information
  • icon - Generate application icons
  • signer - Manage code signing

Examples

ExTauri.run_simple(["info"])
ExTauri.run_simple(["icon", "app-icon.png"])

version()

Returns the ex_tauri package version.

This is the single source of truth for the version (defined as @version in mix.exs); everything that would otherwise hardcode a version string derives it from here.