Skip to content
DocsTry Aspire
DocsTry

JavaScriptAppResource

Handle
📦 Aspire.Hosting.JavaScript v13.4.0
interface JavaScriptAppResource
extends IComputeResource,
IResource,
IResourceWithArgs,
IResourceWithEndpoints,
IResourceWithEnvironment,
IResourceWithProbes,
IResourceWithWaitSupport,
IResourceWithContainerFiles,
IResourceWithServiceDiscovery {
publishAsNodeServer(
entryPoint: string,
outputPath?: string): JavaScriptAppResource;
publishAsPackageScript(
scriptName?: string,
runScriptArguments?: string): JavaScriptAppResource;
publishAsStaticWebsite(
apiPath?: string,
apiTarget?: IResourceWithServiceDiscovery,
outputPath?: string,
stripPrefix?: boolean,
targetEndpointName?: string): JavaScriptAppResource;
withBrowserDebugger(browser?: string): JavaScriptAppResource;
withBuildScript(
scriptName: string,
args?: string[]): JavaScriptAppResource;
withBun(
install?: boolean,
installArgs?: string[]): JavaScriptAppResource;
withNpm(
install?: boolean,
installCommand?: string,
installArgs?: string[]): JavaScriptAppResource;
withPnpm(
install?: boolean,
installArgs?: string[]): JavaScriptAppResource;
withRunScript(
scriptName: string,
args?: string[]): JavaScriptAppResource;
withYarn(
install?: boolean,
installArgs?: string[]): JavaScriptAppResource;
}

Methods

methodpublishAsNodeServerbuilder
Configures the JavaScript application to publish as a standalone Node.js server that runs a built artifact directly.
publishAsNodeServer(
entryPoint: string,
outputPath?: string): JavaScriptAppResource
entryPointstring
outputPathstringoptional= .
JavaScriptAppResource
Configures the JavaScript application to publish as a Node.js server that uses a `package.json` script at runtime.
publishAsPackageScript(
scriptName?: string,
runScriptArguments?: string): JavaScriptAppResource
scriptNamestringoptional= start
runScriptArgumentsstringoptional
JavaScriptAppResource
Publishes the JavaScript application as a standalone static website using YARP.
publishAsStaticWebsite(
apiPath?: string,
apiTarget?: IResourceWithServiceDiscovery,
outputPath?: string,
stripPrefix?: boolean,
targetEndpointName?: string): JavaScriptAppResource
apiPathstringoptional
apiTargetIResourceWithServiceDiscoveryoptional
outputPathstringoptional= dist
stripPrefixbooleanoptional= False
targetEndpointNamestringoptional
JavaScriptAppResource
methodwithBrowserDebuggerbuilder
Configures a browser debugger for the JavaScript application resource, enabling browser-based debugging through a child resource that launches when the parent application is ready.
withBrowserDebugger(browser?: string): JavaScriptAppResource
browserstringoptional= msedge
JavaScriptAppResource
methodwithBuildScriptbuilder
Adds a build script annotation to the resource builder using the specified command-line arguments.
withBuildScript(
scriptName: string,
args?: string[]): JavaScriptAppResource
scriptNamestring
argsstring[]optional
JavaScriptAppResource
methodwithBunbuilder
Configures the JavaScript resource to use Bun as the package manager and optionally installs packages before the application starts.
withBun(
install?: boolean,
installArgs?: string[]): JavaScriptAppResource
installbooleanoptional= True
installArgsstring[]optional
JavaScriptAppResource
methodwithNpmbuilder
Configures the Node.js resource to use npm as the package manager and optionally installs packages before the application starts.
withNpm(
install?: boolean,
installCommand?: string,
installArgs?: string[]): JavaScriptAppResource
installbooleanoptional= True
installCommandstringoptional
installArgsstring[]optional
JavaScriptAppResource
methodwithPnpmbuilder
Configures the Node.js resource to use pnpm as the package manager and optionally installs packages before the application starts.
withPnpm(
install?: boolean,
installArgs?: string[]): JavaScriptAppResource
installbooleanoptional= True
installArgsstring[]optional
JavaScriptAppResource
methodwithRunScriptbuilder
Adds a run script annotation to the specified JavaScript application resource builder, specifying the script to execute and its arguments during run mode.
withRunScript(
scriptName: string,
args?: string[]): JavaScriptAppResource
scriptNamestring
argsstring[]optional
JavaScriptAppResource
methodwithYarnbuilder
Configures the Node.js resource to use yarn as the package manager and optionally installs packages before the application starts.
withYarn(
install?: boolean,
installArgs?: string[]): JavaScriptAppResource
installbooleanoptional= True
installArgsstring[]optional
JavaScriptAppResource