MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / runDeploy

Function runDeploy

packages/cli/src/commands/lambda/deploy.ts:36–100  ·  view source on GitHub ↗
(args: Partial<DeployArgs> = {})

Source from the content-addressed store, hash-verified

34const DEFAULT_CONCURRENCY = 8;
35
36export async function runDeploy(args: Partial<DeployArgs> = {}): Promise<void> {
37 const resolved: DeployArgs = {
38 stackName: args.stackName ?? DEFAULT_STACK_NAME,
39 region: args.region ?? process.env.AWS_REGION ?? DEFAULT_REGION,
40 awsProfile: args.awsProfile ?? process.env.AWS_PROFILE,
41 reservedConcurrency: args.reservedConcurrency ?? DEFAULT_CONCURRENCY,
42 chromeSource: args.chromeSource ?? "sparticuz",
43 lambdaMemoryMb: args.lambdaMemoryMb ?? DEFAULT_MEMORY_MB,
44 skipBuild: args.skipBuild ?? false,
45 };
46
47 const root = repoRoot();
48 // Locate the SAM template up-front so users get a fast, clear error
49 // (not an opaque `sam deploy` failure) when this isn't a checkout.
50 locateSamTemplate(root);
51
52 if (!resolved.skipBuild) {
53 console.log(c.dim("→ Building handler ZIP"));
54 buildHandlerZip(root);
55 } else {
56 const zip = join(root, "packages", "aws-lambda", "dist", "handler.zip");
57 if (!existsSync(zip)) {
58 throw new Error(
59 `--skip-build set but ${zip} does not exist. Run \`bun run --cwd packages/aws-lambda build:zip\` first or drop --skip-build.`,
60 );
61 }
62 }
63
64 console.log(c.dim(`→ sam deploy (stack=${resolved.stackName} region=${resolved.region})`));
65 samDeploy({
66 repoRoot: root,
67 stackName: resolved.stackName,
68 region: resolved.region,
69 awsProfile: resolved.awsProfile,
70 reservedConcurrency: resolved.reservedConcurrency,
71 lambdaMemoryMb: resolved.lambdaMemoryMb,
72 chromeSource: resolved.chromeSource,
73 });
74
75 console.log(c.dim("→ Reading stack outputs"));
76 const outputs = fetchStackOutputs({
77 stackName: resolved.stackName,
78 region: resolved.region,
79 awsProfile: resolved.awsProfile,
80 });
81
82 const statePath = writeStackOutputs({
83 stackName: resolved.stackName,
84 region: resolved.region,
85 bucketName: outputs.bucketName,
86 stateMachineArn: outputs.stateMachineArn,
87 functionName: outputs.functionName,
88 lambdaMemoryMb: resolved.lambdaMemoryMb,
89 deployedAt: new Date().toISOString(),
90 });
91
92 console.log();
93 console.log(c.success("Stack deployed."));

Callers

nothing calls this directly

Calls 7

repoRootFunction · 0.85
locateSamTemplateFunction · 0.85
buildHandlerZipFunction · 0.85
samDeployFunction · 0.85
fetchStackOutputsFunction · 0.85
writeStackOutputsFunction · 0.85
resolveFunction · 0.85

Tested by

no test coverage detected