Configuration
jc works with zero config. When you need to customize, create a config file.
Config file
Create jc.config.ts at your project root. The defineConfig helper provides type safety and autocomplete:
ts
import { defineConfig } from 'jc/config'
export default defineConfig({
componentFiles: ['src/components/ui/**/*.tsx'],
outputDir: 'src/jc/generated',
pathAlias: { '@/': 'src/' },
filteredProps: ['className', 'style', 'ref'],
})All options
| Option | Type | Default | Description |
|---|---|---|---|
| componentFiles | string[] | src/components/ui/**/*.tsx | Glob patterns for component discovery |
| excludeFiles | string[] | **/*.test.*, **/*.stories.* | Glob patterns to skip |
| outputDir | string | src/jc/generated | Output directory for meta.json and registry.ts |
| pathAlias | Record<string, string> | {} | Path alias mapping for registry imports |
| filteredProps | string[] | className, style, ref, key | Prop names to exclude from controls |
| filteredPropPatterns | string[] | [] | Regex patterns to exclude props (e.g. aria-.*) |
| tsConfigPath | string | tsconfig.json | Path to tsconfig for type resolution |
Array merging
Array fields use union merge with deduplication. Your values extend the defaults — they don't replace them.
ts
// Default excludeFiles: ['**/*.test.*', '**/*.stories.*']
defineConfig({
excludeFiles: ['**/*.spec.*'],
})
// Result: ['**/*.test.*', '**/*.stories.*', '**/*.spec.*']This applies to
componentFiles, excludeFiles, filteredProps, and filteredPropPatterns.Path aliases
If your project uses TypeScript path aliases, configure them so the generated registry produces correct import paths:
ts
defineConfig({
pathAlias: { '@/': 'src/' },
})
// Component at: src/components/ui/button.tsx
// Registry generates: import('@/components/ui/button')Prop filtering
Props like className and ref are filtered by default. Add more with exact names or regex patterns:
ts
defineConfig({
// Exact match — these specific prop names
filteredProps: ['testId', 'data-testid'],
// Pattern match — any prop matching these regexes
filteredPropPatterns: ['aria-.*', 'on[A-Z].*'],
})