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",
diff --git a/src/data/svgs.ts b/src/data/svgs.ts
index 30ab3c4..51703ed 100644
--- a/src/data/svgs.ts
+++ b/src/data/svgs.ts
@@ -4040,4 +4040,17 @@ export const svgs: iSVG[] = [
url: "https://www.travelperk.com/",
brandUrl: "https://www.travelperk.com/media/",
},
+ {
+ 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/",
+ },
];
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
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();