From eda87a8231f6825682c4ee42694dc47560e510f6 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Thu, 2 Apr 2026 21:11:30 +0200 Subject: [PATCH] chore: remove dead migration and one-off scripts --- scripts/replace-formatters.md | 69 ---------- scripts/replace_formatters.py | 96 -------------- scripts/scrape-exercises.ts | 205 ------------------------------ scripts/update_formatter_calls.py | 73 ----------- 4 files changed, 443 deletions(-) delete mode 100644 scripts/replace-formatters.md delete mode 100644 scripts/replace_formatters.py delete mode 100644 scripts/scrape-exercises.ts delete mode 100644 scripts/update_formatter_calls.py diff --git a/scripts/replace-formatters.md b/scripts/replace-formatters.md deleted file mode 100644 index 18b5f3f..0000000 --- a/scripts/replace-formatters.md +++ /dev/null @@ -1,69 +0,0 @@ -# Formatter Replacement Progress - -## Components Completed ✅ -1. DebtBreakdown.svelte - Replaced formatCurrency function -2. EnhancedBalance.svelte - Replaced formatCurrency function (with Math.abs wrapper) - -## Remaining Files to Update - -### Components (3 files) -- [ ] PaymentModal.svelte - Has formatCurrency function -- [ ] SplitMethodSelector.svelte - Has inline .toFixed() calls -- [ ] BarChart.svelte - Has inline .toFixed() calls -- [ ] IngredientsPage.svelte - Has .toFixed() for recipe calculations - -### Cospend Pages (7 files) -- [ ] routes/cospend/+page.svelte - Has formatCurrency function -- [ ] routes/cospend/payments/+page.svelte - Has formatCurrency function -- [ ] routes/cospend/payments/view/[id]/+page.svelte - Has formatCurrency and .toFixed() -- [ ] routes/cospend/payments/add/+page.svelte - Has .toFixed() and .toLocaleString() -- [ ] routes/cospend/payments/edit/[id]/+page.svelte - Has multiple .toFixed() calls -- [ ] routes/cospend/recurring/+page.svelte - Has formatCurrency function -- [ ] routes/cospend/recurring/edit/[id]/+page.svelte - Has .toFixed() and .toLocaleString() -- [ ] routes/cospend/settle/+page.svelte - Has formatCurrency function - -## Replacement Strategy - -### Pattern 1: Identical formatCurrency functions -```typescript -// OLD -function formatCurrency(amount) { - return new Intl.NumberFormat('de-CH', { - style: 'currency', - currency: 'CHF' - }).format(amount); -} - -// NEW -import { formatCurrency } from '$lib/utils/formatters'; -// Usage: formatCurrency(amount, 'CHF', 'de-CH') -``` - -### Pattern 2: .toFixed() for currency display -```typescript -// OLD -{payment.amount.toFixed(2)} - -// NEW -import { formatNumber } from '$lib/utils/formatters'; -{formatNumber(payment.amount, 2, 'de-CH')} -``` - -### Pattern 3: .toLocaleString() for dates -```typescript -// OLD -nextDate.toLocaleString('de-CH', { weekday: 'long', ... }) - -// NEW -import { formatDateTime } from '$lib/utils/formatters'; -formatDateTime(nextDate, 'de-CH', { weekday: 'long', ... }) -``` - -### Pattern 4: Exchange rate display (4 decimals) -```typescript -// OLD -{exchangeRate.toFixed(4)} - -// NEW -{formatNumber(exchangeRate, 4, 'de-CH')} -``` diff --git a/scripts/replace_formatters.py b/scripts/replace_formatters.py deleted file mode 100644 index 01154b2..0000000 --- a/scripts/replace_formatters.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env python3 -""" -Script to replace inline formatCurrency functions with shared formatter utilities -""" - -import re -import sys - -files_to_update = [ - "/home/alex/.local/src/homepage/src/routes/cospend/+page.svelte", - "/home/alex/.local/src/homepage/src/routes/cospend/payments/+page.svelte", - "/home/alex/.local/src/homepage/src/routes/cospend/payments/view/[id]/+page.svelte", - "/home/alex/.local/src/homepage/src/routes/cospend/recurring/+page.svelte", - "/home/alex/.local/src/homepage/src/routes/cospend/settle/+page.svelte", -] - -def process_file(filepath): - print(f"Processing: {filepath}") - - try: - with open(filepath, 'r', encoding='utf-8') as f: - content = f.read() - - original_content = content - - # Check if already has the import - has_formatter_import = 'from \'$lib/utils/formatters\'' in content or 'from "$lib/utils/formatters"' in content - - # Find the