1import { frameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts";
2
3/** The framework-integration package that drives the Nuxt build. */
4export const NUXT_FRAMEWORK_SPECIFIER = "@alchemy.run/frontend-frameworks/nuxt";
5
6/** The Node container deploy target for the Nuxt build. */
7export const NUXT_NODE_TARGET_SPECIFIER =
8 "@alchemy.run/frontend-frameworks/nuxt/node";
9
10export 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 and may not be set here.
15 */
16 nuxt?: Record<string, unknown>;
17}
18
19/**
20 * Deploy a Nuxt application to Cloud Run: the nitro Node server in a Cloud Run container,
21 * static assets (prerendered pages included) baked into the image.
22 *
23 *
24 * ### Creating Nuxt Sites
25 * **Example:** Basic Nuxt App
26 * ```typescript
27 * const site = yield* GCP.Website.Nuxt("Web", {
28 * rootDir: "./app",
29 * });
30 * ```
31 *
32 * **Example:** Warm Instance with More Memory
33 * ```typescript
34 * const site = yield* GCP.Website.Nuxt("Web", {
35 * rootDir: "./app",
36 * scaling: { minInstanceCount: 1 },
37 * resources: { limits: { cpu: "1", memory: "1Gi" } },
38 * });
39 * ```
40 *
41 * @resource
42 * @product Website
43 */
44export const Nuxt = (id: string, props: NuxtProps = {}) =>
45 frameworkSite(id, props, {
46 name: "Nuxt",
47 framework: NUXT_FRAMEWORK_SPECIFIER,
48 target: NUXT_NODE_TARGET_SPECIFIER,
49 options: props.nuxt ? { nuxt: props.nuxt } : undefined,
50 });