Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

@chkit/plugin-codegen

Plugin to generate TypeScript row types and optional Zod schemas from your chkit schema definitions.

Part of the chkit monorepo. This plugin extends the chkit CLI with TypeScript code generation.

Install

bun add -d @chkit/plugin-codegen

Usage

Register the plugin in your config:

// clickhouse.config.ts
import { defineConfig } from '@chkit/core'
import { codegen } from '@chkit/plugin-codegen'

export default defineConfig({
  schema: './src/db/schema/**/*.ts',
  outDir: './chkit',
  plugins: [
    codegen({
      outFile: './src/generated/chkit-types.ts',
      emitZod: false,
      emitIngest: false,
    }),
  ],
  clickhouse: {
    url: process.env.CLICKHOUSE_URL ?? 'http://localhost:8123',
  },
})

Then run:

bunx chkit codegen

Codegen also runs automatically after chkit generate when runOnGenerate is enabled (default).

Documentation

See the chkit documentation.

License

MIT