#!/usr/bin/env node const fs = require('fs'); const path = require('path'); const filePath = path.join(__dirname, '../frontend/components/Profile/ProfileSettings.tsx'); let content = fs.readFileSync(filePath, 'utf8'); // Step 1: Add imports after the existing imports const importToAdd = `import { getTimezonesByRegion, getRegionDisplayName, } from '../../utils/timezoneUtils';`; // Find the last import statement before interfaces const lastImportMatch = content.match(/(import.*from.*';[\r\n]+)(\r\n)(interface)/); if (lastImportMatch) { content = content.replace( lastImportMatch[0], `${lastImportMatch[1]}${importToAdd}\n${lastImportMatch[2]}${lastImportMatch[3]}` ); } // Step 2: Add useMemo after const [activeTab... const useMemoToAdd = ` // Generate timezone list using date-fns-tz and Intl API const timezonesByRegion = React.useMemo(() => { return getTimezonesByRegion(); }, []); `; content = content.replace( /(const \[activeTab, setActiveTab\] = useState\('general'\);)/, `$1${useMemoToAdd}` ); // Step 3: Replace the entire hardcoded timezone section // Find the start: followed by {/* Americas */} // Find the end: last before const timezoneReplacement = ` {/* Dynamically generated timezone list */} {Object.keys(timezonesByRegion) .sort() .map((region) => ( {timezonesByRegion[region].map( (tz) => ( ) )} ))}`; // Match from to the last before const timezonePattern = /(