-
Notifications
You must be signed in to change notification settings - Fork 131
Add frontend monorepo support for Nx and Turborepo #786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
- 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
There was a problem hiding this 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, andTurborepoAppResourceto 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));
}
|
@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 can you document |
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
I've documented the
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:
If you need me to access, download, or install something from one of these locations, you can either:
|
Minimum allowed line rate is |
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.