@codama/renderers-js 1.4.0 → 1.4.2

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 CHANGED
@@ -15,24 +15,23 @@ This package generates JavaScript clients from your Codama IDLs. The generated c
15
15
  pnpm install @codama/renderers-js
16
16
  ```
17
17
 
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
-
23
18
  ## Usage
24
19
 
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
+ }
34
31
  ```
35
32
 
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
+
36
35
  ## Options
37
36
 
38
37
  The `renderVisitor` accepts the following options.
@@ -817,7 +817,7 @@ function getDiscriminatorConditionFragment(scope) {
817
817
  }),
818
818
  (c) => c.join(" && ")
819
819
  ),
820
- (f) => (0, import_renderers_core2.mapFragmentContent)(f, (c) => `if (${c}) { ${scope.ifTrue}; }`)
820
+ (f) => (0, import_renderers_core2.mapFragmentContent)(f, (c) => `if (${c}) { ${scope.ifTrue} }`)
821
821
  );
822
822
  }
823
823
  function getSizeConditionFragment(discriminator, scope) {