@chkit/plugin-codegen 0.1.0-beta.5 → 0.1.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/package.json +8 -2
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @chkit/plugin-codegen
|
|
2
|
+
|
|
3
|
+
Plugin to generate TypeScript row types and optional Zod schemas from your chkit schema definitions.
|
|
4
|
+
|
|
5
|
+
Part of the [chkit](https://github.com/obsessiondb/chkit) monorepo. This plugin extends the [`chkit`](https://www.npmjs.com/package/chkit) CLI with TypeScript code generation.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add -d @chkit/plugin-codegen
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Register the plugin in your config:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// clickhouse.config.ts
|
|
19
|
+
import { defineConfig } from '@chkit/core'
|
|
20
|
+
import { codegen } from '@chkit/plugin-codegen'
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
schema: './src/db/schema/**/*.ts',
|
|
24
|
+
outDir: './chkit',
|
|
25
|
+
plugins: [
|
|
26
|
+
codegen({
|
|
27
|
+
outFile: './src/generated/chkit-types.ts',
|
|
28
|
+
emitZod: false,
|
|
29
|
+
emitIngest: false,
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
clickhouse: {
|
|
33
|
+
url: process.env.CLICKHOUSE_URL ?? 'http://localhost:8123',
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then run:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
bunx chkit codegen
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Codegen also runs automatically after `chkit generate` when `runOnGenerate` is enabled (default).
|
|
45
|
+
|
|
46
|
+
## Documentation
|
|
47
|
+
|
|
48
|
+
See the [chkit documentation](https://chkit.obsessiondb.com).
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
[MIT](../../LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chkit/plugin-codegen",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.7",
|
|
4
|
+
"homepage": "https://chkit.obsessiondb.com",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/obsessiondb/chkit.git",
|
|
8
|
+
"directory": "packages/plugin-codegen"
|
|
9
|
+
},
|
|
4
10
|
"type": "module",
|
|
5
11
|
"main": "./dist/index.js",
|
|
6
12
|
"types": "./dist/index.d.ts",
|
|
@@ -23,7 +29,7 @@
|
|
|
23
29
|
"clean": "rm -rf dist"
|
|
24
30
|
},
|
|
25
31
|
"dependencies": {
|
|
26
|
-
"@chkit/core": "0.1.0-beta.
|
|
32
|
+
"@chkit/core": "0.1.0-beta.7",
|
|
27
33
|
"fast-glob": "^3.3.2"
|
|
28
34
|
},
|
|
29
35
|
"devDependencies": {
|