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 | /** The framework-integration package that drives the Nuxt build. */ |
| 5 | export const NUXT_FRAMEWORK_SPECIFIER = "@alchemy.run/frontend-frameworks/nuxt"; |
| 6 | |
| 7 | /** The Node container deploy target for the Nuxt build. */ |
| 8 | export const NUXT_NODE_TARGET_SPECIFIER = "@alchemy.run/frontend-frameworks/nuxt/node"; |
| 9 | |
| 10 | export interface NuxtProps extends FrameworkSiteProps { |
| 11 | /** |
| 12 | * Nuxt config overrides merged over the project's own `nuxt.config.ts` |
| 13 | * (highest-priority layer). `nitro.preset` is owned by the Node deploy |
| 14 | * target (`"node"`) and may not be set here. |
| 15 | */ |
| 16 | nuxt?: Record<string, unknown>; |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Deploy a Nuxt application to Railway: the nitro Node server plus |
| 21 | * prerendered assets on one `Railway.Service`. The Node deploy target |
| 22 | * enforces nitro's `node` preset; do not set `nitro.preset`. |
| 23 | * |
| 24 | * During `alchemy dev` the site is Nuxt's own dev server and no cloud |
| 25 | * resources are created. `Alchemy.remote()` opts back into the live |
| 26 | * Service path. |
| 27 | * |
| 28 | * ### Creating Nuxt Sites |
| 29 | * **Example:** Basic Nuxt App |
| 30 | * ```typescript |
| 31 | * const site = yield* Railway.Website.Nuxt("Web", { |
| 32 | * rootDir: "./app", |
| 33 | * }); |
| 34 | * ``` |
| 35 | * |
| 36 | * ### Server Configuration |
| 37 | * **Example:** Process Environment |
| 38 | * ```typescript |
| 39 | * const site = yield* Railway.Website.Nuxt("Web", { |
| 40 | * rootDir: "./app", |
| 41 | * env: { |
| 42 | * NUXT_PUBLIC_API_BASE: "https://api.example.com", |
| 43 | * }, |
| 44 | * }); |
| 45 | * ``` |
| 46 | * |
| 47 | * @resource |
| 48 | * @product Website |
| 49 | */ |
| 50 | export const Nuxt = (id: string, props: NuxtProps = {}) => |
| 51 | makeFrameworkSite(id, props, { |
| 52 | name: "Nuxt", |
| 53 | framework: NUXT_FRAMEWORK_SPECIFIER, |
| 54 | target: NUXT_NODE_TARGET_SPECIFIER, |
| 55 | options: props.nuxt ? { nuxt: props.nuxt } : undefined, |
| 56 | }).pipe(Namespace.push(id)); |