From a0a69d2d851de2706dd58b7eb3b3b4f8bbb59ce7 Mon Sep 17 00:00:00 2001 From: Volker E Date: Fri, 30 Apr 2021 04:39:11 -0700 Subject: [PATCH] build: Unify 'svg_check.sh' Simplify readability and reduce output to errors only on terminal. Also includes suppression for consecutive errors as added in Popups in I5ef7843c9de122c8dce61fbb98737c8acdd0c22c. Change-Id: Ib4705667815cf690e327fdc5f9048c6d6ce779a6 --- dev-scripts/svg_check.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dev-scripts/svg_check.sh b/dev-scripts/svg_check.sh index 65cda467a..849eadb56 100755 --- a/dev-scripts/svg_check.sh +++ b/dev-scripts/svg_check.sh @@ -1,18 +1,18 @@ #!/usr/bin/env bash found=0 -while read -r svgfile; do +for svgfile in `find resources -type f -name "*.svg"`; do outfile="$svgfile.tmp" echo -n "Checking compression: $svgfile ... " node_modules/.bin/svgo --config .svgo.config.js -i "$svgfile" -o "$outfile" -q - if [ "$(wc -c < "$svgfile")" -gt "$(wc -c < "$outfile")" ]; then - echo -e "\nERR> file $svgfile is not compressed." - found=$((found + 1)) - else - echo "OK" + if [ -f $outfile ]; then + if [ "$(wc -c < "$svgfile")" -gt "$(wc -c < "$outfile")" ]; then + echo "File $svgfile is not compressed." + found=$((found + 1)) + fi + rm "$outfile" fi - rm "$outfile" -done < <(find resources -type f -name '*.svg') +done if [ $found -gt 0 ]; then echo "Found $found uncompressed SVG files. Please compress the files and re-submit the patch."