JavaScriptAppResource
A resource that represents a JavaScript application.
type JavaScriptAppResource interface { IComputeResource Resource ResourceWithArgs ResourceWithContainerFiles ResourceWithEndpoints ResourceWithEnvironment ResourceWithServiceDiscovery ResourceWithWaitSupport}Properties
ResourceTypeDisplayName stringgetResourceTypeDisplayName() (string, error)Methods
PublishAsNodeServer( entryPoint string, options ...*PublishAsNodeServerOptions,) 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 .options...*PublishAsNodeServerOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*PublishAsNodeServerOptions argument.
OutputPath *stringThe relative path containing the built runtime files to copy into the published container. Defaults to the application root.Returns
JavaScriptAppResource The updated resource builder.
Returns a handle; failures surface later via Err().
PublishAsPackageScript(options ...*PublishAsPackageScriptOptions) JavaScriptAppResourceParameters
options...*PublishAsPackageScriptOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*PublishAsPackageScriptOptions argument.
ScriptName *stringThe 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 *stringOptional arguments appended after the script name at runtime, such as -- --port "$PORT" .Returns
JavaScriptAppResource The updated resource builder.
Returns a handle; failures surface later via Err().
PublishAsStaticWebsite(options ...*PublishAsStaticWebsiteOptions) JavaScriptAppResourceParameters
options...*PublishAsStaticWebsiteOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*PublishAsStaticWebsiteOptions argument.
ApiPath *stringApiTarget *ResourceWithServiceDiscovery OutputPath *stringStripPrefix *boolTargetEndpointName *stringReturns
JavaScriptAppResource Returns a handle; failures surface later via Err().
WithBrowserDebugger(options ...*WithBrowserDebuggerOptions) JavaScriptAppResourceParameters
options...*WithBrowserDebuggerOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithBrowserDebuggerOptions argument.
Browser*stringThe browser to use for debugging. Defaults to "msedge". Supported values include "msedge" and "chrome".Returns
JavaScriptAppResource The resource builder.
Returns a handle; failures surface later via Err().
WithBuildScript( scriptName string, options ...*WithBuildScriptOptions,) JavaScriptAppResourceParameters
scriptName stringThe name of the script to be executed when the resource is built.options...*WithBuildScriptOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithBuildScriptOptions argument.
Args[]string An array of command-line arguments to use for the build script.Returns
JavaScriptAppResource The same resource builder instance with the build script annotation applied.
Returns a handle; failures surface later via Err().
WithBun(options ...*WithBunOptions) JavaScriptAppResourceParameters
options...*WithBunOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithBunOptions argument.
Install*boolWhen true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.InstallArgs []string Additional command-line arguments passed to "bun install". When null, defaults are applied based on publish mode and lockfile presence.Returns
JavaScriptAppResource The resource builder.
Returns a handle; failures surface later via Err().
WithDeno(options ...*WithDenoOptions) JavaScriptAppResourceParameters
options...*WithDenoOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithDenoOptions argument.
Install*boolWhen 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 Additional command-line arguments passed to deno install.Returns
JavaScriptAppResource The resource builder.
Returns a handle; failures surface later via Err().
WithNpm(options ...*WithNpmOptions) JavaScriptAppResourceParameters
options...*WithNpmOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithNpmOptions argument.
Install*boolWhen true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.InstallCommand *stringThe install command itself passed to npm to install dependencies.InstallArgs []string The command-line arguments passed to npm to install dependencies.Returns
JavaScriptAppResource The resource builder.
Returns a handle; failures surface later via Err().
WithPnpm(options ...*WithPnpmOptions) JavaScriptAppResourceParameters
options...*WithPnpmOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithPnpmOptions argument.
Install*boolWhen true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.InstallArgs []string The command-line arguments passed to "pnpm install".Returns
JavaScriptAppResource The resource builder.
Returns a handle; failures surface later via Err().
WithRunScript( scriptName string, options ...*WithRunScriptOptions,) JavaScriptAppResourceParameters
scriptName stringThe name of the script to be executed when the resource is run.options...*WithRunScriptOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithRunScriptOptions argument.
Args[]string An array of arguments to pass to the script.Returns
JavaScriptAppResource The same resource builder instance with the run script annotation applied, enabling further configuration.
Returns a handle; failures surface later via Err().
WithYarn(options ...*WithYarnOptions) JavaScriptAppResourceParameters
options...*WithYarnOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithYarnOptions argument.
Install*boolWhen true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.InstallArgs []string The command-line arguments passed to "yarn install".Returns
JavaScriptAppResource The resource builder.
Returns a handle; failures surface later via Err().