in src/cfn-custom-resources/static-site/index.ts [17:32]
async function uploadPages(
action: "Create" | "Update" | "Delete",
config: Configuration,
physicalResourceId?: string
) {
if (action === "Create" || action === "Update") {
await staticSiteUpload(`${__dirname}/pages`, config.BucketName);
} else {
// "Trick" to empty the bucket is to upload an empty dir
mkdirSync("/tmp/empty_directory", { recursive: true });
await staticSiteUpload("/tmp/empty_directory", config.BucketName, {
delete: true,
});
}
return physicalResourceId || "StaticSite";
}