The best way to control Claude Code, Codex and more from any computer or phone

main
ts 91 lines 3.23 KB
Raw
1 import { frameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts";
2
3 /** The framework-integration package that drives the SolidStart build. */
4 export const SOLIDSTART_FRAMEWORK_SPECIFIER = "@alchemy.run/frontend-frameworks/solidstart";
5
6 /** The Node container deploy target for the SolidStart build. */
7 export const SOLIDSTART_NODE_TARGET_SPECIFIER = "@alchemy.run/frontend-frameworks/solidstart/node";
8
9 export interface SolidStartProps extends FrameworkSiteProps {
10 /**
11 * Nitro options forwarded into the nitro plugin the integration appends
12 * (prerendering, route rules, storage, ...). `preset` is owned by the
13 * Node deploy target and may not be set here. JSON-serializable values
14 * only — no functions or plugin instances.
15 *
16 * This is a prop (rather than project config) because the integration
17 * owns the nitro plugin instance: a `nitroV2Plugin()` in your project's
18 * `vite.config.*` is rejected, so this prop is the one home for nitro
19 * options — and it accepts values derived from other resources' Outputs,
20 * which a config file cannot.
21 */
22 nitro?: Record<string, unknown>;
23 }
24
25 /**
26 * Deploy a [SolidStart](https://start.solidjs.com) application to Cloud Run: the
27 * SSR server in a Cloud Run container, static assets (prerendered pages included)
28 * baked into the image, served assets-first then the framework handler.
29 *
30 * The build runs through `@alchemy.run/frontend-frameworks/solidstart` with
31 * the `@alchemy.run/frontend-frameworks/solidstart/node` deploy target —
32 * both must be installed in your project, alongside `@solidjs/start` and
33 * `@solidjs/vite-plugin-nitro-2`.
34 *
35 * Your `vite.config.ts` needs no adapter wiring: the integration drives the
36 * project's own `vite build` and appends its own nitro plugin instance
37 * carrying nitro's `node` preset.
38 *
39 *
40 * ### Creating SolidStart Sites
41 * **Example:** Basic SolidStart App
42 * ```typescript
43 * const site = yield* GCP.Website.SolidStart("Web", {
44 * rootDir: "./app",
45 * });
46 * ```
47 *
48 * **Example:** Warm Instance with More Memory
49 * ```typescript
50 * const site = yield* GCP.Website.SolidStart("Web", {
51 * rootDir: "./app",
52 * scaling: { minInstanceCount: 1 },
53 * resources: { limits: { cpu: "1", memory: "1Gi" } },
54 * });
55 * ```
56 *
57 * ### Server Configuration
58 * **Example:** Process Environment
59 * ```typescript
60 * const site = yield* GCP.Website.SolidStart("Web", {
61 * rootDir: "./app",
62 * env: {
63 * GREETING: "Hello from SolidStart on Cloud Run!",
64 * },
65 * });
66 * ```
67 *
68 * ### Prerendering
69 * The integration owns the nitro plugin instance (a `nitroV2Plugin()` in
70 * your `vite.config.*` is rejected), so nitro options — prerendering
71 * included — go on the `nitro` prop. Prerendered pages are baked into the
72 * image and served as static files.
73 *
74 * **Example:** Prerender Routes
75 * ```typescript
76 * const site = yield* GCP.Website.SolidStart("Web", {
77 * rootDir: "./app",
78 * nitro: { prerender: { routes: ["/", "/about"] } },
79 * });
80 * ```
81 *
82 * @resource
83 * @product Website
84 */
85 export const SolidStart = (id: string, props: SolidStartProps = {}) =>
86 frameworkSite(id, props, {
87 name: "SolidStart",
88 framework: SOLIDSTART_FRAMEWORK_SPECIFIER,
89 target: SOLIDSTART_NODE_TARGET_SPECIFIER,
90 options: { nitro: props.nitro },
91 });