-
Notifications
You must be signed in to change notification settings - Fork 110
Refactor Node.js package installers from lifecycle hooks to ExecutableResource #736
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
…proach Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
…usion Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
…stallers Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copilot finished work on behalf of
aaronpowell
June 17, 2025 04:26
…ove obsolete tests
Minimum allowed line rate is |
This was referenced Aug 5, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the Node.js package installers (npm, yarn, pnpm) from lifecycle hooks to ExecutableResource-based resources, providing better visibility and integration with the Aspire dashboard.
What Changed
Before
BeforeStartAsync
Process.Start
After
ExecutableResource
instances that inherit fromExecutableResource
WaitAnnotation
ensure proper startup orderingNew Architecture
Created three new resource classes:
NpmInstallerResource
- Supports bothnpm install
andnpm ci
commandsYarnInstallerResource
- Executesyarn install
commandPnpmInstallerResource
- Executespnpm install
commandEach installer resource:
ResourceRelationshipAnnotation
to establish parent-child relationshipsWaitAnnotation
API Compatibility
No breaking changes - existing APIs work exactly the same:
Benefits
Backward Compatibility
Legacy lifecycle hook classes are marked as
[Obsolete]
but remain functional:NpmPackageInstallerLifecycleHook
YarnPackageInstallerLifecycleHook
PnpmPackageInstallerLifecycleHook
NodePackageInstaller
These will be removed in a future version.
Testing
Added comprehensive test coverage including:
Fixes #732.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
aka.ms
curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED
(dns block)cflvsblobprodcus383.vsblob.vsassets.io
dotnet restore --ignore-failed-sources
(dns block)dnceng.pkgs.visualstudio.com
dotnet build src/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions.csproj
(dns block)dotnet test tests/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions.Tests/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions.Tests.csproj --no-restore --verbosity minimal
(dns block)dotnet restore --ignore-failed-sources
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.