Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 5, 2025

  • Add frontend monorepo support for Nx and Turborepo
  • Implement shared package installers to prevent race conditions
  • Add comprehensive tests for monorepo functionality
  • Create MONOREPO.md documentation with usage examples
  • Update README.md with monorepo support section
  • Document RunWithPackageManager method for configuring package manager commands
  • Add examples showing auto-inference vs explicit package manager specification
  • Explain difference between package installation and app execution commands

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits August 6, 2025 00:11
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve support for Frontend monorepos Add frontend monorepo support for Nx and Turborepo Aug 6, 2025
Copilot AI requested a review from aaronpowell August 6, 2025 00:20
Copilot finished work on behalf of aaronpowell August 6, 2025 00:20
turbobot-temp and others added 4 commits August 7, 2025 04:48
- Adding some annotations to know more about how resources are connected
- Making TurboApp and NxApp inherit from NodeApp so they can be used through extension methods better
- New method to map the port cli arg through
- Test coverage
@aaronpowell aaronpowell marked this pull request as ready for review August 7, 2025 06:16
Copilot AI review requested due to automatic review settings August 7, 2025 06:16
Copy link
Contributor

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 adds frontend monorepo support for Nx and Turborepo to prevent package installation race conditions when multiple applications share the same workspace directory. The implementation introduces dedicated monorepo resources and extension methods that create shared package installers, ensuring proper startup ordering without manual dependency management.

Key changes:

  • New Resource Types: Added NxResource, NxAppResource, TurborepoResource, and TurborepoAppResource to represent monorepo workspaces and individual apps
  • Shared Package Installers: Extended package installer methods to work with monorepo resources, preventing race conditions through single shared installers per workspace
  • Enhanced Extension Methods: Added AddNxApp, AddTurborepoApp, and related methods with automatic dependency management

Reviewed Changes

Copilot reviewed 58 out of 80 changed files in this pull request and generated no comments.

Show a summary per file
File Description
NodeJSHostingExtensions.cs Split into partial class with new monorepo extension methods and port mapping utilities
NodeJSHostingExtensions.PackageInstallers.cs Moved and enhanced package installer methods with monorepo support
Resource classes (NxResource.cs, etc.) New resource types representing monorepo workspaces and applications
Annotation classes Added package manager and installer tracking annotations
Test files Comprehensive test coverage for monorepo functionality and enhanced package installation tests
Documentation files Added detailed monorepo documentation and updated README
Example files Complete Turborepo demo workspace with multiple apps and packages
Lifecycle hook files Removed obsolete lifecycle hook classes
Comments suppressed due to low confidence (4)

src/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions/NodeJSHostingExtensions.PackageInstallers.cs:30

  • According to the .NET Aspire Community Toolkit coding guidelines, resources should follow proper annotation patterns. The installer resource should be added to the parent resource's annotations, not the installer builder itself. Consider adding the annotation to the parent resource instead.
                .WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));

src/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions/NodeJSHostingExtensions.PackageInstallers.cs:118

  • According to the .NET Aspire Community Toolkit coding guidelines, annotations should be added to the parent resource to maintain proper resource relationships. The installer annotation should be added to the workspace resource, not the installer builder.
                .WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));

src/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions/NodeJSHostingExtensions.cs:162

  • According to the .NET Aspire Community Toolkit coding guidelines, resource dependencies should be properly established. The annotation should be retrieved from the workspace resource to ensure proper dependency tracking. The current implementation may not correctly establish the dependency chain.
        if (builder.Resource.TryGetLastAnnotation<JavaScriptPackageInstallerAnnotation>(out var installerAnnotation))
        {
            rb.WaitFor(builder.ApplicationBuilder.CreateResourceBuilder(installerAnnotation.Resource));
        }

src/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions/NodeJSHostingExtensions.cs:193

  • According to the .NET Aspire Community Toolkit coding guidelines, resource dependencies should be properly established. The annotation should be retrieved from the workspace resource to ensure proper dependency tracking. The current implementation may not correctly establish the dependency chain.
        if (builder.Resource.TryGetLastAnnotation<JavaScriptPackageInstallerAnnotation>(out var installerAnnotation))
        {
            rb.WaitFor(builder.ApplicationBuilder.CreateResourceBuilder(installerAnnotation.Resource));
        }

@github-actions github-actions bot added Stale and removed Stale labels Aug 13, 2025
@aaronpowell
Copy link
Member

@copilot can you update the README for the Nodejs extensions with this new feature

Copy link
Contributor Author

Copilot AI commented Aug 28, 2025

@copilot can you update the README for the Nodejs extensions with this new feature

The README has already been updated with the new monorepo feature. It includes a dedicated "Frontend Monorepo Support" section with examples for both Nx and Turborepo, plus a reference to the detailed MONOREPO.md documentation that covers all aspects of the new functionality.

