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

OptionTypeDefaultDescription
componentFilesstring[]src/components/ui/**/*.tsxGlob patterns for component discovery
excludeFilesstring[]**/*.test.*, **/*.stories.*Glob patterns to skip
outputDirstringsrc/jc/generatedOutput directory for meta.json and registry.ts
pathAliasRecord<string, string>{}Path alias mapping for registry imports
filteredPropsstring[]className, style, ref, keyProp names to exclude from controls
filteredPropPatternsstring[][]Regex patterns to exclude props (e.g. aria-.*)
tsConfigPathstringtsconfig.jsonPath 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].*'],
})