mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-16 21:30:39 -07:00
Initialize voicebox project with backend, frontend, and Tauri setup. Added configuration files, dependencies, and basic structure for components, hooks, and utilities. Included README and setup documentation for guidance.
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# Build Python server binary for all platforms
|
||||
|
||||
set -e
|
||||
|
||||
# Determine platform
|
||||
PLATFORM=$(rustc --print host-tuple 2>/dev/null || echo "unknown")
|
||||
|
||||
echo "Building voicebox-server for platform: $PLATFORM"
|
||||
|
||||
# Build Python binary
|
||||
cd backend
|
||||
|
||||
# Check if PyInstaller is installed
|
||||
if ! python -c "import PyInstaller" 2>/dev/null; then
|
||||
echo "Installing PyInstaller..."
|
||||
pip install pyinstaller
|
||||
fi
|
||||
|
||||
# Build binary
|
||||
python build_binary.py
|
||||
|
||||
# Create binaries directory if it doesn't exist
|
||||
mkdir -p ../tauri/src-tauri/binaries
|
||||
|
||||
# Copy binary with platform suffix
|
||||
if [ -f dist/voicebox-server ]; then
|
||||
cp dist/voicebox-server ../tauri/src-tauri/binaries/voicebox-server-${PLATFORM}
|
||||
chmod +x ../tauri/src-tauri/binaries/voicebox-server-${PLATFORM}
|
||||
echo "Built voicebox-server-${PLATFORM}"
|
||||
elif [ -f dist/voicebox-server.exe ]; then
|
||||
cp dist/voicebox-server.exe ../tauri/src-tauri/binaries/voicebox-server-${PLATFORM}.exe
|
||||
echo "Built voicebox-server-${PLATFORM}.exe"
|
||||
else
|
||||
echo "Error: Binary not found in dist/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Build complete!"
|
||||
Executable
+81
@@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
# Generate OpenAPI TypeScript client from FastAPI schema
|
||||
|
||||
set -e
|
||||
|
||||
echo "Generating OpenAPI client..."
|
||||
|
||||
# Check if backend is running
|
||||
if ! curl -s http://localhost:8000/openapi.json > /dev/null 2>&1; then
|
||||
echo "Backend not running. Starting backend..."
|
||||
cd backend
|
||||
|
||||
# Check if virtual environment exists
|
||||
if [ ! -d "venv" ]; then
|
||||
echo "Creating virtual environment..."
|
||||
python -m venv venv
|
||||
fi
|
||||
|
||||
source venv/bin/activate 2>/dev/null || source venv/Scripts/activate 2>/dev/null
|
||||
|
||||
# Install dependencies if needed
|
||||
if ! python -c "import fastapi" 2>/dev/null; then
|
||||
echo "Installing backend dependencies..."
|
||||
pip install -r requirements.txt
|
||||
fi
|
||||
|
||||
# Start backend in background
|
||||
echo "Starting backend server..."
|
||||
uvicorn main:app --port 8000 &
|
||||
BACKEND_PID=$!
|
||||
|
||||
# Wait for server to be ready
|
||||
echo "Waiting for server to start..."
|
||||
for i in {1..30}; do
|
||||
if curl -s http://localhost:8000/openapi.json > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if ! curl -s http://localhost:8000/openapi.json > /dev/null 2>&1; then
|
||||
echo "Error: Backend failed to start"
|
||||
kill $BACKEND_PID 2>/dev/null || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Backend started (PID: $BACKEND_PID)"
|
||||
STARTED_BACKEND=true
|
||||
else
|
||||
STARTED_BACKEND=false
|
||||
fi
|
||||
|
||||
# Download OpenAPI schema
|
||||
echo "Downloading OpenAPI schema..."
|
||||
curl -s http://localhost:8000/openapi.json > app/openapi.json
|
||||
|
||||
# Check if openapi-typescript-codegen is installed
|
||||
if ! bunx --bun openapi-typescript-codegen --version > /dev/null 2>&1; then
|
||||
echo "Installing openapi-typescript-codegen..."
|
||||
bun add -d openapi-typescript-codegen
|
||||
fi
|
||||
|
||||
# Generate TypeScript client
|
||||
echo "Generating TypeScript client..."
|
||||
cd app
|
||||
bunx --bun openapi-typescript-codegen \
|
||||
--input openapi.json \
|
||||
--output src/lib/api \
|
||||
--client fetch \
|
||||
--useOptions \
|
||||
--exportSchemas true
|
||||
|
||||
echo "API client generated in app/src/lib/api"
|
||||
|
||||
# Clean up
|
||||
if [ "$STARTED_BACKEND" = true ]; then
|
||||
echo "Stopping backend server..."
|
||||
kill $BACKEND_PID 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo "Done!"
|
||||
Reference in New Issue
Block a user