Skip to content

Commit 76aa279

Browse files
committed
Update README.md
1 parent 894ae00 commit 76aa279

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,23 @@ This package generates JavaScript clients from your Codama IDLs. The generated c
1515
pnpm install @codama/renderers-js
1616
```
1717

18-
> [!NOTE]
19-
> This package is **not** included in the main [`codama`](../library) package.
20-
>
21-
> However, note that the [`renderers`](../renderers) package re-exports the `renderVisitor` function of this package as `renderJavaScriptVisitor`.
22-
2318
## Usage
2419

25-
Once you have a Codama IDL, you can use the `renderVisitor` of this package to generate JavaScript clients. You will need to provide the base directory where the generated files will be saved and an optional set of options to customize the output.
26-
27-
```ts
28-
// node ./codama.mjs
29-
import { renderVisitor } from '@codama/renderers-js';
30-
31-
const pathToGeneratedFolder = path.join(__dirname, 'clients', 'js', 'src', 'generated');
32-
const options = {}; // See below.
33-
codama.accept(renderVisitor(pathToGeneratedFolder, options));
20+
Add the following script to your Codama configuration file.
21+
22+
```json
23+
{
24+
"scripts": {
25+
"js": {
26+
"from": "@codama/renderers-js",
27+
"args": ["clients/js/src/generated"]
28+
}
29+
}
30+
}
3431
```
3532

33+
An object can be passed as a second argument to further configure the renderer. See the [Options](#options) section below for more details.
34+
3635
## Options
3736

3837
The `renderVisitor` accepts the following options.

0 commit comments

Comments
 (0)