| 1 | import * as GCP from "@/GCP"; |
| 2 | import { describe, expect, it } from "alchemy-test"; |
| 3 | |
| 4 | /** |
| 5 | * Compile-time pins for GCP.Website prop surfaces: the shared Cloud Run |
| 6 | * knobs, framework option bags, and props that other providers carry but |
| 7 | * GCP deliberately omits (`domain`, `app`, Fly deploy policies). |
| 8 | */ |
| 9 | describe( |
| 10 | "GCP.Website prop surfaces", |
| 11 | { tags: ["unit", "provider:gcp", "provider:gcp:website", "local"] }, |
| 12 | () => { |
| 13 | const _pins = [ |
| 14 | () => |
| 15 | GCP.Website.Vinext("Vinext", { |
| 16 | rootDir: "./app", |
| 17 | env: { GREETING: "Hello" }, |
| 18 | memo: { lockfile: true }, |
| 19 | assets: { notFoundHandling: "404-page" }, |
| 20 | dev: {}, |
| 21 | }), |
| 22 | () => |
| 23 | GCP.Website.Vite("V", { |
| 24 | public: false, |
| 25 | ingress: "INGRESS_TRAFFIC_INTERNAL_ONLY", |
| 26 | scaling: { minInstanceCount: 1, maxInstanceCount: 3 }, |
| 27 | resources: { limits: { cpu: "1", memory: "1Gi" } }, |
| 28 | timeout: "60s", |
| 29 | maxInstanceRequestConcurrency: 40, |
| 30 | serviceAccount: "site@project.iam.gserviceaccount.com", |
| 31 | tags: { team: "web" }, |
| 32 | assets: { notFoundHandling: "single-page-application" }, |
| 33 | vite: { outDir: "build", base: "/docs/" }, |
| 34 | }), |
| 35 | () => |
| 36 | GCP.Website.Vite("V", { |
| 37 | // @ts-expect-error spa sugar replaced by assets.notFoundHandling |
| 38 | spa: true, |
| 39 | }), |
| 40 | () => |
| 41 | GCP.Website.Vite("V", { |
| 42 | // @ts-expect-error outDir lives on the vite bag |
| 43 | outDir: "build", |
| 44 | }), |
| 45 | () => |
| 46 | GCP.Website.Astro("A", { |
| 47 | // @ts-expect-error no Cloud Run domain-mapping resource yet |
| 48 | domain: "app.example.com", |
| 49 | }), |
| 50 | () => |
| 51 | GCP.Website.Nextjs("N", { |
| 52 | // @ts-expect-error Fly deploy policies do not apply to Cloud Run |
| 53 | deploy: { strategy: "rolling" }, |
| 54 | }), |
| 55 | () => |
| 56 | GCP.Website.Waku("W", { |
| 57 | waku: { srcDir: "app", distDir: "build", basePath: "/docs/" }, |
| 58 | }), |
| 59 | () => |
| 60 | GCP.Website.Astro("A", { |
| 61 | astro: { output: "static" }, |
| 62 | assets: { notFoundHandling: "404-page" }, |
| 63 | }), |
| 64 | () => |
| 65 | GCP.Website.Nuxt("N", { |
| 66 | nuxt: { app: { baseURL: "/docs/" } }, |
| 67 | }), |
| 68 | () => |
| 69 | GCP.Website.SvelteKit("S", { |
| 70 | kit: { paths: { base: "/docs" } }, |
| 71 | }), |
| 72 | () => |
| 73 | GCP.Website.SolidStart("So", { |
| 74 | nitro: { prerender: { routes: ["/"] } }, |
| 75 | }), |
| 76 | () => GCP.Website.ReactRouter("R", {}), |
| 77 | () => GCP.Website.TanStackStart("T", {}), |
| 78 | () => GCP.Website.Octane("O", {}), |
| 79 | () => GCP.Website.Vocs("D", {}), |
| 80 | () => |
| 81 | GCP.Website.Foldkit("F", { |
| 82 | assets: { notFoundHandling: "404-page" }, |
| 83 | }), |
| 84 | () => |
| 85 | GCP.Website.StaticSite("St", { |
| 86 | build: { command: "hugo --minify", output: "public" }, |
| 87 | scaling: { minInstanceCount: 1 }, |
| 88 | assets: { notFoundHandling: "single-page-application" }, |
| 89 | }), |
| 90 | () => |
| 91 | GCP.Website.StaticSite("St", { |
| 92 | build: { command: "npm run build", output: "dist" }, |
| 93 | // @ts-expect-error command is nested under build |
| 94 | command: "npm run build", |
| 95 | }), |
| 96 | ]; |
| 97 | |
| 98 | it( |
| 99 | "pins the GCP.Website prop surface at the type level", |
| 100 | () => { |
| 101 | expect(_pins.length).toBeGreaterThan(0); |
| 102 | }, |
| 103 | { tags: ["provider:gcp", "provider:gcp:website", "live"] }, |
| 104 | ); |
| 105 | }, |
| 106 | ); |