| 1 | import * as Namespace from "../../Namespace.ts"; |
| 2 | import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts"; |
| 3 | |
| 4 | /** Configuration for a Prisma Waku website. */ |
| 5 | export interface WakuProps extends FrameworkSiteProps { |
| 6 | /** Serializable overrides merged over waku.config.*. */ |
| 7 | waku?: { |
| 8 | /** Application source directory. */ |
| 9 | srcDir?: string; |
| 10 | /** Production output directory. */ |
| 11 | distDir?: string; |
| 12 | /** Public URL base path. */ |
| 13 | basePath?: string; |
| 14 | }; |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Waku RSC and static pages on Prisma Compute. The Node target selects Waku’s node adapter; do not set unstable_adapter. |
| 19 | * |
| 20 | * Native framework development and HMR run without Prisma cloud resources. |
| 21 | * Apply `Alchemy.remote()` to use the live Compute deployment during dev. |
| 22 | * Packaging requires the optional `@vercel/nft` peer dependency. |
| 23 | * |
| 24 | * ### Creating a Website |
| 25 | * **Example:** Waku application |
| 26 | * ```typescript |
| 27 | * const site = yield* Prisma.Website.Waku("Web", { |
| 28 | * rootDir: "./app", |
| 29 | * }); |
| 30 | * ``` |
| 31 | * |
| 32 | * ### Deployment Configuration |
| 33 | * **Example:** Existing project and custom hostname |
| 34 | * ```typescript |
| 35 | * const site = yield* Prisma.Website.Waku("Web", { |
| 36 | * project, |
| 37 | * domain: "www.example.com", |
| 38 | * env: { API_BASE: "https://api.example.com" }, |
| 39 | * compute: { destroyOldDeployment: true }, |
| 40 | * }); |
| 41 | * ``` |
| 42 | * |
| 43 | * @resource |
| 44 | * @product Website |
| 45 | */ |
| 46 | export const Waku = (id: string, props: WakuProps = {}) => |
| 47 | makeFrameworkSite(id, props, { |
| 48 | framework: "@alchemy.run/frontend-frameworks/waku", |
| 49 | target: "@alchemy.run/frontend-frameworks/waku/node", |
| 50 | options: { waku: props.waku }, |
| 51 | htmlHandling: "drop-trailing-slash", |
| 52 | }).pipe(Namespace.push(id)); |