| 1 | import { Vite, type ViteProps } from "./Vite.ts"; |
| 2 | |
| 3 | export interface FoldkitProps extends ViteProps {} |
| 4 | |
| 5 | /** |
| 6 | * Deploy a [Foldkit](https://foldkit.dev) app to Cloud Run. Foldkit apps are |
| 7 | * client-only Vite projects, so this is {@link Vite} with SPA fallback |
| 8 | * to `index.html` so deep links boot the app. |
| 9 | * |
| 10 | * |
| 11 | * ### Creating Foldkit Sites |
| 12 | * **Example:** Foldkit app |
| 13 | * ```typescript |
| 14 | * const site = yield* GCP.Website.Foldkit("Web"); |
| 15 | * ``` |
| 16 | * |
| 17 | * **Example:** Project in a subdirectory |
| 18 | * ```typescript |
| 19 | * const site = yield* GCP.Website.Foldkit("Web", { |
| 20 | * rootDir: "applications/web", |
| 21 | * }); |
| 22 | * ``` |
| 23 | * |
| 24 | * ### Single-Page Application Routing |
| 25 | * **Example:** Serving a real 404 page |
| 26 | * ```typescript |
| 27 | * const site = yield* GCP.Website.Foldkit("Web", { |
| 28 | * assets: { notFoundHandling: "404-page" }, |
| 29 | * }); |
| 30 | * ``` |
| 31 | * |
| 32 | * @resource |
| 33 | * @product Website |
| 34 | */ |
| 35 | export const Foldkit = (id: string, props: FoldkitProps = {}) => |
| 36 | Vite(id, { |
| 37 | ...props, |
| 38 | assets: { |
| 39 | notFoundHandling: "single-page-application", |
| 40 | ...props.assets, |
| 41 | }, |
| 42 | }); |