Skip to content

Nx Project.json Cleanup Plan

Date: October 12, 2025
Branch: feat/nx-integration
Status: Ready for Execution

We have 11 ui-* packages with redundant project.json files that only define lint and typecheck targets. These targets are automatically provided by Nx plugins:

  • lint → Provided by @nx/eslint/plugin
  • typecheck → Inferred from package.json scripts by nx:run-script executor

Verified safe to remove:

  1. Removed packages/ui-stay-match/project.json (test case)
  2. Nx still detected the package
  3. Both targets worked identically:
    • yarn nx run ui-stay-match:lint → ✅ Success
    • yarn nx run ui-stay-match:typecheck → ✅ Success
  4. Targets were automatically inferred by plugins

The following 11 packages have redundant project.json files:

packages/ui-altfinder/project.json - Only lint, typecheck
packages/ui-bonjour-services/project.json - Only lint, typecheck
packages/ui-greenhost/project.json - Only lint, typecheck
packages/ui-guestroom/project.json - Only lint, typecheck
packages/ui-homestay/project.json - Only lint, typecheck
packages/ui-hostguest/project.json - Only lint, typecheck
packages/ui-pride-city/project.json - Only lint, typecheck
packages/ui-room-lgbt/project.json - Only lint, typecheck
packages/ui-roommate/project.json - Only lint, typecheck
packages/ui-stay-match/project.json - Only lint, typecheck
packages/ui-web/project.json - Only lint, typecheck
packages/ui/project.json - Only lint, typecheck (check first)

The following packages MUST keep their project.json files:

  • packages/design-tokens/ - Uses Style Dictionary (not standard build)
  • packages/storybook/ - Uses @nx/storybook:storybook executor
  • packages/brands/ - Custom workspace build command
  • packages/common/ - Custom workspace build command
  • ✅ All apps/*/mobile/project.json - Have empty targets: {} (already DRY!)
  • ✅ All apps/*/web/project.json - Have empty targets: {} (already DRY!)

Script created: scripts/remove-redundant-project-jsons.sh

What it does:

  1. Backs up all project.json files to timestamped directory
  2. Tests lint/typecheck BEFORE removal
  3. Removes redundant project.json files
  4. Tests lint/typecheck AFTER removal
  5. Verifies Nx graph still works
  6. Automatically restores if ANY test fails

How to run:

Terminal window
./scripts/remove-redundant-project-jsons.sh

After removal, run comprehensive tests:

Terminal window
# Test all packages can be linted
yarn nx run-many --target=lint --all
# Test all packages with typecheck
yarn nx affected --target=typecheck --all
# Verify Nx graph
yarn nx graph
# Check project detection
yarn nx show projects | wc -l # Should still be 86 projects

If all tests pass:

Terminal window
git add .
git commit -m "refactor(nx): Remove redundant project.json files
Removed project.json files from 11 ui-* packages that only contained
lint and typecheck targets. These targets are automatically inferred
by Nx plugins (@nx/eslint/plugin and nx:run-script).
Benefits:
- Follows DRY principle (Don't Repeat Yourself)
- Reduces maintenance burden (no need to update 11 files)
- Leverages Nx plugin inference system properly
- Aligns with Nx best practices documented in ADR-001
Packages affected:
- ui-altfinder
- ui-bonjour-services
- ui-greenhost
- ui-guestroom
- ui-homestay
- ui-hostguest
- ui-pride-city
- ui-room-lgbt
- ui-roommate
- ui-stay-match
- ui-web
- ui
Kept project.json for packages with custom configuration:
- design-tokens (Style Dictionary)
- storybook (@nx/storybook executor)
- brands (custom build)
- common (custom build)
Tested:
✅ All lint targets work
✅ All typecheck targets work
✅ Nx graph generates correctly
✅ All 86 projects still detected
Refs: ADR-001, #nx-integration"

If something breaks:

Terminal window
# Automatic rollback (script does this automatically)
# Or manual restoration:
BACKUP_DIR="/tmp/nx-project-json-backups-YYYYMMDD-HHMMSS"
cp $BACKUP_DIR/*.json packages/
# Or git revert:
git revert HEAD
  1. DRY Compliance: No redundant configuration across 11 files
  2. Easier Maintenance: Changes to lint/typecheck happen in one place (nx.json plugins)
  3. Nx Best Practices: Leverages plugin inference system as intended
  4. Future-Proof: New ui-* packages won’t need project.json
  5. Cleaner Codebase: Less configuration files to maintain
RiskProbabilityImpactMitigation
Targets stop workingLowHighAutomated testing + instant rollback
Nx graph breaksVery LowMediumGraph validation in script
CI/CD breaksLowHighTest locally first, rollback on failure
Developer confusionLowLowDocumentation in ADR-001
  • ✅ All lint targets work across all 11 packages
  • ✅ All typecheck targets work across all 11 packages
  • ✅ Nx graph generates without errors
  • ✅ All 86 projects still detected by Nx
  • ✅ No build failures in affected packages
  • ✅ Documentation updated (ADR, guides)
  • Script Creation: ✅ Complete
  • Execution: Ready (awaiting approval)
  • Validation: ~5 minutes
  • Commit: ~1 minute
  • Total Time: ~10 minutes
  • Script reviewed and tested
  • User approval to proceed with execution
  • Backup strategy confirmed
  • Rollback plan understood
  • docs/architecture/ADR-001-nx-plugin-inference.md - Architectural decision
  • docs/nx-integration-guide.md - Comprehensive Nx guide
  • scripts/remove-redundant-project-jsons.sh - Automated removal script

Ready to execute when you give the green light! 🚀