mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: add loading indicator when generating freezed file (#5978)
This commit is contained in:
parent
6283649a6b
commit
f7a2d9e581
@ -75,6 +75,21 @@ if [ "$exclude_packages" = false ]; then
|
|||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Function to display animated loading text
|
||||||
|
display_loading() {
|
||||||
|
local pid=$1
|
||||||
|
local delay=0.5
|
||||||
|
local spinstr='|/-\'
|
||||||
|
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
|
||||||
|
local temp=${spinstr#?}
|
||||||
|
printf " [%c] Generating freezed files..." "$spinstr"
|
||||||
|
local spinstr=$temp${spinstr%"$temp"}
|
||||||
|
sleep $delay
|
||||||
|
printf "\r"
|
||||||
|
done
|
||||||
|
printf " \r"
|
||||||
|
}
|
||||||
|
|
||||||
# Navigate to the appflowy_flutter directory and generate files
|
# Navigate to the appflowy_flutter directory and generate files
|
||||||
echo "🧊 Start generating freezed files (AppFlowy)."
|
echo "🧊 Start generating freezed files (AppFlowy)."
|
||||||
|
|
||||||
@ -86,13 +101,28 @@ if [ "$skip_pub_packages_get" = false ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Start the build_runner in the background
|
||||||
if [ "$verbose" = true ]; then
|
if [ "$verbose" = true ]; then
|
||||||
dart run build_runner build -d
|
dart run build_runner build -d &
|
||||||
else
|
else
|
||||||
dart run build_runner build >/dev/null 2>&1
|
dart run build_runner build >/dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Return to the original directory
|
# Get the PID of the background process
|
||||||
|
build_pid=$!
|
||||||
|
|
||||||
|
# Start the loading animation
|
||||||
|
display_loading $build_pid &
|
||||||
|
|
||||||
|
# Get the PID of the loading animation
|
||||||
|
loading_pid=$!
|
||||||
|
|
||||||
|
# Wait for the build_runner to finish
|
||||||
|
wait $build_pid
|
||||||
|
|
||||||
|
# Clear the line
|
||||||
|
printf "\r%*s\r" $(($(tput cols))) ""
|
||||||
|
|
||||||
cd "$original_dir"
|
cd "$original_dir"
|
||||||
|
|
||||||
echo "🧊 Done generating freezed files."
|
echo "🧊 Done generating freezed files."
|
||||||
|
Loading…
Reference in New Issue
Block a user