vibetunnel/mac/scripts/node-path-setup.sh
Peter Steinberger bc9f505026
Fix Ghostty terminal spawn issues with dynamic delays (#408)
* Fix Ghostty terminal spawn issues with dynamic delays

- Add isTerminalRunning() helper to check if terminal app is running
- Implement dynamic delays for Ghostty based on running state
  - 0.5s delay for warm start (already running)
  - 2.0s delay for cold start (needs to launch)
- Add window count checking to ensure UI is ready
- Fix issue where commands weren't executed when Ghostty had no windows

Fixes #371

* Fix CI: Skip Node.js check when using pre-built web artifacts

- Add SKIP_NODE_CHECK=true environment variable to Mac CI build step
- Prevents install-node.sh from failing when pnpm is not available
- CI downloads pre-built web artifacts, so Node.js/pnpm are not needed

* Fix CI: Properly handle pre-built web artifacts in Mac build

- Add early exit in build-web-frontend.sh when CI has pre-built artifacts
- Set CI=true environment variable in all Xcode build steps
- Update node-path-setup.sh to skip Node.js check in CI
- Copy pre-built artifacts directly without attempting rebuild
- This prevents pnpm dependency errors in CI environment

* Fix SwiftFormat modifier order issue

- Change 'static weak' to 'weak static' in AppDelegate
- SwiftFormat requires consistent modifier ordering

* Fix CI: Include native binaries in web artifacts

- Add web/native/ directory to uploaded artifacts
- Add web/bin/vt script to uploaded artifacts
- This ensures Mac tests can find the vibetunnel executable
- Fixes test failures due to missing server binary

* Fix CI: Copy native binaries from web artifacts in Mac CI

- Update artifact extraction to copy web/native/ directory
- Also copy web/bin/ directory for vt script
- Add debugging output to show native contents
- This ensures tests can find the vibetunnel executable
2025-07-18 17:24:30 +02:00

34 lines
1.3 KiB
Bash

#!/bin/bash
# Load fnm if available
if command -v fnm >/dev/null 2>&1; then
eval "$(fnm env)" 2>/dev/null || true
fi
# Load NVM if available
if [ -s "$HOME/.nvm/nvm.sh" ]; then
export NVM_DIR="$HOME/.nvm"
source "$NVM_DIR/nvm.sh" 2>/dev/null || true
fi
# Check if we're in a build context that needs to avoid Homebrew library contamination
# This is set by build scripts that compile native code
if [ "${VIBETUNNEL_BUILD_CLEAN_ENV:-}" = "true" ]; then
# For builds, add Homebrew at the END of PATH to avoid library contamination
# This ensures system libraries are preferred during compilation
export PATH="$HOME/.volta/bin:$HOME/Library/pnpm:$HOME/.bun/bin:$PATH:/opt/homebrew/bin:/usr/local/bin"
else
# For normal usage, Homebrew can be at the beginning for convenience
export PATH="/opt/homebrew/bin:/usr/local/bin:$HOME/.volta/bin:$HOME/Library/pnpm:$HOME/.bun/bin:$PATH"
fi
# Verify Node.js is available (skip in CI when using pre-built artifacts)
if [ "${SKIP_NODE_CHECK}" = "true" ] && [ "${CI}" = "true" ]; then
# In CI with pre-built artifacts, Node.js is not required
return 0 2>/dev/null || exit 0
fi
if ! command -v node >/dev/null 2>&1; then
echo "error: Node.js not found. Install via: brew install node" >&2
return 1 2>/dev/null || exit 1
fi