ROLLBACK MULTI MONOREPO

Documentation for Developers

🔄 Rollback Guide: Multi-Monorepo Configuration

This guide provides exact steps to completely revert all multi-monorepo optimizations.

⚠️ Before You Start

Backup your current configuration (recommended):

# Create backups
cp ~/.zshrc ~/.zshrc.backup.$(date +%Y%m%d-%H%M%S)
cp /Users/fguijarro/developer/repos/editor/.vscode/settings.json /Users/fguijarro/developer/repos/editor/.vscode/settings.json.backup
cp /Users/fguijarro/developer/repos/editor/nx.json /Users/fguijarro/developer/repos/editor/nx.json.backup

📋 Complete Rollback Checklist


🔧 Step-by-Step Rollback Instructions

Step 1: Remove Shell Configuration from ~/.zshrc

Option A: Manual Removal (Recommended)

  1. Open your ~/.zshrc file:

    nano ~/.zshrc
    # or
    code ~/.zshrc
    
  2. Find and delete these exact lines (they should be at the end):

    ########################################################################
    # Multi-Monorepo Node.js Configuration for Powerful Machines
    # Add this to your ~/.zshrc file for permanent effect
    ########################################################################
    
    # Node.js performance settings for multiple monorepos
    export NODE_OPTIONS="--max-old-space-size=8192 --max-http-header-size=32768"
    export UV_THREADPOOL_SIZE=128
    export NODE_NO_WARNINGS=1
    
    # Optional: Aliases for quick monorepo management
    alias nx-reset-all='(cd ~/developer/repos/editor && yarn nx reset) && (cd ~/developer/repos/editor2 && yarn nx reset) && (cd ~/developer/repos/gograb-space && yarn nx reset)'
    alias monorepo-status='ps aux | grep "nx.*daemon\|nxls" | grep -v grep'
    alias monorepo-clean='pkill -f "nx/src/daemon" && echo "All Nx daemons stopped. Run nx-reset-all to restart."'
    
    echo "✅ Multi-monorepo Node.js configuration loaded"
    
    ########################################################################
    # After adding to ~/.zshrc, run: source ~/.zshrc
    ########################################################################
    
  3. Save and reload:

    source ~/.zshrc
    

Option B: Automated Removal (Use with caution)

# Create a backup first
cp ~/.zshrc ~/.zshrc.backup.$(date +%Y%m%d-%H%M%S)

# Remove the multi-monorepo configuration block
# This removes everything between the "Multi-Monorepo Node.js Configuration" markers
sed -i.bak '/########################################################################/,/########################################################################/d' ~/.zshrc

# Reload shell
source ~/.zshrc

Verify removal:

echo "NODE_OPTIONS: $NODE_OPTIONS"
echo "UV_THREADPOOL_SIZE: $UV_THREADPOOL_SIZE"
# Should output empty or your previous values

Step 2: Revert .vscode/settings.json (All 3 Monorepos)

For each monorepo (editor, editor2, gograb-space), replace the settings.json with the original version:

Original settings.json content:

{
  "typescript.preferences.includePackageJsonAutoImports": "updateImportsOnFileMove.enabled",
  "typescript.suggest.autoImports": false,
  "typescript.updateImportsOnFileMove.enabled": "never",
  "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/**": true,
    "**/.nx/cache/**": true,
    "**/.angular/cache/**": true,
    "**/coverage/**": true
  },
  "search.exclude": {
    "**/node_modules": true,
    "**/.nx/cache": true,
    "**/.angular/cache": true,
    "**/coverage": true
  },
  "files.exclude": {
    "**/.nx/cache": true,
    "**/.angular/cache": true
  }
}

Commands to revert:

# Editor monorepo
cat > /Users/fguijarro/developer/repos/editor/.vscode/settings.json << 'EOF'
{
  "typescript.preferences.includePackageJsonAutoImports": "updateImportsOnFileMove.enabled",
  "typescript.suggest.autoImports": false,
  "typescript.updateImportsOnFileMove.enabled": "never",
  "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/**": true,
    "**/.nx/cache/**": true,
    "**/.angular/cache/**": true,
    "**/coverage/**": true
  },
  "search.exclude": {
    "**/node_modules": true,
    "**/.nx/cache": true,
    "**/.angular/cache": true,
    "**/coverage": true
  },
  "files.exclude": {
    "**/.nx/cache": true,
    "**/.angular/cache": true
  }
}
EOF

