(opts: {
repoRoot: string;
stackName: string;
region: string;
awsProfile?: string;
stdio?: "inherit" | "pipe";
})
| 112 | |
| 113 | /** Run `sam delete` non-interactively. */ |
| 114 | export function samDelete(opts: { |
| 115 | repoRoot: string; |
| 116 | stackName: string; |
| 117 | region: string; |
| 118 | awsProfile?: string; |
| 119 | stdio?: "inherit" | "pipe"; |
| 120 | }): void { |
| 121 | assertSamAvailable(); |
| 122 | const args = ["delete", "--stack-name", opts.stackName, "--region", opts.region, "--no-prompts"]; |
| 123 | if (opts.awsProfile) { |
| 124 | args.push("--profile", opts.awsProfile); |
| 125 | } |
| 126 | const samDir = join(opts.repoRoot, "examples", "aws-lambda"); |
| 127 | const result = spawnSync("sam", args, { cwd: samDir, stdio: opts.stdio ?? "inherit" }); |
| 128 | if (result.status !== 0) { |
| 129 | throw new Error(`[lambda] sam delete exited with code ${result.status ?? "unknown"}`); |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | export interface StackOutputBag { |
| 134 | bucketName: string; |
no test coverage detected