From a603c09e7e00ed19b9eacaf2b4723b6b0b09716b Mon Sep 17 00:00:00 2001 From: pheralb Date: Thu, 2 Oct 2025 16:26:11 +0100 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=A7=B9=20Remove=20unused/duplicate=20?= =?UTF-8?q?SVGs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/library/android.svg | 1 - static/library/bigcommerce-dark.svg | 3 --- static/library/bigcommerce-light.svg | 3 --- static/library/claude-ai.svg | 1 - static/library/dub-wordmark.svg | 1 - static/library/movie-web.svg | 3 --- static/library/search-by-algolia.svg | 1 - static/library/soundcloud.svg | 1 - static/library/tensorflow.svg | 1 - 9 files changed, 15 deletions(-) delete mode 100644 static/library/android.svg delete mode 100644 static/library/bigcommerce-dark.svg delete mode 100644 static/library/bigcommerce-light.svg delete mode 100644 static/library/claude-ai.svg delete mode 100644 static/library/dub-wordmark.svg delete mode 100644 static/library/movie-web.svg delete mode 100644 static/library/search-by-algolia.svg delete mode 100644 static/library/soundcloud.svg delete mode 100644 static/library/tensorflow.svg diff --git a/static/library/android.svg b/static/library/android.svg deleted file mode 100644 index 0a5f06c..0000000 --- a/static/library/android.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/library/bigcommerce-dark.svg b/static/library/bigcommerce-dark.svg deleted file mode 100644 index 042b3ec..0000000 --- a/static/library/bigcommerce-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/static/library/bigcommerce-light.svg b/static/library/bigcommerce-light.svg deleted file mode 100644 index d270de3..0000000 --- a/static/library/bigcommerce-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/static/library/claude-ai.svg b/static/library/claude-ai.svg deleted file mode 100644 index 342d40b..0000000 --- a/static/library/claude-ai.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/library/dub-wordmark.svg b/static/library/dub-wordmark.svg deleted file mode 100644 index 3300e54..0000000 --- a/static/library/dub-wordmark.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/library/movie-web.svg b/static/library/movie-web.svg deleted file mode 100644 index f471c36..0000000 --- a/static/library/movie-web.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/static/library/search-by-algolia.svg b/static/library/search-by-algolia.svg deleted file mode 100644 index 4c4cbca..0000000 --- a/static/library/search-by-algolia.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/library/soundcloud.svg b/static/library/soundcloud.svg deleted file mode 100644 index ce40631..0000000 --- a/static/library/soundcloud.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/library/tensorflow.svg b/static/library/tensorflow.svg deleted file mode 100644 index 3f2e9b9..0000000 --- a/static/library/tensorflow.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From 488813af2c45e14c7e176bad42b1fb9f6fce135d Mon Sep 17 00:00:00 2001 From: pheralb Date: Thu, 2 Oct 2025 16:26:49 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Add=20Sanity=20SVGs?= =?UTF-8?q?=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/svgs.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/data/svgs.ts b/src/data/svgs.ts index cebc574..66e570c 100644 --- a/src/data/svgs.ts +++ b/src/data/svgs.ts @@ -4026,4 +4026,17 @@ export const svgs: iSVG[] = [ url: "https://qdrant.tech/", brandUrl: "https://qdrant.tech/brand-resources/", }, + { + title: "Sanity", + category: ["CMS", "Software"], + route: { + light: "/library/sanity-light.svg", + dark: "/library/sanity-dark.svg", + }, + wordmark: { + light: "/library/sanity-wordmark-light.svg", + dark: "/library/sanity-wordmark-dark.svg", + }, + url: "https://www.sanity.io/", + }, ]; From bd6ce410bc2f1ca1f8a7f15e42a04eb4f3e481eb Mon Sep 17 00:00:00 2001 From: pheralb Date: Thu, 2 Oct 2025 16:30:46 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Update=20CI=20workf?= =?UTF-8?q?low=20to=20check=20SVGs=20and=20add=20data=20check=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check-app.yml | 7 +++++-- package.json | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-app.yml b/.github/workflows/check-app.yml index 43f8909..0eae45c 100644 --- a/.github/workflows/check-app.yml +++ b/.github/workflows/check-app.yml @@ -28,9 +28,9 @@ jobs: env: PUBLIC_SVGL_VERSION: v5 - svgs-size: + check-svgs: runs-on: ubuntu-latest - name: šŸ“¦ SVGs Size + name: šŸ“¦ Check SVGs steps: - uses: actions/checkout@v4 @@ -42,3 +42,6 @@ jobs: - name: Check SVGs size run: pnpm check:size + + - name: Check unused SVGs + run: pnpm check:data diff --git a/package.json b/package.json index a745c3e..95a6abb 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "check:size": "tsx ./utils/check-size.ts", + "check:data": "tsx ./utils/check-data.ts", "check:links": " lychee --base . ./src/data/svgs.ts --cache --max-cache-age 3d . --include 'https://svgl.app'", "fix:viewbox": "tsx ./utils/fix-viewbox.ts", "format": "prettier --write \"src/**/*.{ts,js,md,svelte}\" --cache", From ceb5835f21cdab6a2e65bdc88db490759a522097 Mon Sep 17 00:00:00 2001 From: pheralb Date: Thu, 2 Oct 2025 16:32:31 +0100 Subject: [PATCH 4/4] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Create=20check-data=20?= =?UTF-8?q?script=20to=20detect=20unused=20SVGs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/check-data.ts | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 utils/check-data.ts diff --git a/utils/check-data.ts b/utils/check-data.ts new file mode 100644 index 0000000..005b8c1 --- /dev/null +++ b/utils/check-data.ts @@ -0,0 +1,65 @@ +import { readdir, unlink } from "fs/promises"; +import { join } from "path"; +import { readFileSync } from "fs"; + +// āš™ļø Settings: +const svgDir = join(process.cwd(), "static", "library"); +const dataFile = join(process.cwd(), "src", "data", "svgs.ts"); +const DELETE_UNUSED = false; + +async function checkUnusedSVGs(): Promise { + try { + const files = await readdir(svgDir); + const svgFiles = files.filter((file) => file.endsWith(".svg")); + const dataContent = readFileSync(dataFile, "utf-8"); + const unusedFiles: { filename: string; path: string }[] = []; + + for (const file of svgFiles) { + if (!dataContent.includes(file)) { + unusedFiles.push({ + filename: file, + path: `/library/${file}`, + }); + } + } + + if (unusedFiles.length === 0) { + console.log("āœ… All SVG files are being used in data/svgs.ts"); + } else { + console.log( + `āš ļø Found ${unusedFiles.length}/${svgFiles.length} unused SVG file(s) in /static/library:`, + ); + console.table(unusedFiles); + + if (DELETE_UNUSED) { + console.log("\nšŸ—‘ļø Deleting unused files..."); + let deletedCount = 0; + + for (const file of unusedFiles) { + try { + const filePath = join(svgDir, file.filename); + await unlink(filePath); + deletedCount++; + console.log(`- Deleted: ${file.filename}`); + } catch (error) { + console.error(`- Error: failed to delete ${file.filename}:`, error); + } + } + + console.log(`\nāœ… Successfully deleted ${deletedCount} file(s).`); + } else { + console.log( + "\nšŸ’” To delete these files, set DELETE_UNUSED = true in the script.", + ); + throw new Error( + `āŒ Error: Found ${unusedFiles.length} unused SVG file(s). Please check the list above.`, + ); + } + } + } catch (error) { + console.error("āŒ Error:", error); + throw error; + } +} + +checkUnusedSVGs();