Something went wrong. Try again.
Ghostty for the web with xterm.js API compatibility
Something went wrong. Try again.
1.2 kB · 44 lines
Shell
at task2
123456789101112131415161718192021222324252627282930313233343536373839404142434445#!/bin/bashset -e
echo "🔨 Building ghostty-vt.wasm..."
# Check for Zigif ! command -v zig &> /dev/null; then echo "❌ Error: Zig not found" echo "" echo "Install Zig 0.15.2+:" echo " macOS: brew install zig" echo " Linux: https://ziglang.org/download/" echo "" exit 1fi
ZIG_VERSION=$(zig version)echo "✓ Found Zig $ZIG_VERSION"
# Clone/update GhosttyGHOSTTY_DIR="/tmp/ghostty-for-wasm"if [ ! -d "$GHOSTTY_DIR" ]; then echo "📦 Cloning Ghostty..." git clone --depth=1 https://github.com/ghostty-org/ghostty.git "$GHOSTTY_DIR"else echo "📦 Updating Ghostty..." cd "$GHOSTTY_DIR" git pull --quietfi
# Build WASMcd "$GHOSTTY_DIR"echo "⚙️ Building WASM (takes ~20 seconds)..."zig build lib-vt -Dtarget=wasm32-freestanding -Doptimize=ReleaseSmall
# Copy to project root# Get absolute path to script directory (resolve relative paths)SCRIPT_PATH="$(readlink -f "$0")"SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"cp "$GHOSTTY_DIR/zig-out/bin/ghostty-vt.wasm" "$PROJECT_ROOT/"
SIZE=$(du -h "$PROJECT_ROOT/ghostty-vt.wasm" | cut -f1)echo "✅ Built ghostty-vt.wasm ($SIZE)"