generate_freezed.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 &&
  10. flutter packages pub get >/dev/null 2>&1
  11. dart run build_runner build -d
  12. echo "Done generating files for appflowy_flutter"
  13. echo "Generating files for packages"
  14. cd packages
  15. for d in */; do
  16. # Navigate into the subdirectory
  17. cd "$d"
  18. # Check if the subdirectory contains a pubspec.yaml file
  19. if [ -f "pubspec.yaml" ]; then
  20. echo "Generating freezed files in $d..."
  21. echo "Please wait while we clean the project and fetch the dependencies."
  22. flutter packages pub get >/dev/null 2>&1
  23. dart run build_runner build -d
  24. echo "Done running build command in $d"
  25. else
  26. echo "No pubspec.yaml found in $d, it can\'t be a Dart project. Skipping."
  27. fi
  28. # Navigate back to the packages directory
  29. cd ..
  30. done
  31. # Return to the original directory
  32. cd "$original_dir"