WeChooz.Aspire.Hosting.NpmRestore documentation
WeChooz.Aspire.Hosting.NpmRestore
adds the ability to restore npm packages when launching a project in .NET Aspire.
Get started
To get started, install the install the 📦 WeChooz.Aspire.Hosting.NpmRestore NuGet package in the AppHost project.
.NET CLI
dotnet add package WeChooz.Aspire.Hosting.NpmRestore
Example usage
To add the npm restore
resource, call the AddNpmRestore
method on a IResourceBuilder<ProjectResource>
instance (after calling AddProject
):
builder.AddProject<Projects.WebApplication>("webapplication")
.AddNpmRestore();
You can configure some options by passing a delegate to the AddNpmRestore
method:
builder.AddProject<Projects.WebApplication>("webapplication")
.AddNpmRestore(options => {...});
Following options are available:
Name | Default value | Description |
---|---|---|
AlwaysRun | true |
Defines if the resource should always run, or should be explicitly run. |
PackageManagerExecutableName | "npm" |
Defines the name of the executable to process the package restore. |
RestoreCommandAndArgs | ["i"] |
Defines the command to execute to restore the packages. |
ResourceNameFormat | (string projectName) => $"{projectName}-restore" |
Defines the format to compute the name of the restore resource from the name of the project. |