Copilot finished work on behalf of aaronpowell August 28, 2025 01:07
@aaronpowell
Copy link
Member

@copilot can you document RunWithPackageManager for nx and turbo too

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 28, 2025

@copilot can you document RunWithPackageManager for nx and turbo too

I've documented the RunWithPackageManager method for both Nx and Turborepo in the README.md and MONOREPO.md files. The documentation covers:

  • How to use RunWithPackageManager() to configure which package manager command is used when running individual apps
  • Auto-inference from package installer annotations vs explicit specification
  • Command generation examples showing the difference between npm/yarn/pnpm execution
  • The distinction between package installation commands and app execution commands

The documentation is now in commit 0082be5.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dnceng.pkgs.visualstudio.com
    • Triggering command: dotnet build src/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions.csproj (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of aaronpowell August 28, 2025 01:48
@github-actions
Copy link
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
CommunityToolkit.Aspire.EventStore 100% 100% 46
CommunityToolkit.Aspire.GoFeatureFlag 100% 97% 74
CommunityToolkit.Aspire.Hosting.ActiveMQ 79% 40% 100
CommunityToolkit.Aspire.Hosting.ActiveMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.Adminer 73% 50% 20
CommunityToolkit.Aspire.Hosting.Azure.Dapr 66% 50% 832
CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis 97% 88% 36
CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder 100% 100% 22
CommunityToolkit.Aspire.Hosting.Bun 82% 71% 54
CommunityToolkit.Aspire.Hosting.Dapr 62% 51% 728
CommunityToolkit.Aspire.Hosting.DbGate 94% 50% 18
CommunityToolkit.Aspire.Hosting.Deno 84% 75% 72
CommunityToolkit.Aspire.Hosting.EventStore 94% 100% 18
CommunityToolkit.Aspire.Hosting.GoFeatureFlag 93% 50% 18
CommunityToolkit.Aspire.Hosting.Golang 87% 70% 28
CommunityToolkit.Aspire.Hosting.Java 69% 72% 120
CommunityToolkit.Aspire.Hosting.k6 58% 12% 20
CommunityToolkit.Aspire.Hosting.LavinMQ 78% 50% 18
CommunityToolkit.Aspire.Hosting.LavinMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.MailPit 91% 50% 14
CommunityToolkit.Aspire.Hosting.McpInspector 89% 54% 130
CommunityToolkit.Aspire.Hosting.Meilisearch 73% 57% 50
CommunityToolkit.Aspire.Hosting.Minio 93% 75% 48
CommunityToolkit.Aspire.Hosting.MongoDB.Extensions 96% 83% 36
CommunityToolkit.Aspire.Hosting.MySql.Extensions 100% 88% 78
CommunityToolkit.Aspire.Hosting.Ngrok 52% 35% 82
CommunityToolkit.Aspire.Hosting.NodeJS.Extensions 97% 78% 286
CommunityToolkit.Aspire.Hosting.Ollama 67% 70% 174
CommunityToolkit.Aspire.Hosting.PapercutSmtp 92% 50% 10
CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions 99% 89% 84
CommunityToolkit.Aspire.Hosting.Python.Extensions 68% 55% 90
CommunityToolkit.Aspire.Hosting.RavenDB 63% 49% 136
CommunityToolkit.Aspire.Hosting.Redis.Extensions 100% 71% 48
CommunityToolkit.Aspire.Hosting.Rust 94% 83% 16
CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects 76% 64% 154
CommunityToolkit.Aspire.Hosting.Sqlite 99% 89% 42
CommunityToolkit.Aspire.Hosting.SqlServer.Extensions 100% 87% 78
CommunityToolkit.Aspire.Hosting.SurrealDb 54% 37% 234
CommunityToolkit.Aspire.MassTransit.RabbitMQ 100% 100% 30
CommunityToolkit.Aspire.Meilisearch 97% 92% 68
CommunityToolkit.Aspire.Microsoft.Data.Sqlite 89% 85% 52
CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite 50% 50% 88
CommunityToolkit.Aspire.Minio.Client 73% 59% 88
CommunityToolkit.Aspire.OllamaSharp 74% 69% 120
CommunityToolkit.Aspire.RavenDB.Client 60% 53% 237
CommunityToolkit.Aspire.SurrealDb 79% 63% 78
Summary 73% (7724 / 10617) 60% (2408 / 4010) 4803

Minimum allowed line rate is 60%

@aaronpowell aaronpowell merged commit caa55b2 into main Aug 28, 2025
100 checks passed
@aaronpowell aaronpowell deleted the copilot/fix-772 branch August 28, 2025 04:37
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.

3 participants