# Editor2 monorepo
cat > /Users/fguijarro/developer/repos/editor2/.vscode/settings.json << 'EOF'
{
  "typescript.preferences.includePackageJsonAutoImports": "updateImportsOnFileMove.enabled",
  "typescript.suggest.autoImports": false,
  "typescript.updateImportsOnFileMove.enabled": "never",
  "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/**": true,
    "**/.nx/cache/**": true,
    "**/.angular/cache/**": true,
    "**/coverage/**": true
  },
  "search.exclude": {
    "**/node_modules": true,
    "**/.nx/cache": true,
    "**/.angular/cache": true,
    "**/coverage": true
  },
  "files.exclude": {
    "**/.nx/cache": true,
    "**/.angular/cache": true
  }
}
EOF

# Gograb-space monorepo
cat > /Users/fguijarro/developer/repos/gograb-space/.vscode/settings.json << 'EOF'
{
  "typescript.preferences.includePackageJsonAutoImports": "updateImportsOnFileMove.enabled",
  "typescript.suggest.autoImports": false,
  "typescript.updateImportsOnFileMove.enabled": "never",
  "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/**": true,
    "**/.nx/cache/**": true,
    "**/.angular/cache/**": true,
    "**/coverage/**": true
  },
  "search.exclude": {
    "**/node_modules": true,
    "**/.nx/cache": true,
    "**/.angular/cache": true,
    "**/coverage": true
  },
  "files.exclude": {
    "**/.nx/cache": true,
    "**/.angular/cache": true
  }
}
EOF

Step 3: Revert nx.json Configuration

Only for the editor monorepo (if editor2 and gograb-space have nx.json, adjust accordingly):

Find this section in /Users/fguijarro/developer/repos/editor/nx.json:

Current (modified) version:

"tasksRunnerOptions": {
  "default": {
    "options": {
      "captureStderr": false,
      "captureStdout": false,
      "terminalOutputs": false,
      "maxParallel": 3,
      "maxMemory": 16000,
      "cacheDirectory": ".nx/cache",
      "enableRemoteCache": false,
      "useDaemonProcess": true,
      "daemonMaxConcurrency": 6
    }
  }
},

Original version to restore:

"tasksRunnerOptions": {
  "default": {
    "options": {
      "captureStderr": false,
      "captureStdout": false,
      "terminalOutputs": false,
      "maxParallel": 1,
      "maxMemory": 12000,
      "cacheDirectory": ".nx/cache",
      "enableRemoteCache": false
    }
  }
},

Manual edit:

# Open the file
code /Users/fguijarro/developer/repos/editor/nx.json

# Or use nano
nano /Users/fguijarro/developer/repos/editor/nx.json

Change these specific values:


Step 4: Remove package.json Script Entries

Only for editor monorepo:

Edit /Users/fguijarro/developer/repos/editor/package.json and remove these lines:

Remove:

"fix:max-listeners": "node scripts/configure-multi-monorepo.js",
"configure:multi-monorepo": "node scripts/configure-multi-monorepo.js",
"verify:multi-monorepo": "node scripts/verify-multi-monorepo-setup.js",

Restore original:

"fix:max-listeners": "node -e \"process.setMaxListeners(0); console.log('Max listeners set to unlimited');\"",

Quick command to verify:

grep -n "multi-monorepo\|verify:multi-monorepo" /Users/fguijarro/developer/repos/editor/package.json
# Should return nothing after removal

Step 5: Remove Created Files and Scripts

Delete all files created during the multi-monorepo setup:

# From editor monorepo
cd /Users/fguijarro/developer/repos/editor

rm -f MULTI-MONOREPO-SETUP.md
rm -f SETUP-COMPLETE.md
rm -f ADD_TO_ZSHRC.txt
rm -f ROLLBACK-MULTI-MONOREPO.md
rm -f .cursorrules
rm -f .nvmrc.env
rm -f scripts/configure-multi-monorepo.js
rm -f scripts/verify-multi-monorepo-setup.js

# From editor2 monorepo
cd /Users/fguijarro/developer/repos/editor2

rm -f MULTI-MONOREPO-SETUP.md
rm -f SETUP-COMPLETE.md
rm -f ADD_TO_ZSHRC.txt
rm -f scripts/configure-multi-monorepo.js
rm -f scripts/verify-multi-monorepo-setup.js

# From gograb-space monorepo
cd /Users/fguijarro/developer/repos/gograb-space

