Rename Aspire.Hosting.NodeJs to Aspire.Hosting.JavaScript (#12681)#12687
Rename Aspire.Hosting.NodeJs to Aspire.Hosting.JavaScript (#12681)#12687davidfowl merged 1 commit intodotnet:release/13.0from
Conversation
* Rename Aspire.Hosting.NodeJs to Aspire.Hosting.JavaScript This makes the library consistent to use language naming, and not a single technology. It allows for more JS features in the future that aren't tied to Node.js. Since the library is being renamed, I also removed the Obsolete APIs since there is no reason to ship them in the new library. Contributes to dotnet#12058 * Fix build * Fix Helix tests
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12687Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12687" |
| /// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns> | ||
| [Obsolete("Use AddNodeApp that takes an appDirectory and relative scriptPath instead.")] | ||
| [EditorBrowsable(EditorBrowsableState.Never)] | ||
| public static IResourceBuilder<NodeAppResource> AddNodeApp(this IDistributedApplicationBuilder builder, [ResourceName] string name, string scriptPath, string? workingDirectory = null, string[]? args = null) |
There was a problem hiding this comment.
Where these just missed in the pass of things to remove after them being obsoleted?
There was a problem hiding this comment.
They weren't missed. Previously we Obsoleted these 2 methods because we were keeping the same library, so we didn't want to make a binary breaking change.
But since we decided to rename the library and the namespace, it made no sense to keep the methods as new signatures in a new library, but Obsolete.
There was a problem hiding this comment.
Pull Request Overview
This PR renames the Aspire.Hosting.NodeJs package to Aspire.Hosting.JavaScript and updates all references throughout the codebase. The renaming better reflects the package's broader support for JavaScript applications beyond just Node.js, including support for npm-based applications and Vite apps.
Key changes:
- Package renamed from
Aspire.Hosting.NodeJstoAspire.Hosting.JavaScript - All namespaces updated from
Aspire.Hosting.NodeJstoAspire.Hosting.JavaScript - Obsolete
AddNpmAppAPI replaced withAddJavaScriptAppthroughout tests - Default script name for
AddJavaScriptAppchanged from "start" to "dev"
Reviewed Changes
Copilot reviewed 34 out of 35 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Shared/RepoTesting/Directory.Packages.Helix.props | Updated package reference from Aspire.Hosting.NodeJs to Aspire.Hosting.JavaScript |
| tests/Aspire.Playground.Tests/Infrastructure/DistributedApplicationExtensions.cs | Added using statement for new namespace |
| tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj | Updated package reference |
| tests/Aspire.Hosting.Tests/PublishAsDockerfileTests.cs | Replaced AddNpmApp calls with AddJavaScriptApp |
| tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj | Updated project reference |
| tests/Aspire.Hosting.JavaScript.Tests/*.cs | Updated namespace declarations from NodeJs.Tests to JavaScript.Tests |
| tests/Aspire.Hosting.JavaScript.Tests/NodeJsPublicApiTests.cs | Removed [Obsolete] attributes and updated test method names |
| tests/Aspire.Hosting.JavaScript.Tests/NodeAppFixture.cs | Updated NpmAppBuilder to use AddJavaScriptApp with "start" script |
| tests/Aspire.Hosting.JavaScript.Tests/AddNodeAppTests.cs | Updated expected manifest script from "start" to "dev" |
| tests/Aspire.Cli.Tests/Projects/FallbackProjectParserTests.cs | Added missing newline at end of file |
| src/Aspire.ProjectTemplates/templates/aspire-py-starter/13.0/apphost.cs | Updated package reference in template |
| src/Aspire.Hosting.NodeJs/api/Aspire.Hosting.NodeJs.cs | Removed obsolete API file |
| src/Aspire.Hosting.JavaScript/*.cs | Updated namespace from Aspire.Hosting.NodeJs to Aspire.Hosting.JavaScript |
| src/Aspire.Hosting.JavaScript/README.md | Updated package name and usage example |
| src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs | Removed obsolete AddNpmApp and old AddNodeApp overload; removed unused imports |
| src/Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.csproj | Updated description and disabled package validation |
| playground/AspireWithNode/AspireWithNode.AppHost/NodeHostingExtensions.cs | Updated resource type from NodeAppResource to JavaScriptAppResource |
| playground/AspireWithNode/AspireWithNode.AppHost/AspireWithNode.AppHost.csproj | Updated package reference |
| playground/AspireWithJavaScript/AspireJavaScript.AppHost/AspireJavaScript.AppHost.csproj | Updated package reference |
| AspireWithMaui.slnx, Aspire.slnx | Updated project paths in solution files |
Comments suppressed due to low confidence (3)
src/Aspire.Hosting.JavaScript/README.md:17
- The text contains a typo or incomplete sentence. 'add a Or resource' should be 'add a JavaScript resource' or similar. This appears to be placeholder text that wasn't fully updated during the rename.
src/Aspire.Hosting.JavaScript/README.md:22 - The usage example is incorrect. According to the method signature
AddJavaScriptApp(string name, string appDirectory, string runScriptName = \"dev\"), the third parameter should be a script name (like "dev" or "start"), not a file path ("app.js"). The example should be:builder.AddJavaScriptApp(\"frontend\", \"../frontend\", \"dev\");or simplybuilder.AddJavaScriptApp(\"frontend\", \"../frontend\");to use the default.
tests/Aspire.Hosting.JavaScript.Tests/NodeAppFixture.cs:36 - The test is using "start" as the script name, but the default for AddJavaScriptApp is "dev" (as seen in the method signature and AddNodeAppTests.cs line 64). This inconsistency means the test is not validating the default behavior. Consider either removing the "start" parameter to test the default, or add a comment explaining why "start" is explicitly specified.
|
We need to mark this deprecated in the CLI @eerhardt @mitchdenny |
What does "deprecated in the CLI" mean? |
Backport of #12681 to release/13.0
/cc @eerhardt
Customer Impact
We need to clean up our APIs since they will be stable in the future and we won't be able to change them. We are deciding to rename NodeJs to JavaScript to make it more future proof.
Testing
Automated tests.
Risk
The APIs and functionality stay the same. Just renames.
Regression?
No