Skip to content

Conversation

ImBIOS
Copy link
Owner

@ImBIOS ImBIOS commented Jul 5, 2025

🌙 Add Moonrepo Support

This PR implements moonrepo support for the monorepo benchmarks project, addressing the feature request in issue #18.

🔧 What's Added

Moon Configuration Files:

  • .moon/workspace.yml - Project definitions for all 5 apps and 105 packages
  • .moon/toolchain.yml - Node.js 22.9.0 and pnpm 10.10.0 configuration
  • .moon/tasks/node.yml - Build tasks for Next.js projects with proper caching

Benchmark Integration:

  • Updated benchmark-json.ts with moonrepo benchmarking (warm-up + execution phases)
  • Added moon comparison ratios (nxVsMoon)
  • Updated TypeScript types to include moon as a ToolName

Scripts & Tooling Updates:

  • scripts/compare-and-update-readme.ts - Handles moonrepo results formatting
  • scripts/create-release.ts - Includes moonrepo version info in releases
  • scripts/types.ts - Updated interfaces for moon support

Documentation:

  • Updated README.md title: "Benchmarking Nx, Turbo, Lerna, Lage, and Moon"
  • Added dedicated "About Moon" section with feature overview
  • Updated benchmark results section with moonrepo placeholders
  • Updated dependency management references

Dependencies:

  • Added @moonrepo/cli as devDependency in package.json

🚀 About Moon

Moon is a Rust-based build system and monorepo management tool that focuses on performance and developer experience. Key features include:

  • Performance: Written in Rust for maximum speed and efficiency
  • Smart Caching: Advanced caching mechanisms with remote caching support
  • Task Pipeline: Efficient task orchestration with dependency management
  • Language Support: Multi-language support including Node.js, Python, Rust, and more
  • Configuration: YAML-based configuration with intelligent defaults
  • Incremental Building: Only builds what's changed for faster development cycles

📊 Testing

The implementation includes:

  • Proper warm-up phases for fair benchmarking
  • Concurrency configuration matching other tools
  • Cache restoration performance testing
  • Integration with existing benchmark infrastructure

🔄 How to Test

# Install moonrepo CLI
pnpm install

# Run benchmarks
pnpm run benchmark

Closes #18

📸 Files Changed

  • .moon/workspace.yml (new)
  • .moon/toolchain.yml (new)
  • .moon/tasks/node.yml (new)
  • benchmark-json.ts (modified)
  • scripts/types.ts (modified)
  • package.json (modified)
  • README.md (modified)
  • scripts/compare-and-update-readme.ts (modified)
  • scripts/create-release.ts (modified)

- Add moonrepo configuration files (.moon/workspace.yml, .moon/toolchain.yml, .moon/tasks/node.yml)
- Update benchmark-json.ts to include moonrepo benchmarking
- Update TypeScript types to include moon tool
- Add moonrepo as devDependency in package.json
- Update README.md to include moonrepo in benchmarks
- Update comparison scripts to handle moonrepo results
- Update release scripts to include moonrepo version info

Closes #18
Copy link

changeset-bot bot commented Jul 5, 2025

⚠️ No Changeset found

Latest commit: c600e3d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ImBIOS
Copy link
Owner Author

ImBIOS commented Jul 5, 2025

🧪 COMPREHENSIVE TESTING RESULTS

I've thoroughly tested the moonrepo integration and can confirm everything is working correctly. Here are the detailed test results:

Moon CLI Installation & Detection

$ ./node_modules/.bin/moon --version
moon 1.38.3

$ ./node_modules/.bin/moon query projects
# ✅ Correctly detects only 5 Next.js apps (not 110+ packages)

Individual App Build Test

$ ./node_modules/.bin/moon run crew:build
# ✅ Completed successfully in 2.127s (with Next.js cache)

Multi-Project Build Test

$ ./node_modules/.bin/moon run :build --concurrency=3
# ✅ Built all 5 Next.js apps in 4m 33s
# Apps: crew, flight-simulator, navigation, ticket-booking, warp-drive-manager

Existing Tools Compatibility

$ pnpm exec turbo run build --filter=crew  
# ✅ Still works perfectly (3.432s with cache)

Configuration Fixes Applied

  1. Fixed workspace conflict: Removed library packages from Moon workspace to prevent "duplicate project ID" errors
  2. Optimized for benchmarking: Moon now only builds the 5 Next.js apps (same as other tools)
  3. Task inheritance: Apps correctly use Next.js build tasks from .moon/tasks/app.yml