rm -f MULTI-MONOREPO-SETUP.md
rm -f SETUP-COMPLETE.md
rm -f ADD_TO_ZSHRC.txt
rm -f scripts/configure-multi-monorepo.js
rm -f scripts/verify-multi-monorepo-setup.js

Verify deletion:

ls -la ~/developer/repos/editor/ | grep -E "MULTI-MONOREPO|SETUP-COMPLETE|ADD_TO_ZSHRC|ROLLBACK"
ls -la ~/developer/repos/editor/scripts/ | grep -E "configure-multi-monorepo|verify-multi-monorepo"
# Should return nothing

Step 6: Reset Nx Daemons

Clean restart all Nx daemons:

# Stop all running Nx daemons
pkill -f "nx/src/daemon"

# Reset Nx cache in all monorepos
cd /Users/fguijarro/developer/repos/editor && yarn nx reset
cd /Users/fguijarro/developer/repos/editor2 && yarn nx reset
cd /Users/fguijarro/developer/repos/gograb-space && yarn nx reset

Step 7: Restart Cursor

Complete the rollback:

  1. Completely quit Cursor (⌘ + Q or File → Quit)
  2. Wait 10 seconds for all processes to stop
  3. Reopen Cursor
  4. Open any of your monorepos
  5. All original settings should be restored

✅ Verification After Rollback

Run these commands to verify the rollback was successful:

# 1. Check environment variables (should be empty or your old values)
echo "NODE_OPTIONS: '$NODE_OPTIONS'"
echo "UV_THREADPOOL_SIZE: '$UV_THREADPOOL_SIZE'"

# 2. Check if aliases were removed
type nx-reset-all 2>/dev/null && echo "❌ Alias still exists" || echo "✅ Alias removed"
type monorepo-status 2>/dev/null && echo "❌ Alias still exists" || echo "✅ Alias removed"

# 3. Check if files were removed
ls /Users/fguijarro/developer/repos/editor/MULTI-MONOREPO-SETUP.md 2>/dev/null && echo "❌ File still exists" || echo "✅ File removed"

# 4. Check TypeScript memory setting (should not show 8192)
cat /Users/fguijarro/developer/repos/editor/.vscode/settings.json | grep "tsserver.maxTsServerMemory" && echo "❌ Still configured" || echo "✅ Setting removed"

# 5. Check Nx max parallel (should be 1, not 3)
cat /Users/fguijarro/developer/repos/editor/nx.json | grep '"maxParallel"' | grep -o '[0-9]'
# Should output: 1

📊 Expected State After Rollback

Environment Variables

VSCode/Cursor Settings

Nx Configuration

Files

All multi-monorepo documentation and scripts removed


🆘 Troubleshooting Rollback Issues

Issue: Environment variables still showing after rollback

Solution:

# Restart your terminal completely
# Or force unset
unset NODE_OPTIONS
unset UV_THREADPOOL_SIZE
unset NODE_NO_WARNINGS

# Add to ~/.zshrc temporarily if needed:
unset NODE_OPTIONS
unset UV_THREADPOOL_SIZE
unset NODE_NO_WARNINGS

Issue: Cursor still shows optimized settings

Solution:

# Clear Cursor's cache
rm -rf ~/Library/Application\ Support/Cursor/User/globalStorage
rm -rf ~/Library/Application\ Support/Cursor/CachedExtensionVSIXs

# Restart Cursor completely

Issue: Nx daemon still using high resources

Solution:

# Force kill all Node processes (CAUTION!)
pkill -9 -f "nx/src/daemon"
pkill -9 -f "nxls"

# Reset again
cd /Users/fguijarro/developer/repos/editor && yarn nx reset

Issue: Can't find original settings

Solution: If you created backups, restore them:

# Find your backup
ls -la ~/.zshrc.backup.*

# Restore (replace TIMESTAMP with your backup timestamp)
cp ~/.zshrc.backup.TIMESTAMP ~/.zshrc

# Or restore from git if tracked
cd /Users/fguijarro/developer/repos/editor
git checkout .vscode/settings.json
git checkout nx.json
git checkout package.json

📝 Manual Verification Checklist

After completing all steps, manually verify:


🔄 Re-applying Configuration

If you want to re-apply the multi-monorepo configuration after rollback:

# You'll need to re-run the original setup
# (The configuration files were deleted during rollback)

Last Updated: October 18, 2025
Rollback Tested: All steps verified safe to execute