From 7a298b2de316e414da58bd3207aaebd4a5653269 Mon Sep 17 00:00:00 2001 From: "K.C. Wong" <794816+dvusboy@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:34:28 -0700 Subject: [PATCH] Update replace-placeholder.sh Speed up the replacement loop * only look at files with "$FROM" pattern --- scripts/replace-placeholder.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/replace-placeholder.sh b/scripts/replace-placeholder.sh index 57dbabb..fbe9e90 100755 --- a/scripts/replace-placeholder.sh +++ b/scripts/replace-placeholder.sh @@ -10,7 +10,6 @@ fi # Only peform action if $FROM and $TO are different. echo "Replacing all statically built instances of $FROM with $TO." -find apps/web/.next/ apps/web/public -type f | -while read file; do - sed -i "s|$FROM|$TO|g" "$file" +for file in $(egrep -r -l "${FROM}" apps/web/.next/ apps/web/public/); do + sed -i -e "s|$FROM|$TO|g" "$file" done