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

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