| 1 | import * as Namespace from "../../Namespace.ts"; |
| 2 | import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts"; |
| 3 | |
| 4 | /** Configuration for a Prisma Nuxt website. */ |
| 5 | export interface NuxtProps extends FrameworkSiteProps { |
| 6 | /** Serializable overrides merged over nuxt.config.*; nitro.preset is owned by the Node target. */ |
| 7 | nuxt?: Record<string, unknown>; |
| 8 | } |
| 9 | |
| 10 | /** |
| 11 | * Nuxt SSR and prerendered assets on Prisma Compute. The Node target owns Nitro’s node preset; do not override nitro.preset. |
| 12 | * |
| 13 | * Native framework development and HMR run without Prisma cloud resources. |
| 14 | * Apply `Alchemy.remote()` to use the live Compute deployment during dev. |
| 15 | * Packaging requires the optional `@vercel/nft` peer dependency. |
| 16 | * |
| 17 | * ### Creating a Website |
| 18 | * **Example:** Nuxt application |
| 19 | * ```typescript |
| 20 | * const site = yield* Prisma.Website.Nuxt("Web", { |
| 21 | * rootDir: "./app", |
| 22 | * }); |
| 23 | * ``` |
| 24 | * |
| 25 | * ### Deployment Configuration |
| 26 | * **Example:** Existing project and custom hostname |
| 27 | * ```typescript |
| 28 | * const site = yield* Prisma.Website.Nuxt("Web", { |
| 29 | * project, |
| 30 | * domain: "www.example.com", |
| 31 | * env: { API_BASE: "https://api.example.com" }, |
| 32 | * compute: { destroyOldDeployment: true }, |
| 33 | * }); |
| 34 | * ``` |
| 35 | * |
| 36 | * @resource |
| 37 | * @product Website |
| 38 | */ |
| 39 | export const Nuxt = (id: string, props: NuxtProps = {}) => |
| 40 | makeFrameworkSite(id, props, { |
| 41 | framework: "@alchemy.run/frontend-frameworks/nuxt", |
| 42 | target: "@alchemy.run/frontend-frameworks/nuxt/node", |
| 43 | options: { nuxt: props.nuxt }, |
| 44 | }).pipe(Namespace.push(id)); |