Skip to content

Commit 25a38af

Browse files
committed
chore: add node exec example to code generation docs
1 parent a1fd366 commit 25a38af

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/rtk-query/usage/code-generation.mdx

+11
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ const api = await generateEndpoints({
8484
})
8585
```
8686

87+
#### With Node.js Child process
88+
89+
```ts no-transpile title="bin/openapi-codegen.ts"
90+
import { exec } from 'node:child_process'
91+
92+
const cliPath = require.resolve('@rtk-query/codegen-openapi/cli')
93+
94+
// you can also use esbuild-runner (esr) or ts-node instead of tsx
95+
exec(`tsx ${cliPath} config.ts`)
96+
```
97+
8798
### Config file options
8899

89100
#### Simple usage

0 commit comments

Comments
 (0)