From e41f4d9f2fe04aba1cbf7e2ebc345e7f76a5782b Mon Sep 17 00:00:00 2001 From: KingKDot Date: Sat, 18 Apr 2026 21:19:05 -0500 Subject: [PATCH] not needed anymore --- .../scripts/patch-cdn-to-vendor.ts | 156 ------------------ 1 file changed, 156 deletions(-) delete mode 100644 Overlord-Server/scripts/patch-cdn-to-vendor.ts diff --git a/Overlord-Server/scripts/patch-cdn-to-vendor.ts b/Overlord-Server/scripts/patch-cdn-to-vendor.ts deleted file mode 100644 index a9c8945..0000000 --- a/Overlord-Server/scripts/patch-cdn-to-vendor.ts +++ /dev/null @@ -1,156 +0,0 @@ -/** - * Replaces CDN references in HTML files with local /vendor/ paths. - * Usage: bun run scripts/patch-cdn-to-vendor.ts - */ - -import { readdirSync, readFileSync, writeFileSync } from "fs"; -import path from "path"; - -const PUBLIC = path.resolve(import.meta.dir, "..", "public"); - -// ── Replacement patterns ─────────────────────────────────────────── - -type Replacement = [search: string | RegExp, replace: string]; - -const replacements: Replacement[] = [ - // ── Google Fonts preconnect lines (remove entirely) ── - [/\s*\s*\n/g, "\n"], - [/\s*\s*\n/g, ""], - - // ── Google Fonts Inter 400;600;700 → local fontsource ── - [ - /\s*\s*\n?/g, - `\n \n \n \n`, - ], - - // ── Google Fonts Inter 400;500;600;700 (Desktop variant) ── - [ - //g, - `\n \n `, - ], - - // ── Google Fonts Inter + JetBrains Mono (console.html) ── - [ - /\s*\s*\n?/g, - `\n \n \n \n \n \n`, - ], - - // ── Font Awesome CSS ── - [ - /\s*/g, - `\n `, - ], - // Single-line variant (Desktop) - [ - //g, - ``, - ], - - // ── Flag Icons CSS ── - [ - /\s*/g, - `\n `, - ], - - // ── anime.js ── - [ - /\s*<\/script>/g, - `\n `, - ], - - // ── msgpackr ── - [ - /<\/script>/g, - ``, - ], - - // ── highlight.js CSS ── - [ - /\s*/g, - `\n `, - ], - - // ── highlight.js core + all language scripts → single bundle ── - [ - /<\/script>\s*(?:<\/script>\s*)*/g, - ``, - ], - - // ── CodeMirror CSS ── - [ - /\s*/g, - `\n `, - ], - [ - /\s*/g, - `\n `, - ], - - // ── CodeMirror JS ── - [ - /<\/script>/g, - ``, - ], - [ - /<\/script>/g, - ``, - ], - [ - /<\/script>/g, - ``, - ], - [ - /<\/script>/g, - ``, - ], - - // ── Ace Editor ── - [ - /<\/script>/g, - ``, - ], - - // ── Chart.js ── - [ - /<\/script>/g, - ``, - ], - - // ── Leaflet CSS ── - [ - /\s*/g, - `\n `, - ], - - // ── Leaflet JS ── - [ - /<\/script>/g, - ``, - ], -]; - -// ── Apply to all HTML files ──────────────────────────────────────── - -const htmlFiles = readdirSync(PUBLIC) - .filter((f) => f.endsWith(".html")) - .map((f) => path.join(PUBLIC, f)); - -let totalChanges = 0; - -for (const file of htmlFiles) { - let content = readFileSync(file, "utf-8"); - const original = content; - - for (const [search, replace] of replacements) { - content = content.replace(search, replace); - } - - if (content !== original) { - writeFileSync(file, content, "utf-8"); - const name = path.basename(file); - console.log(` ✓ ${name}`); - totalChanges++; - } -} - -console.log(`\nPatched ${totalChanges} HTML files.`);