#!/usr/bin/env pwsh # Import shared configuration . "$PSScriptRoot/symlink-config.ps1" # Get configuration from shared module $packageDirectories = Get-PackageDirectories function Remove-Symlinks { Write-Host "šŸ—‘ļø Removing symlinks from library directories...`n" -ForegroundColor Cyan $totalRemoved = 0 $totalSkipped = 0 foreach ($packageDir in $packageDirectories) { $resolvedPath = Resolve-Path $packageDir -ErrorAction SilentlyContinue $targetNodeModules = Join-Path $resolvedPath "node_modules" if (-not $targetNodeModules) { Write-Host "āš ļø Skipping $packageDir (directory not found)" -ForegroundColor Yellow $totalSkipped++ continue } Write-Host "šŸ“ Processing $packageDir..." -ForegroundColor Cyan if (-not (Test-Path $targetNodeModules)) { Write-Host " āš ļø No node_modules directory found" -ForegroundColor Yellow $totalSkipped++ continue } try { # Remove the entire node_modules directory (which contains symlinks) Remove-Item $targetNodeModules -Recurse -Force Write-Host " āœ… Removed node_modules directory" -ForegroundColor Green $totalRemoved++ } catch { Write-Host " āŒ Failed to remove $targetNodeModules`: $($_.Exception.Message)" -ForegroundColor Red $totalSkipped++ } } Write-Host "`nšŸŽ‰ Cleanup completed! Removed: $totalRemoved, Skipped: $totalSkipped" -ForegroundColor Green Write-Host "šŸ’” Libraries will now use their own local dependencies (if any)" -ForegroundColor Cyan } # Run the cleanup Remove-Symlinks