#!/bin/bash # Script to rename Cell to Writable in packages/patterns # # This script: # 1. Replaces Cell< with Writable< (type annotations only) # 2. Adds Writable to commontools imports using perl for proper multi-line handling # # Preserves Cell.of(), Cell.equals(), Cell.for() method calls set -e PATTERNS_DIR="packages/patterns" echo "=== Step 1: Replacing Cell< with Writable< in type annotations ===" files=$(find "$PATTERNS_DIR" -type f \( -name "*.ts" -o -name "*.tsx" \) | sort) count1=0 for file in $files; do if grep -q 'Cell<' "$file"; then echo "Processing types: $file" # Only replace Cell< (type annotation) not Cell. (method call) sed -i '' 's/Cell