mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2025-09-19 21:32:39 +08:00
🚧 add script to get packages for all projects
This commit is contained in:
23
get_packages.sh
Executable file
23
get_packages.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
# Written by Nishant Srivastava
|
||||
|
||||
# Call as
|
||||
# ./get_packages.sh
|
||||
|
||||
echo "# Updating to packages..."
|
||||
|
||||
# Iterate over each sub-directory inside the current directory
|
||||
for DIR in ./*;
|
||||
do
|
||||
# Check if pubspec.yaml file exists inside the $DIR directory
|
||||
# If it does then it is a Flutter project
|
||||
if [ -f "$DIR/pubspec.yaml" ]; then
|
||||
# Update the packages in the project
|
||||
echo ""
|
||||
echo ">>>> Get packages for " "$DIR"
|
||||
# Run `flutter packages get` command inside the sub-directory i.e Flutter project
|
||||
(cd "$DIR" && flutter packages get);
|
||||
echo ""
|
||||
echo ">>>> Done."
|
||||
fi
|
||||
done
|
Reference in New Issue
Block a user