The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | import * as Namespace from "alchemy/Namespace"; |
| 2 | import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts"; |
| 3 | |
| 4 | /** Configuration for a Prisma Vite website. */ |
| 5 | export interface ViteProps extends FrameworkSiteProps { |
| 6 | /** Serializable overrides merged over vite.config.*. */ |
| 7 | vite?: { |
| 8 | /** Build output directory. @default "dist" */ |
| 9 | outDir?: string; |
| 10 | /** Public base path. @default "/" */ |
| 11 | base?: string; |
| 12 | }; |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * Static Vite assets served on Prisma Compute. The project’s Vite plugins and configuration drive the build; native Vite HMR runs during development. |
| 17 | * |
| 18 | * Native framework development and HMR run without Prisma cloud resources. |
| 19 | * Apply `Alchemy.remote()` to use the live Compute deployment during dev. |
| 20 | * Packaging requires the optional `@vercel/nft` peer dependency. |
| 21 | * |
| 22 | * ### Creating a Website |
| 23 | * **Example:** Vite application |
| 24 | * ```typescript |
| 25 | * const site = yield* Prisma.Website.Vite("Web", { |
| 26 | * rootDir: "./app", |
| 27 | * }); |
| 28 | * ``` |
| 29 | * |
| 30 | * ### Deployment Configuration |
| 31 | * **Example:** Existing project and custom hostname |
| 32 | * ```typescript |
| 33 | * const site = yield* Prisma.Website.Vite("Web", { |
| 34 | * project, |
| 35 | * domain: "www.example.com", |
| 36 | * env: { API_BASE: "https://api.example.com" }, |
| 37 | * compute: { destroyOldDeployment: true }, |
| 38 | * }); |
| 39 | * ``` |
| 40 | * |
| 41 | * **Example:** Publish DNS in Cloudflare |
| 42 | * ```typescript |
| 43 | * // The custom domain's DNS-only CNAME is published in the Cloudflare |
| 44 | * // zone. Requires Cloudflare.providers() in the stack. |
| 45 | * const site = yield* Prisma.Website.Vite("Web", { |
| 46 | * domain: { name: "www.example.com", dns: Cloudflare.DNS.Adapter() }, |
| 47 | * }); |
| 48 | * ``` |
| 49 | * |
| 50 | * @resource |
| 51 | * @product Website |
| 52 | */ |
| 53 | export const Vite = (id: string, props: ViteProps = {}) => |
| 54 | makeFrameworkSite(id, props, { |
| 55 | framework: "@alchemy.run/frontend-frameworks/vite", |
| 56 | target: "@alchemy.run/frontend-frameworks/vite/node", |
| 57 | options: { vite: props.vite }, |
| 58 | notFoundHandling: "spa", |
| 59 | }).pipe(Namespace.push(id)); |