docs-aspire icon indicating copy to clipboard operation
docs-aspire copied to clipboard

[Breaking change]: Aspire.Hosting.NodeJs library breaks

Open eerhardt opened this issue 2 months ago • 0 comments

Description

We are renaming Aspire.Hosting.NodeJs to Aspire.Hosting.JavaScript.

The current AddNodeApp is being removed and the order of the parameters has changed for a new AddNodeApp overload.

The AddNpmApp is being removed and replaced by AddJavaScriptApp.

See Rename Aspire.Hosting.NodeJs to Aspire.Hosting.JavaScript (dotnet/aspire#12681)

Version

13

Previous behavior

Previously, the signature was:

AddNodeApp(this IDistributedApplicationBuilder builder, [ResourceName] string name, string scriptPath, string? workingDirectory = null, string[]? args = null)

New behavior

The new method takes the application directory first, and then a file path - relative to the application directory. There is no "args" parameter, instead call WithArgs to pass arguments to the app.

AddNodeApp(this IDistributedApplicationBuilder builder, [ResourceName] string name, string appDirectory, string scriptPath)

Type of breaking change

  • [ ] Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • [x] Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
  • [ ] Behavioral change: Existing binaries might behave differently at run time.

Reason for change

This aligns with the rest of the Aspire language integrations. For example Python.

It also allows for a default Dockerfile to be created for the Node.js application.

Recommended action

Use the new library and change the order of the parameters for AddNodeApp.

Affected APIs

  • Aspire.Hosting.NodeJs.*

eerhardt avatar Oct 31 '25 12:10 eerhardt