Skip to content

Commit c56c92a

Browse files
committed
Improve dev script
1 parent aef2490 commit c56c92a

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ _site
104104

105105
# react stuff
106106
node_modules/
107+
checksum.txt
107108

108109
lerna-debug.log
109110
npm-debug.log*

scripts/develop_academy.sh

+33-2
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,40 @@ mv common/common.zip react_frontend/src/common.zip
9292
# Prepare the frontend
9393
nvm install 17
9494
nvm use 17
95+
96+
# Checking if the frontend needs compilation
9597
cd react_frontend/
96-
yarn install
97-
yarn build
98+
DIRECTORY_TO_MONITOR="."
99+
100+
new_checksum=$(find "$DIRECTORY_TO_MONITOR" \( -path "*/node_modules" -o \
101+
-path "*/__pycache__" -o \
102+
-path "*/migrations" -o \
103+
-name "yarn.lock" -o \
104+
-name "checksum.txt" \) -prune \
105+
-o -type f -exec md5sum {} + | \
106+
sort | \
107+
md5sum | \
108+
awk '{print $1}')
109+
110+
existing_checksum_file="$DIRECTORY_TO_MONITOR/checksum.txt"
111+
112+
if [ -f "$existing_checksum_file" ]; then
113+
existing_checksum=$(cat "$existing_checksum_file")
114+
if [ "$existing_checksum" != "$new_checksum" ]; then
115+
echo "$new_checksum" > "$existing_checksum_file"
116+
yarn install
117+
yarn dev &
118+
sleep 10
119+
else
120+
echo "No Compilation needed"
121+
fi
122+
else
123+
echo "$new_checksum" > "$existing_checksum_file"
124+
yarn install
125+
yarn dev &
126+
sleep 10
127+
fi
128+
98129
cd ..
99130

100131
# Prepare the compose file

0 commit comments

Comments
 (0)