diff --git a/scripts/develop_academy.sh b/scripts/develop_academy.sh index 6ca6784b7..42e2d3a89 100644 --- a/scripts/develop_academy.sh +++ b/scripts/develop_academy.sh @@ -39,17 +39,42 @@ if ! command -v nvm &> /dev/null; then source $NVM_DIR/nvm.sh; fi -# Prepare yarn -if ! command -v yarn --version &> /dev/null; then - npm install --global yarn -fi - # Prepare the frontend nvm install 16 nvm use 16 + +# Checking if the frontend needs compilation cd react_frontend/ -yarn install -yarn build +DIRECTORY_TO_MONITOR="." + +new_checksum=$(find "$DIRECTORY_TO_MONITOR" \( -path "*/node_modules" -o \ + -path "*/__pycache__" \) -prune \ + -o -type f -exec md5sum {} + | \ + sort | \ + md5sum | \ + awk '{print $1}') + +existing_checksum_file="$DIRECTORY_TO_MONITOR/checksum.txt" + +if [ -f "$existing_checksum_file" ]; then + existing_checksum=$(cat "$existing_checksum_file") + if [ "$existing_checksum" != "$new_checksum" ]; then + if command -v npm &> /dev/null; then + npm install --force + npm run dev & + sleep 10 + + else + yarn install + yarn dev run & + sleep 10 + fi + fi +else + echo "$new_checksum" > "$existing_checksum_file" +fi + + cd .. # Prepare the compose file @@ -59,7 +84,8 @@ if [ $radi_version != "humble" ]; then fi cp compose_cfg/$compose_file docker-compose.yaml + # Proceed with docker-compose commands -docker compose up; -docker compose down; +docker-compose up +docker-compose down rm docker-compose.yaml