* Build the smallest valid `.tar.gz` the handler's untar step accepts: a * single file inside an archive. Uses the npm `tar` package (same as * `s3Transport.ts`) so the fixture builder runs cross-platform — Windows * doesn't ship GNU tar in `/usr/bin/tar`, and bare Alpine containers * don't ship
()
| 533 | * of the suite runs. |
| 534 | */ |
| 535 | async function makeMinimalProjectTar(): Promise<Buffer> { |
| 536 | const tar = await import("tar"); |
| 537 | const { mkdtempSync: mk, readFileSync, rmSync: rm, writeFileSync: wf } = await import("node:fs"); |
| 538 | const dir = mk(join(tmpdir(), "hf-lambda-mktar-")); |
| 539 | try { |
| 540 | wf(join(dir, "index.html"), "<!doctype html><title>test</title>"); |
| 541 | const tarPath = join(dir, "out.tar.gz"); |
| 542 | await tar.create({ gzip: true, file: tarPath, cwd: dir }, ["index.html"]); |
| 543 | return readFileSync(tarPath); |
| 544 | } finally { |
| 545 | rm(dir, { recursive: true, force: true }); |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | /** |
| 550 | * Build a minimal `.tar.gz` for a tiny planDir containing `plan.json` + |