Skip to content

Commit

Permalink
Merge pull request #37735 from nextcloud/techdebt/ref-37476/ignore-ex…
Browse files Browse the repository at this point in the history
…cluded-dirs-on-image-optimization

chore(assets): Ignore git-ignored directories on image optimization
  • Loading branch information
nickvergessen authored Apr 17, 2023
2 parents a5348bc + 64843c2 commit b21c5c8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions build/image-optimization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,19 @@ function recursive_optimize_images() {
DIR_NAME=${PWD##*/}

if [[ "$DIR_NAME" == "node_modules" ]]; then
echo "Ignoring node_modules for image optimization"
return
elif [[ "$DIR_NAME" == "tests" ]]; then
echo "Ignoring tests for image optimization"
return
elif [[ "$DIR_NAME" == "3rdparty" ]]; then
echo "Ignoring 3rdparty for image optimization"
return
elif [[ "$DIR_NAME" == "vendor" ]]; then
echo "Ignoring vendor for image optimization"
return
elif [[ "$DIR_NAME" == "vendor-bin" ]]; then
echo "Ignoring vendor-bin for image optimization"
return
fi

Expand Down Expand Up @@ -75,6 +86,11 @@ function recursive_optimize_images() {
[[ -e "$dir" ]] || break

if [[ -d "$dir" ]]; then
if git check-ignore $dir -q ; then
echo "$dir is not shipped. Ignoring image optimization"
continue
fi

recursive_optimize_images "$dir"
cd ..
fi
Expand Down

0 comments on commit b21c5c8

Please sign in to comment.