prod206flutter/prod206flutter-front-f/authsec_flutterNewUi/base_project/remove_unused.sh

15 lines
470 B
Bash
Raw Normal View History

2024-09-05 05:30:14 +00:00
#!/bin/bash
# Run dependency_validator and capture the output
output=$(flutter pub run dependency_validator 2>&1)
# Extract the list of potentially unused dependencies
unused_dependencies=$(echo "$output" | grep "These packages may be unused" -A 100 | tail -n +2 | grep -o '^\s*[*]\s\+\S*' | awk '{print $2}')
# Loop through each unused dependency and remove it
for package in $unused_dependencies
do
echo "Removing $package..."
dart pub remove $package
done