mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-30 09:16:55 +00:00
* fix(aws-lambda): the size check on every PR measures the package a release publishes * style(aws-lambda): format the prebuilt template helper
20 lines
789 B
JavaScript
20 lines
789 B
JavaScript
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
|
|
const CHECKOUT_CODE_URI = "CodeUri: ../../packages/aws-lambda/dist/handler.zip";
|
|
|
|
/** Writes `<outDir>/template.yaml`: the example SAM template, pointed at a `handler.zip` beside it. */
|
|
export function writePrebuiltTemplate(repoRoot, outDir) {
|
|
const template = readFileSync(join(repoRoot, "examples", "aws-lambda", "template.yaml"), "utf-8");
|
|
if (template.split(CHECKOUT_CODE_URI).length !== 2) {
|
|
throw new Error(
|
|
`[prebuilt-template] expected exactly one "${CHECKOUT_CODE_URI}" in the template`,
|
|
);
|
|
}
|
|
mkdirSync(outDir, { recursive: true });
|
|
writeFileSync(
|
|
join(outDir, "template.yaml"),
|
|
template.replace(CHECKOUT_CODE_URI, "CodeUri: handler.zip"),
|
|
);
|
|
}
|