Enhanced Benchmark Script

Added comprehensive progress logging to benchmark-json.ts:

  • Real-time progress tracking for each tool (1/5, 2/5, etc.)
  • Individual run timing (Run 1/10, Run 2/10, etc.)
  • Prep phase feedback with timing
  • Final rankings and performance comparisons
  • Beautiful visual separators and status indicators

Example output:

============================================================
  BENCHMARKING MOON
============================================================
----------------------------------------
  Preparation Phase  
----------------------------------------
Running 1 prep command(s)...
  Prep 1/1: moon run :build --concurrency=3
  ✓ Completed in 2.856s

----------------------------------------
  Benchmark Phase
----------------------------------------
Running 10 benchmark runs...
Command: moon run :build --concurrency=10

  Run 1/10: ✓ 4.967s
  Run 2/10: ✓ 8.440s
  ...

📊 MOON RESULTS:
  Average: 6.703s
  Total: 67.030s
  Min: 4.967s
  Max: 8.440s
  Range: 3.473s

📋 Test Summary

Component Status Details
Moon CLI ✅ Working v1.38.3 installed correctly
Project Detection ✅ Working 5 Next.js apps detected
Build Tasks ✅ Working All apps build successfully
Benchmark Integration ✅ Working Commands execute correctly
Progress Logging ✅ Enhanced Comprehensive real-time feedback
Other Tools ✅ Compatible Turbo/Nx/Lerna/Lage unaffected

🚀 Ready for Production

The moonrepo integration is fully functional and ready for benchmarking. The enhanced progress logging will provide excellent visibility during the full benchmark runs (50+ builds total).

No breaking changes - all existing functionality preserved while adding Moon support.

- Add new entries to .gitignore for moon executables and lerna logs
- Update .prettierignore to include .nx/cache
- Enable caching in nx.json build configuration
- Set package manager to pnpm@10.10.0 and node engine to 22.9.0 in package.json
- Update pnpm workspace to include '@moonrepo/cli' and 'sharp' as built dependencies
- Change main and types paths in multiple package.json files from './index.ts' to './src/index.ts'
- Remove unused readme assets (turbo-nx-perf.gif, turbo-nx-terminal.gif)
- Update TypeScript types in scripts/types.ts to include comparisons field
@ImBIOS ImBIOS requested a review from Copilot July 19, 2025 11:42
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements comprehensive moonrepo support for the monorepo benchmarks project, extending the benchmarking suite to include a fifth tool alongside Nx, Turbo, Lerna, and Lage. The implementation includes moon configuration files, benchmark integration with proper error handling, and updates to all supporting scripts and documentation.

  • Adds Moon (moonrepo) as the fifth benchmarking tool with specialized Rust-based build system features
  • Updates TypeScript interfaces and scripts to support moon throughout the benchmark infrastructure
  • Modernizes Next.js configuration across all apps by replacing deprecated next-transpile-modules with transpilePackages

Reviewed Changes

Copilot reviewed 136 out of 145 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/types.ts Adds moon to ToolName union and updates interfaces for moon support
scripts/create-release.ts Integrates moon version tracking and results formatting in release generation
scripts/compare-and-update-readme.ts Updates benchmark result formatting to include moon performance metrics
benchmark-json.ts Major enhancement with moon benchmarking, improved logging, and specialized lerna error handling
package.json Adds @moonrepo/cli dependency and updates project metadata
README.md Updates documentation to include moon information and benchmark comparisons
.moon/ config files New moon workspace, toolchain, and task configuration files
apps/*/next.config.js Modernizes Next.js transpile configuration across all applications

ImBIOS added 2 commits July 19, 2025 18:47
- Resolved package.json conflicts by keeping moonrepo additions and updating @types/node
- Regenerated pnpm-lock.yaml to resolve lockfile conflicts
- Introduced Nx-specific environment variables to ensure consistent benchmarking across runs.
- Refactored command execution to include a fallback mechanism for handling SQLite failures during benchmarks.
- Updated documentation in the README to clarify benchmarking instructions.
@ImBIOS ImBIOS merged commit 72e4fd0 into main Jul 19, 2025
1 of 2 checks passed
@ImBIOS ImBIOS deleted the feat/add-moonrepo-support branch July 19, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT]: Add moonrepo support
1 participant