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