JavaScriptHostingExtensions.WithNpm<TResource> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Configures the Node.js resource to use npm as the package manager and optionally installs packages before the application starts.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<TResource> WithNpm<TResource>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<TResource> resource, bool install = true, string? installCommand = default, string[]? installArgs = default) where TResource : Aspire.Hosting.JavaScript.JavaScriptAppResource;
static member WithNpm : Aspire.Hosting.ApplicationModel.IResourceBuilder<'Resource (requires 'Resource :> Aspire.Hosting.JavaScript.JavaScriptAppResource)> * bool * string * string[] -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'Resource (requires 'Resource :> Aspire.Hosting.JavaScript.JavaScriptAppResource)> (requires 'Resource :> Aspire.Hosting.JavaScript.JavaScriptAppResource)
<Extension()>
Public Function WithNpm(Of TResource As JavaScriptAppResource) (resource As IResourceBuilder(Of TResource), Optional install As Boolean = true, Optional installCommand As String = Nothing, Optional installArgs As String() = Nothing) As IResourceBuilder(Of TResource)
Type Parameters
- TResource
Parameters
- resource
- IResourceBuilder<TResource>
The NodeAppResource.
- install
- Boolean
When true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.
- installCommand
- String
The install command itself passed to npm to install dependencies.
- installArgs
- String[]
The command-line arguments passed to npm to install dependencies.
Returns
A reference to the IResourceBuilder<T>.