Files
openhuman/scripts/ensure-tauri-cli.sh
T
Steven Enamakel ff684f22e8 feat(tauri): integrate vendored CEF-aware tauri-cli and update development scripts
- Added a new script `ensure-tauri-cli.sh` to ensure the vendored CEF-aware `tauri-cli` is installed, preventing runtime errors related to missing Chromium Embedded Framework files.
- Updated `package.json` scripts to call `yarn tauri:ensure` before other commands, ensuring the correct CLI is used for building and running the application.
- Enhanced documentation in `CLAUDE.md` and `install.md` to clarify the requirement for the vendored `tauri-cli` and the installation process.
- Improved the `dev:app` and `dev:wry` scripts to streamline the development workflow with the new CLI setup.

These changes enhance the development experience by ensuring the correct tooling is in place for building and running the application with CEF support.
2026-04-17 21:36:22 -07:00

38 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Ensure the vendored CEF-aware tauri-cli is installed as `cargo-tauri`.
#
# The stock `@tauri-apps/cli` / upstream `tauri-cli` does NOT know how to bundle
# the CEF (Chromium Embedded Framework) runtime into the `.app` bundle's
# `Contents/Frameworks/` — so running `cargo tauri dev` with it produces an
# `OpenHuman.app` that panics at startup inside
# `cef::library_loader::LibraryLoader::new(...)` with:
# "No such file or directory" (Os { code: 2 })
#
# The vendored fork at `app/src-tauri/vendor/tauri-cef/crates/tauri-cli` has the
# CEF bundler logic. Install it once and cargo will use it for every
# `cargo tauri ...` invocation.
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
VENDOR_CLI="$ROOT_DIR/app/src-tauri/vendor/tauri-cef/crates/tauri-cli"
VENDOR_CARGO_TOML="$VENDOR_CLI/Cargo.toml"
if [[ ! -f "$VENDOR_CARGO_TOML" ]]; then
echo "[ensure-tauri-cli] vendored tauri-cli not found at $VENDOR_CLI" >&2
echo "[ensure-tauri-cli] did you forget to init the submodule? try:" >&2
echo " git submodule update --init --recursive" >&2
exit 1
fi
# Detect whether the currently installed cargo-tauri came from our vendored path.
CRATES_TOML="${CARGO_HOME:-$HOME/.cargo}/.crates.toml"
if [[ -f "$CRATES_TOML" ]] && grep -q "tauri-cli.*$VENDOR_CLI" "$CRATES_TOML" 2>/dev/null; then
# Already installed from this exact path. Cargo won't rebuild unless sources change.
exit 0
fi
echo "[ensure-tauri-cli] installing vendored CEF-aware tauri-cli from $VENDOR_CLI"
echo "[ensure-tauri-cli] (first install only — takes a few minutes; subsequent runs are instant)"
cargo install --locked --path "$VENDOR_CLI"