| 1 | import * as Namespace from "../../Namespace.ts"; |
| 2 | import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts"; |
| 3 | |
| 4 | /** The framework-integration package that drives the Vocs build. */ |
| 5 | export const VOCS_FRAMEWORK_SPECIFIER = |
| 6 | "@alchemy.run/frontend-frameworks/vocs/node"; |
| 7 | |
| 8 | /** The Node container deploy target for the Vocs build. */ |
| 9 | export const VOCS_NODE_TARGET_SPECIFIER = |
| 10 | "@alchemy.run/frontend-frameworks/vocs/node"; |
| 11 | |
| 12 | export interface VocsProps extends FrameworkSiteProps { |
| 13 | /** |
| 14 | * Vocs build output directory, relative to {@link rootDir}. Set this when |
| 15 | * `vocs.config.*` customizes `outDir` so generated output stays outside the |
| 16 | * rebuild hash. |
| 17 | * @default "dist" |
| 18 | */ |
| 19 | outDir?: string; |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Deploy a [Vocs](https://vocs.dev) documentation project to a Hetzner |
| 24 | * Cloud Server. Static assets first, then Vocs' Waku RSC handler |
| 25 | * (`/about` → `about/index.html`, otherwise SSR). |
| 26 | * |
| 27 | * |
| 28 | * ### Creating Vocs Sites |
| 29 | * **Example:** Vocs Documentation Site |
| 30 | * ```typescript |
| 31 | * const docs = yield* Hetzner.Website.Vocs("Docs", { |
| 32 | * rootDir: "./docs", |
| 33 | * }); |
| 34 | * ``` |
| 35 | * |
| 36 | * **Example:** Custom Output Directory |
| 37 | * ```typescript |
| 38 | * const docs = yield* Hetzner.Website.Vocs("Docs", { |
| 39 | * rootDir: "./docs", |
| 40 | * outDir: "build", |
| 41 | * }); |
| 42 | * ``` |
| 43 | * |
| 44 | * @resource |
| 45 | * @product Website |
| 46 | */ |
| 47 | export const Vocs = (id: string, props: VocsProps = {}) => |
| 48 | makeFrameworkSite(id, props, { |
| 49 | name: "Vocs", |
| 50 | framework: VOCS_FRAMEWORK_SPECIFIER, |
| 51 | target: VOCS_NODE_TARGET_SPECIFIER, |
| 52 | options: props.outDir !== undefined ? { outDir: props.outDir } : undefined, |
| 53 | htmlHandling: "drop-trailing-slash", |
| 54 | }).pipe(Namespace.push(id)); |