Fix missing public directory in Mac app bundle (#392)

This commit is contained in:
Peter Steinberger 2025-07-17 14:12:34 +02:00 committed by GitHub
parent 3fa79e0f1b
commit 5bdc7f7b1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 10 deletions

View file

@ -268,6 +268,10 @@ final class BunServer {
// Add Node.js memory settings as command line arguments instead of NODE_OPTIONS
// NODE_OPTIONS can interfere with SEA binaries
// Set BUILD_PUBLIC_PATH to help the server find static files in the app bundle
environment["BUILD_PUBLIC_PATH"] = staticPath
logger.info("Setting BUILD_PUBLIC_PATH=\(staticPath)")
process.environment = environment

View file

@ -64,17 +64,22 @@ if [ -f "$PACKAGE_JSON" ]; then
fi
# Test 7: Basic functionality test (help command)
# Use gtimeout if available, otherwise skip timeout
if command -v gtimeout >/dev/null 2>&1; then
if ! gtimeout 5 "$VT_SCRIPT" --help >/dev/null 2>&1; then
echo "❌ ERROR: vt --help command failed or timed out"
exit 1
fi
# Skip this test if we're already inside a VibeTunnel session
if [ -n "$VIBETUNNEL_SESSION_ID" ]; then
echo "✅ vt script detected we're inside a VibeTunnel session (expected behavior)"
else
# On macOS without gtimeout, just test that it doesn't immediately fail
if ! "$VT_SCRIPT" --help >/dev/null 2>&1; then
echo "❌ ERROR: vt --help command failed"
exit 1
# Use gtimeout if available, otherwise skip timeout
if command -v gtimeout >/dev/null 2>&1; then
if ! gtimeout 5 "$VT_SCRIPT" --help >/dev/null 2>&1; then
echo "❌ ERROR: vt --help command failed or timed out"
exit 1
fi
else
# On macOS without gtimeout, just test that it doesn't immediately fail
if ! "$VT_SCRIPT" --help >/dev/null 2>&1; then
echo "❌ ERROR: vt --help command failed"
exit 1
fi
fi
fi
echo "✅ vt --help command works"

View file

@ -561,6 +561,11 @@ export async function createApp(): Promise<AppInstance> {
// Serve static files with .html extension handling and caching headers
// In production/bundled mode, use the package directory; in development, use cwd
const getPublicPath = () => {
// First check if BUILD_PUBLIC_PATH is set (used by Mac app bundle)
if (process.env.BUILD_PUBLIC_PATH) {
logger.info(`Using BUILD_PUBLIC_PATH: ${process.env.BUILD_PUBLIC_PATH}`);
return process.env.BUILD_PUBLIC_PATH;
}
// More precise npm package detection:
// 1. Check if we're explicitly in an npm package structure
// 2. The file should be in node_modules/vibetunnel/lib/