42 lines
1.2 KiB
Bash
Executable File
42 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Build the project first
|
|
echo "Building scheduling-remote..."
|
|
npm run build
|
|
|
|
# Start build:watch in the background
|
|
echo "Starting build:watch in background..."
|
|
npm run build:watch &
|
|
|
|
# Wait for remoteEntry.js to exist before starting the server
|
|
# Check both possible locations (root and assets folder)
|
|
echo "Waiting for remoteEntry.js to be generated..."
|
|
MAX_WAIT=30
|
|
WAIT_COUNT=0
|
|
REMOTE_ENTRY_ROOT="dist/remoteEntry.js"
|
|
REMOTE_ENTRY_ASSETS="dist/assets/remoteEntry.js"
|
|
|
|
while [ $WAIT_COUNT -lt $MAX_WAIT ]; do
|
|
# Check if file exists in either location
|
|
if [ -f "$REMOTE_ENTRY_ROOT" ] || [ -f "$REMOTE_ENTRY_ASSETS" ]; then
|
|
echo "remoteEntry.js found! Starting http-server..."
|
|
break
|
|
fi
|
|
|
|
sleep 1
|
|
WAIT_COUNT=$((WAIT_COUNT + 1))
|
|
if [ $((WAIT_COUNT % 5)) -eq 0 ]; then
|
|
echo "Still waiting for remoteEntry.js... (${WAIT_COUNT}s)"
|
|
fi
|
|
done
|
|
|
|
# Final check
|
|
if [ ! -f "$REMOTE_ENTRY_ROOT" ] && [ ! -f "$REMOTE_ENTRY_ASSETS" ]; then
|
|
echo "ERROR: remoteEntry.js was not generated after ${MAX_WAIT} seconds!"
|
|
echo "Checked locations: $REMOTE_ENTRY_ROOT and $REMOTE_ENTRY_ASSETS"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Starting http-server on port 3003..."
|
|
npx http-server dist -p 3003 --cors -c-1
|