(args: Record<string, unknown>)
| 454 | |
| 455 | // fallow-ignore-next-line complexity |
| 456 | async function runSites(args: Record<string, unknown>): Promise<void> { |
| 457 | if (args.target !== "create") { |
| 458 | console.error( |
| 459 | `[cloudrun sites] unknown verb "${String(args.target)}". Only "create" is supported.`, |
| 460 | ); |
| 461 | process.exit(1); |
| 462 | } |
| 463 | const projectDir = args.extra as string | undefined; |
| 464 | if (!projectDir) { |
| 465 | console.error("[cloudrun sites create] usage: hyperframes cloudrun sites create <projectDir>"); |
| 466 | process.exit(1); |
| 467 | } |
| 468 | const state = readState(args); |
| 469 | const { deploySite } = await import("@hyperframes/gcp-cloud-run/sdk"); |
| 470 | const handle = await deploySite({ |
| 471 | projectDir: resolve(projectDir), |
| 472 | bucketName: state.bucketName, |
| 473 | siteId: args["site-id"] as string | undefined, |
| 474 | }); |
| 475 | if (args.json) { |
| 476 | console.log(JSON.stringify(handle, null, 2)); |
| 477 | } else { |
| 478 | console.log( |
| 479 | `${handle.uploaded ? c.accent("✓ uploaded") : c.dim("• already present")} ` + |
| 480 | `site=${handle.siteId} (${handle.bytes} bytes)\n ${handle.projectGcsUri}`, |
| 481 | ); |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | // ── render ────────────────────────────────────────────────────────────────── |
| 486 |
no test coverage detected