Skip to content

Commit

Permalink
modified develop_academy.sh to compile dev only once when changed
Browse files Browse the repository at this point in the history
  • Loading branch information
vaishnavimulik25 committed Mar 29, 2024
1 parent 992c6dc commit 53fc2a7
Showing 1 changed file with 35 additions and 9 deletions.
44 changes: 35 additions & 9 deletions scripts/develop_academy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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="."

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
Expand All @@ -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

0 comments on commit 53fc2a7

Please sign in to comment.