generate_freezed.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # Store the current working directory
  3. original_dir=$(pwd)
  4. cd "$(dirname "$0")"
  5. # Navigate to the project root
  6. cd ../../../appflowy_flutter
  7. # Navigate to the appflowy_flutter directory and generate files
  8. echo "Generating files for appflowy_flutter"
  9. flutter clean >/dev/null 2>&1 && flutter packages pub get >/dev/null 2>&1 && dart run build_runner clean && dart run build_runner build -d
  10. echo "Done generating files for appflowy_flutter"
  11. echo "Generating files for packages"
  12. cd packages
  13. for d in */ ; do
  14. # Navigate into the subdirectory
  15. cd "$d"
  16. # Check if the subdirectory contains a pubspec.yaml file
  17. if [ -f "pubspec.yaml" ]; then
  18. echo "Generating freezed files in $d..."
  19. echo "Please wait while we clean the project and fetch the dependencies."
  20. flutter clean >/dev/null 2>&1 && flutter packages pub get >/dev/null 2>&1 && dart run build_runner clean && dart run build_runner build -d
  21. echo "Done running build command in $d"
  22. else
  23. echo "No pubspec.yaml found in $d, it can\'t be a Dart project. Skipping."
  24. fi
  25. # Navigate back to the packages directory
  26. cd ..
  27. done
  28. # Return to the original directory
  29. cd "$original_dir"