Configuration
Screenbook uses a screenbook.config.ts file for configuration. This file is auto-generated by screenbook init.
Configuration File
Section titled “Configuration File”import { defineConfig } from "screenbook"
export default defineConfig({ // Output directory for generated files outDir: ".screenbook",
// Glob pattern for screen metadata files metaPattern: "src/**/screen.meta.ts",
// Glob pattern for route files (for lint/generate commands) routesPattern: "src/pages/**/page.tsx",
// Patterns to ignore ignore: ["**/node_modules/**", "**/.git/**"],
// Progressive adoption settings adoption: { mode: "full", },})Options
Section titled “Options”outDir
Section titled “outDir”Type: string
Default: ".screenbook"
Output directory for generated files (screens.json, graph.mmd, coverage.json).
metaPattern
Section titled “metaPattern”Type: string
Default: "src/**/screen.meta.ts"
Glob pattern for finding screen metadata files.
routesPattern
Section titled “routesPattern”Type: string
Default: undefined
Glob pattern for finding route files. Required for lint and generate commands.
Framework examples:
| Framework | Pattern |
|---|---|
| Next.js (App Router) | app/**/page.tsx |
| Next.js (Pages Router) | pages/**/*.tsx |
| Vite/React | src/pages/**/page.tsx |
| Remix | app/routes/**/*.tsx |
| Nuxt | pages/**/*.vue |
| Astro | src/pages/**/*.astro |
ignore
Section titled “ignore”Type: string[]
Default: ["**/node_modules/**", "**/.git/**"]
Glob patterns to ignore when scanning for files.
adoption
Section titled “adoption”Type: AdoptionConfig
Default: { mode: "full" }
Progressive adoption settings for gradual rollout.
adoption: { // "full" = all routes must have screen.meta.ts // "progressive" = only check coverage within includePatterns mode: "progressive",
// Patterns to include for coverage checking (progressive mode only) includePatterns: ["src/pages/billing/**"],
// Minimum coverage percentage required to pass lint minimumCoverage: 80,}Config File Discovery
Section titled “Config File Discovery”Screenbook looks for configuration files in this order:
screenbook.config.tsscreenbook.config.jsscreenbook.config.mjs
You can also specify a custom path with the --config flag:
npx screenbook build --config ./config/screenbook.config.tsTypeScript Support
Section titled “TypeScript Support”The defineConfig function provides full TypeScript support with autocompletion and type checking:
import { defineConfig } from "screenbook"
export default defineConfig({ // TypeScript will provide autocomplete and type checking here})