#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd $DIR
cd ../

function openBrowserDebounce(){
    sleep 2
    PORT=7072
    case "$OSTYPE" in
        solaris*) echo "SOLARIS not supported";;
        darwin*)  open "http://localhost:$PORT/";; 
        linux*)   xdg-open "http://localhost:$PORT/";;
        bsd*)     echo "BSD not supported" ;;
        msys*)    echo "WINDOWS notesupported" ;;
        *)        echo "unknown: $OSTYPE" ;;
    esac
}
printf "Would you open test browser for you? (y/N)"
read OpenBrowser
if [ "$OpenBrowser" = "Y" ] || [ "$OpenBrowser" = "y" ];then
    openBrowserDebounce&
else
    echo "Don't open browser"
    echo "Please visit http://localhost:7072/"
    printf "Press any key to continue"
    read _
    
fi
../node_modules/watchcompile/bin/watchcompile -f Watchfile.test -s

