| 1 | import * as Namespace from "../../Namespace.ts"; |
| 2 | import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts"; |
| 3 | |
| 4 | /** Configuration for a Prisma vinext website. */ |
| 5 | export interface VinextProps extends FrameworkSiteProps {} |
| 6 | |
| 7 | /** |
| 8 | * Deploy a vinext application to Prisma Compute using vinext's Vite build and |
| 9 | * vinext's production Node server on Compute's Bun runtime. Alchemy packages |
| 10 | * the build output and traced, locally installed runtime dependencies; no |
| 11 | * Dockerfile, registry, Wrangler, or OpenNext is required. |
| 12 | * |
| 13 | * Native `vinext dev` development and HMR run without Prisma cloud resources. |
| 14 | * Apply `Alchemy.remote()` to use a live Compute deployment during dev. |
| 15 | * Packaging requires the optional `@vercel/nft` peer dependency. |
| 16 | * |
| 17 | * ### Creating a Website |
| 18 | * **Example:** vinext application |
| 19 | * ```typescript |
| 20 | * const site = yield* Prisma.Website.Vinext("Web", { |
| 21 | * rootDir: "./app", |
| 22 | * env: { GREETING: "Hello from vinext on Prisma!" }, |
| 23 | * }); |
| 24 | * ``` |
| 25 | * |
| 26 | * ### Deployment Configuration |
| 27 | * **Example:** Existing project and custom hostname |
| 28 | * ```typescript |
| 29 | * const site = yield* Prisma.Website.Vinext("Web", { |
| 30 | * project, |
| 31 | * domain: "www.example.com", |
| 32 | * compute: { destroyOldDeployment: true }, |
| 33 | * }); |
| 34 | * ``` |
| 35 | * |
| 36 | * ### Persistent Data Cache |
| 37 | * **Example:** Shared Redis cache |
| 38 | * The resource injects the data-cache adapter automatically. Set `env.REDIS_URL` |
| 39 | * to use Redis; otherwise the cache is process-local |
| 40 | * and is lost on restart. Prisma Compute does not provision a Redis store. |
| 41 | * ```typescript |
| 42 | * const site = yield* Prisma.Website.Vinext("Web", { |
| 43 | * env: { REDIS_URL: Redacted.make("rediss://user:password@cache.example.com:6379") }, |
| 44 | * }); |
| 45 | * ``` |
| 46 | * |
| 47 | * @resource |
| 48 | * @product Website |
| 49 | */ |
| 50 | export const Vinext = (id: string, props: VinextProps = {}) => |
| 51 | makeFrameworkSite(id, props, { |
| 52 | framework: "@alchemy.run/frontend-frameworks/vinext/node", |
| 53 | target: "@alchemy.run/frontend-frameworks/vinext/node", |
| 54 | }).pipe(Namespace.push(id)); |