chore: 清理残余文件

This commit is contained in:
2026-03-21 20:26:20 +08:00
parent c265de6a84
commit fd70c1ad41
957 changed files with 117441 additions and 0 deletions

64
scripts/build-wasm.ps1 Normal file
View File

@@ -0,0 +1,64 @@
# Build script for libghostty-vt WASM (PowerShell)
# Run this script after installing Zig
param(
[string]$OutputDir = "src\frontend"
)
$ErrorActionPreference = "Stop"
Write-Host "============================================" -ForegroundColor Cyan
Write-Host " Building libghostty-vt WebAssembly" -ForegroundColor Cyan
Write-Host "============================================" -ForegroundColor Cyan
Write-Host ""
# Check Zig installation
$zig = Get-Command zig -ErrorAction SilentlyContinue
if (-not $zig) {
Write-Host "ERROR: Zig not found. Please install Zig 0.13.0+" -ForegroundColor Red
Write-Host "Download: https://ziglang.org/download/" -ForegroundColor Yellow
exit 1
}
$zigVersion = zig version
Write-Host "Zig version: $zigVersion"
Write-Host ""
$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path
if (-not $SCRIPT_DIR) { $SCRIPT_DIR = Get-Location }
$GHOSTTY_DIR = Join-Path $SCRIPT_DIR "lib\ghostty"
$OUTPUT_DIR = Join-Path $SCRIPT_DIR $OutputDir
# Create output directory
New-Item -ItemType Directory -Force -Path $OUTPUT_DIR | Out-Null
# Navigate to ghostty
Set-Location $GHOSTTY_DIR
Write-Host "Building libghostty-vt WASM..." -ForegroundColor Yellow
Write-Host ""
# Build WASM module
zig build lib-vt -Dtarget=wasm32-freestanding -Doptimize=ReleaseSmall -Dwasm_shared=false
# Find and copy WASM output
$wasmFiles = Get-ChildItem -Path "zig-out" -Recurse -Filter "*.wasm" -ErrorAction SilentlyContinue
if ($wasmFiles) {
$wasmOutput = $wasmFiles[0].FullName
Copy-Item $wasmOutput (Join-Path $OUTPUT_DIR "ghostty-vt.wasm") -Force
Write-Host ""
Write-Host "============================================" -ForegroundColor Green
Write-Host " SUCCESS!" -ForegroundColor Green
Write-Host "============================================" -ForegroundColor Green
Write-Host "WASM file: $(Join-Path $OUTPUT_DIR 'ghostty-vt.wasm')"
Write-Host ""
Write-Host "To run the terminal:" -ForegroundColor Cyan
Write-Host " cd ghostty-web; npm start" -ForegroundColor White
Write-Host ""
} else {
Write-Host ""
Write-Host "WARNING: WASM build succeeded but output not found" -ForegroundColor Yellow
Write-Host "Check: $GHOSTTY_DIR\zig-out\" -ForegroundColor Yellow
}

60
scripts/build-wasm.sh Normal file
View File

@@ -0,0 +1,60 @@
#!/bin/bash
# Build script for libghostty-vt WASM
# Run this script after installing Zig
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
GHOSTTY_DIR="$SCRIPT_DIR/lib/ghostty"
OUTPUT_DIR="$SCRIPT_DIR/src/frontend"
echo "============================================"
echo " Building libghostty-vt WebAssembly"
echo "============================================"
echo ""
# Check Zig installation
if ! command -v zig &> /dev/null; then
echo "ERROR: Zig not found. Please install Zig 0.13.0+"
echo "Download: https://ziglang.org/download/"
exit 1
fi
ZIG_VERSION=$(zig version)
echo "Zig version: $ZIG_VERSION"
echo ""
# Create output directory
mkdir -p "$OUTPUT_DIR"
# Navigate to ghostty
cd "$GHOSTTY_DIR"
echo "Building libghostty-vt WASM..."
echo ""
# Build WASM module
zig build lib-vt \
-Dtarget=wasm32-freestanding \
-Doptimize=ReleaseSmall \
-Dwasm_shared=false
# Find and copy WASM output
WASM_OUTPUT=$(find zig-out -name "*.wasm" 2>/dev/null | head -1)
if [ -n "$WASM_OUTPUT" ]; then
cp "$WASM_OUTPUT" "$OUTPUT_DIR/ghostty-vt.wasm"
echo ""
echo "============================================"
echo " SUCCESS!"
echo "============================================"
echo "WASM file: $OUTPUT_DIR/ghostty-vt.wasm"
echo ""
echo "To run the terminal:"
echo " cd ghostty-web && npm start"
echo ""
else
echo ""
echo "WARNING: WASM build succeeded but output not found"
echo "Check: $GHOSTTY_DIR/zig-out/"
fi

32
scripts/install-zig.sh Normal file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# Install Zig for compiling libghostty-vt WASM
set -e
ZIG_VERSION="0.13.0"
install_zig() {
echo "Installing Zig ${ZIG_VERSION}..."
if command -v choco &> /dev/null; then
# Windows with Chocolatey
choco install zig --version=${ZIG_VERSION} -y
elif command -v brew &> /dev/null; then
# macOS with Homebrew
brew install zig@${ZIG_VERSION}
elif command -v apt &> /dev/null; then
# Linux with apt
wget https://github.com/ziglang/zig/releases/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz
tar -xf zig-linux-x86_64-${ZIG_VERSION}.tar.xz
sudo mv zig-linux-x86_64-${ZIG_VERSION} /opt/zig
rm zig-linux-x86_64-${ZIG_VERSION}.tar.xz
else
echo "Please install Zig manually from https://ziglang.org/download/"
exit 1
fi
echo "Zig installed successfully!"
zig version
}
install_zig