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

main
ts 54 lines 1.83 KB
Raw
1 import { frameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts";
2 import type { ViteProps } from "./Vite.ts";
3
4 /** Configuration for a Foldkit website. */
5 export interface FoldkitProps extends FrameworkSiteProps {
6 /** Serializable overrides merged over vite.config.*. */
7 vite?: ViteProps["vite"];
8 }
9
10 /**
11 * Deploy a [Foldkit](https://foldkit.dev) application to Cloud Run.
12 * Browser-only apps use SPA routing. With `ssr.build` enabled in the
13 * Foldkit Vite plugin, prerendered pages and assets are served first,
14 * followed by Foldkit's generated request handler for SSR and hybrid routes.
15 *
16 * The build uses `@alchemy.run/frontend-frameworks/foldkit` and the
17 * project's Vite configuration. No application adapter is required.
18 * Native Foldkit development and live reload run without cloud resources;
19 * `Alchemy.remote()` opts into a live deployment during development.
20 *
21 * ### Creating a Website
22 * **Example:** SPA, SSR, or prerendered Foldkit application
23 * ```typescript
24 * const site = yield* GCP.Website.Foldkit("Web", {
25 * rootDir: "./app",
26 * });
27 * ```
28 *
29 * ### Server Configuration
30 * **Example:** Runtime environment for server-rendered pages
31 * ```typescript
32 * const site = yield* GCP.Website.Foldkit("Web", {
33 * rootDir: "./app",
34 * env: { API_BASE: "https://api.example.com" },
35 * });
36 * ```
37 *
38 * @resource
39 * @product Website
40 */
41 export const Foldkit = (id: string, props: FoldkitProps = {}) =>
42 frameworkSite(id, props, {
43 name: "Foldkit",
44 framework: "@alchemy.run/frontend-frameworks/foldkit",
45 target: "@alchemy.run/frontend-frameworks/foldkit/node",
46 options: {
47 vite: props.vite,
48 notFoundHandling:
49 props.assets?.notFoundHandling === "single-page-application"
50 ? "spa"
51 : props.assets?.notFoundHandling,
52 htmlHandling: props.assets?.htmlHandling,
53 },
54 });