From f72135d3bdb9b43baa1c4332dd9bb46f9e5910ca Mon Sep 17 00:00:00 2001 From: addetz <43963729+addetz@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:03:52 +0100 Subject: [PATCH] docs: add debug lines --- scripts/find-unused-images.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/find-unused-images.sh b/scripts/find-unused-images.sh index ffaa2f64e2f..1feac84db58 100755 --- a/scripts/find-unused-images.sh +++ b/scripts/find-unused-images.sh @@ -16,6 +16,7 @@ git fetch --all branches="master" version_branches=$(git branch --list "version-[0-9]-[0-9]") branches+=" $version_branches" +echo "Branches: $branches" for current_branch in $branches; do echo "Current branch: $current_branch" @@ -24,15 +25,18 @@ for current_branch in $branches; do find docs -type f -name "*.md" -exec grep -Hn "\.webp" {} + > docs_used_images.json find _partials -type f -name "*.mdx" -exec grep -Hn "\.webp" {} + > partials_used_images.json cat docs_used_images.json partials_used_images.json > used_images.json + echo "Created used_images.json" line_number=1 for img in $(cat all_images.json); do if grep -q $img used_images.json; then - sed -i .bak "${line_number}s|.*|${img},FOUND_USED|" all_images.json + sed -i "${line_number}s|.*|${img},FOUND_USED|" all_images.json fi ((line_number++)) done + echo "Finished processing branch $current_branch" + done # Remove all marked used files to make up the list