Skip to content

Commit

Permalink
Realizar limpeza de ícones não utilizados
Browse files Browse the repository at this point in the history
  • Loading branch information
dgadelha committed Aug 6, 2024
1 parent 4122bad commit e432398
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deloy-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
sed -i -e 's*%DATE%*'"${DATE_NOW_FORMATTED}"'*g' packages/ide/src/app/tab-start/tab-start.component.html
sed -i -e 's/%SENTRY_RELEASE%/'"${GITHUB_SHA}"'/g' packages/ide/src/main.ts
npm run release
./packages/ide/cleanup-icons.sh
- name: Setup Firebase Hosting 🔥
env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
sed -i -e 's*%DATE%*'"${DATE_NOW_FORMATTED}"'*g' packages/ide/src/app/tab-start/tab-start.component.html
sed -i -e 's/%SENTRY_RELEASE%/'"${GITHUB_SHA}"'/g' packages/ide/src/main.ts
npm run release
./packages/ide/cleanup-icons.sh
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@releases/v3
Expand Down
25 changes: 25 additions & 0 deletions packages/ide/cleanup-icons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
## Remove os ícones que não são usados no projeto, para diminuir o download realizado pelo Service Worker

pushd "$(dirname ${BASH_SOURCE:0})" || exit 1
trap popd EXIT
shopt -s globstar nullglob

BASE_DIR="dist/browser/assets/mdi"

if [ ! -d "$BASE_DIR" ]; then
echo "Error: $BASE_DIR does not exist"
exit 1
fi

for i in "$BASE_DIR"/*.svg; do
ICON_NAME=$(basename "$i")

# Check if any file inside src/ uses the icon
if grep -q "$ICON_NAME" src/**/*.ts src/**/*.html src/**/*.scss; then
echo "skipped $ICON_NAME"
continue
fi

rm "$i"
done

0 comments on commit e432398

Please sign in to comment.