JavaScriptAppResource
Handle
interface JavaScriptAppResource extends IComputeResource, IResource, IResourceWithArgs, IResourceWithEndpoints, IResourceWithEnvironment, IResourceWithProbes, IResourceWithWaitSupport, IResourceWithContainerFiles, IResourceWithServiceDiscovery { readonly resourceTypeDisplayName: string; 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; withDeno( 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;}12 members
Properties
property
resourceTypeDisplayName stringgetGets the ResourceTypeDisplayName property
Methods
Configures the JavaScript application to publish as a standalone Node.js server that runs a built artifact directly.
publishAsNodeServer( entryPoint: string, outputPath?: string): JavaScriptAppResourceParameters
entryPoint stringThe relative path to the Node.js entry point to execute in the published container after the build completes, such as `.output/server/index.mjs` or `build/index.js`.outputPath stringoptional= .The relative path containing the built runtime files to copy into the published container. Defaults to the application root.Returns
JavaScriptAppResource Configures the JavaScript application to publish as a server that runs a package manager script at runtime.
publishAsPackageScript( scriptName?: string, runScriptArguments?: string): JavaScriptAppResourceParameters
scriptName stringoptional= startThe name of the script to run in the published container. For Node.js and Bun applications this is a `package.json` script; for Deno applications it is a task defined in `deno.json`. For example, `start` invokes the configured package manager's run command for the `start` script, such as `npm run start`, `pnpm run start`, `yarn run start`, `bun run start`, or `deno task start`.runScriptArguments stringoptionalOptional arguments appended after the script name at runtime, such as `-- --port "$PORT"`.Returns
JavaScriptAppResource Publishes the JavaScript application as a standalone static website using YARP.
publishAsStaticWebsite( apiPath?: string, apiTarget?: IResourceWithServiceDiscovery, outputPath?: string, stripPrefix?: boolean, targetEndpointName?: string): JavaScriptAppResourceParameters
apiPath stringoptionalapiTarget IResourceWithServiceDiscovery optionaloutputPath stringoptional= diststripPrefix booleanoptional= FalsetargetEndpointName stringoptionalReturns
JavaScriptAppResource 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): JavaScriptAppResourceParameters
browserstringoptional= msedgeThe browser to use for debugging. Defaults to `"msedge"`. Supported values include `"msedge"` and `"chrome"`.Returns
JavaScriptAppResource Adds a build script annotation to the resource builder using the specified command-line arguments.
withBuildScript( scriptName: string, args?: string[]): JavaScriptAppResourceParameters
scriptName stringThe name of the script to be executed when the resource is built.argsstring[]optionalAn array of command-line arguments to use for the build script.Returns
JavaScriptAppResource Configures the JavaScript resource to use Bun as the package manager and optionally installs packages before the application starts.
withBun( install?: boolean, installArgs?: string[]): JavaScriptAppResourceParameters
installbooleanoptional= TrueWhen true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.installArgs string[]optionalAdditional command-line arguments passed to "bun install". When null, defaults are applied based on publish mode and lockfile presence.Returns
JavaScriptAppResource Configures the JavaScript resource to use Deno as the package manager.
withDeno( install?: boolean, installArgs?: string[]): JavaScriptAppResourceParameters
installbooleanoptional= FalseWhen `true`, creates an installer resource that runs `deno install` before the application starts. Defaults to `false`: unlike npm/Bun, Deno does not require a separate install step — `deno run` fetches and caches dependencies under `DENO_DIR` on first use — so no installer is wired by default. Set to `true` to pre-cache dependencies or to materialize a `node_modules` folder for Node compatibility.installArgs string[]optionalAdditional command-line arguments passed to `deno install`.Returns
JavaScriptAppResource 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[]): JavaScriptAppResourceParameters
installbooleanoptional= TrueWhen true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.installCommand stringoptionalThe install command itself passed to npm to install dependencies.installArgs string[]optionalThe command-line arguments passed to npm to install dependencies.Returns
JavaScriptAppResource 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[]): JavaScriptAppResourceParameters
installbooleanoptional= TrueWhen true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.installArgs string[]optionalThe command-line arguments passed to "pnpm install".Returns
JavaScriptAppResource 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[]): JavaScriptAppResourceParameters
scriptName stringThe name of the script to be executed when the resource is run.argsstring[]optionalAn array of arguments to pass to the script.Returns
JavaScriptAppResource 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[]): JavaScriptAppResourceParameters
installbooleanoptional= TrueWhen true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.installArgs string[]optionalThe command-line arguments passed to "yarn install".Returns
JavaScriptAppResource