Configuration (kanjou.config.ts)
Kanjou can be configured using a kanjou.config.ts (or .js, .mts, etc.) file in the root of your project.
defineConfig
You can use the defineConfig helper to get autocompletion and type checking for your configuration:
typescript
import { defineConfig } from '@kanjou/config'
export default defineConfig({
localesDir: './src/locales',
baseLocale: 'en',
})Options
localesDir
- Type:
string - Description: The path to the directory containing your source JSON locale files.
baseLocale
- Type:
string - Description: The name of your primary/base locale (e.g.
'en'). Used as the source of truth for generating types.
prettier
- Type:
PrettierOptions - Description: Prettier formatting options to apply to generated files (like
.d.tsor compiled.js).
dts
- Type:
DtsOptions - Description: Configuration for generated TypeScript definitions.
DtsOptions properties:
locales(boolean): Whether to generatelocales.kanjou.d.ts.virtual(boolean): Whether to generatevirtual.kanjou.d.ts.outDir(string): Base directory for generated types.localesPath(string): Explicit path forlocales.kanjou.d.ts.virtualPath(string): Explicit path forvirtual.kanjou.d.ts.
compile
- Type:
CompileOptions - Description: Defaults for the
kanjou compileCLI command.
CompileOptions properties:
outDir(string): Default output directory.extension('js' | 'json'): Output format extension.