|
| 1 | +export type FnPreset = 'functions-only' | 'jobs-bundle'; |
| 2 | + |
| 3 | +export type K8sTarget = 'knative' | 'deployment'; |
| 4 | + |
| 5 | +export interface K8sResourceQuantities { |
| 6 | + cpu?: string; |
| 7 | + memory?: string; |
| 8 | +} |
| 9 | + |
| 10 | +export interface K8sOptions { |
| 11 | + target?: K8sTarget; |
| 12 | + namespace?: string; |
| 13 | + imagePullSecrets?: string[]; |
| 14 | + resources?: { |
| 15 | + requests?: K8sResourceQuantities; |
| 16 | + limits?: K8sResourceQuantities; |
| 17 | + }; |
| 18 | + /** Knative-specific: containerConcurrency, timeoutSeconds, etc. */ |
| 19 | + knative?: { |
| 20 | + containerConcurrency?: number; |
| 21 | + timeoutSeconds?: number; |
| 22 | + visibility?: 'cluster-local' | 'public'; |
| 23 | + }; |
| 24 | +} |
| 25 | + |
| 26 | +export interface DockerOptions { |
| 27 | + /** Image registry, e.g. 'ghcr.io/my-org'. */ |
| 28 | + registry?: string; |
| 29 | + /** Base image override; defaults to template's choice. */ |
| 30 | + baseImage?: string; |
| 31 | + /** Generate one Dockerfile per function (true) vs one shared image (false). */ |
| 32 | + perFunction?: boolean; |
| 33 | +} |
| 34 | + |
| 35 | +export interface FnConfig { |
| 36 | + /** Directory containing per-function source: <dir>/<name>/handler.{json,ts,py}. Default: 'functions'. */ |
| 37 | + functionsDir?: string; |
| 38 | + /** Output directory for generated artifacts. Default: 'generated'. */ |
| 39 | + outputDir?: string; |
| 40 | + /** Bundle preset. Default: 'functions-only'. */ |
| 41 | + preset?: FnPreset; |
| 42 | + /** Image registry default; per-function manifests can still override. */ |
| 43 | + registry?: string; |
| 44 | + /** Default Kubernetes namespace for generated manifests. */ |
| 45 | + namespace?: string; |
| 46 | + k8s?: K8sOptions; |
| 47 | + docker?: DockerOptions; |
| 48 | + /** Map of template type → module specifier resolved by the generator. */ |
| 49 | + templates?: Record<string, string>; |
| 50 | +} |
| 51 | + |
| 52 | +/** Identity helper for editor autocomplete in fn.config.ts files. */ |
| 53 | +export const defineConfig = (config: FnConfig): FnConfig => config; |
0 commit comments