vibetunnel/mac/scripts/install-node.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

66 lines
No EOL
2 KiB
Bash
Executable file

#!/bin/bash
#
# Check for Node.js availability for the build process
#
# This script ensures Node.js is available for building VibeTunnel
#
set -uo pipefail
# Script directory and paths
if [ -n "${BASH_SOURCE[0]:-}" ]; then
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
else
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
fi
echo "Checking for Node.js..."
# Skip Node.js check in CI when web artifacts are pre-built
if [ "${CI}" = "true" ] && [ "${SKIP_NODE_CHECK}" = "true" ]; then
echo "✓ Skipping Node.js check in CI (web artifacts are pre-built)"
exit 0
fi
# Load Node.js environment managers (Homebrew, nvm, Volta, fnm)
source "${SCRIPT_DIR}/node-path-setup.sh"
# Check if Node.js is available
if command -v node &> /dev/null; then
echo "✓ Node.js found: $(which node)"
echo " Version: $(node --version)"
# Check Node.js version (need v20+)
NODE_VERSION=$(node --version | cut -d'v' -f2)
NODE_MAJOR=$(echo "$NODE_VERSION" | cut -d'.' -f1)
if [ "$NODE_MAJOR" -lt 20 ]; then
echo "Warning: Node.js v20+ is recommended (found v$NODE_VERSION)"
fi
# Check if pnpm is available
if command -v pnpm &> /dev/null; then
echo "✓ pnpm found: $(which pnpm)"
echo " Version: $(pnpm --version)"
else
echo "Error: pnpm not found. Please install pnpm."
echo " - Install via npm: npm install -g pnpm"
echo " - Install via Homebrew: brew install pnpm"
echo " - Install via standalone script: curl -fsSL https://get.pnpm.io/install.sh | sh -"
exit 1
fi
exit 0
else
echo "Error: Node.js not found in PATH"
echo ""
echo "Please install Node.js 20+ using one of these methods:"
echo " - Homebrew: brew install node"
echo " - Download from: https://nodejs.org/"
echo " - Using nvm: nvm install 20"
echo " - Using volta: volta install node@20"
echo " - Using fnm: fnm install 20"
echo ""
echo "PATH checked: $PATH"
exit 1
fi