Skip to content

packager API

Everything the package exports, by the path you import it from. Open an export for its signature and options.

@evolve-framework/packager

buildScripts, which runs the targets named by command-line flags, and the builds: buildDocker, buildLambda, buildAzureFunction and bundleTerraform

Functions

buildAzureFunctionBuild a zip archive to be deployed as an Azure Function This generates a package.json and copies the host.json file to the root.
import { buildAzureFunction } from "@evolve-framework/packager";
function buildAzureFunction(options: AzureFunctionOptions): Promise<void>
OptionTypeDescription
srcDirstring

Holds host.json and one directory per function, each with an index.ts.

outdirstring

Where the function app is assembled.

archiveName?string

Zips the function app to this path, leaving source maps out.

external?string[]

Packages left out of the bundle, because the runtime provides them.

Returns Promise<void>

buildDockerBuild the dist files for the docker container.
import { buildDocker } from "@evolve-framework/packager";
function buildDocker(options: DockerOptions): Promise<void>
OptionTypeDescription
entryPointstring

The module the container starts.

outdirstring

Where the bundled .mjs files are written.

external?string[]

Packages left out of the bundle, to be installed in the image instead.

inject?string[]

Modules imported ahead of the entry point, as esbuild's inject.

keepNames?boolean

Keeps function and class names, for code that reads .name at runtime.

Returns Promise<void>

buildLambdaBuild a Lambda function and optionally create a zip archive of the output.
import { buildLambda } from "@evolve-framework/packager";
function buildLambda(options: LambdaOptions): Promise<void>
OptionTypeDescription
entryPointsstring[]

One handler module per function; several share one bundle directory.

outdirstring

Where the bundled .mjs files are written.

external?string[]

Packages left out of the bundle, because the runtime provides them.

archiveName?string

Zips the bundle to this path, leaving source maps out of the archive.

sourcemapsDir?string

Where source maps are moved to. Defaults to <outdir>/sourcemaps.

includeFiles?string[]

Files copied as they are into the bundle directory and the archive.

Returns Promise<void>

buildScriptsRuns the build targets named by command-line flags, in the order given: --lambda runs the target keyed lambda.
import { buildScripts } from "@evolve-framework/packager";
function buildScripts(options: ScriptOptions): Promise<void>

Returns Promise<void>

bundleTerraformCreate a zip archive of the given Terraform files
import { bundleTerraform } from "@evolve-framework/packager";
function bundleTerraform({ archiveName, source }: BundleOptions): Promise<void>
OptionTypeDescription
archiveNamestring

The zip to write.

source?string

The directory archived, as the root of the zip. Defaults to ./terraform.

Returns Promise<void>