Skip to main content

generate

Usage: chr generate [OPTIONS] COMMAND [ARGS]...

Generate client stubs and documentation for a rell project

╭─ Options ───────────────────────────────────────────────────────────────────╮
│ -h, --help Show this message and exit
╰─────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────╮
│ client-stubs Generates client code for a rell dapp │
│ graph Generates entity relation graphs in mermaid format
│ docs-site Generate a documentation site for a dapp ontology │
╰─────────────────────────────────────────────────────────────────────────────╯

generate client-stubs

Usage: chr generate client-stubs [<options>]

Generates client code for a rell dapp

Configuration Properties:
-s, --settings=<settings> Alternate path for project settings file

kotlin:
--package=<text> Name of package

Options:
-m, --module=<text> Explicitly set which modules to generate code for.
Separate modules with ','
-d, --target=<path> Directory to generate code in
--kotlin, --typescript, --javascript
Language to generate client for
-h, --help Show this message and exit

The client-stubs command (chr generate client-stubs) generates code that can be used to communicate with the Rell backend.

generate graph

Usage: chr generate graph [<options>]

Generates entity relation graphs in mermaid format

Configuration Properties:
-s, --settings=<settings> Alternate path for project settings file

Options:
-m, --module=<text> Explicitly set which modules to generate code for.
Separate modules with ','
-d, --target=<path> Directory to generate code in
--mdx Surround with mdx tags
--entity-relation / --class-diagram
Presented as entity relation diagram or class diagram
-h, --help Show this message and exit

The graph command (chr generate graph) generates mermaid graphs, helping to visualize the entity relations of a dapp.

Using the --entity-relation/--class-diagram options, you can decide whether to present each entity as a class or a database entity.

If the graph is intended to be shown in a markdown file, you can use the --mdx flag to wrap the generated code in a code block. This is useful, for example, when including the graph in a docasaurus site or Github Wiki.

generate docs-site

Usage: chr generate docs-site [<options>]

Generate a documentation site for a dapp ontology

Configuration Properties:
-s, --settings=<settings> Alternate path for project settings file

Options:
-d, --target=<path> Directory to generate code in
-i, --include=<text> Libs to actively include in the navigation of the
generated docs site, by default all are excluded. To
include a library, the full identifier must be
specified as an example for the library foo, the
inclusion of it would be lib.foo
-h, --help Show this message and exit

The generate docs-site command (chr generate docs-site) generates a complete site that documents the API of your dapp.

Configure the output by adding a docs section to chromia.yml:

chromia.yml
docs:
title: My Rell Dapp
footerMessage: © 2024 Copyright MyCompany
customStyleSheets:
- my-styles.css
customAssets:
- my-logo.png
additionalContent:
- my-doc.md
sourceLink:
remoteUrl: https://github.com/my-org/my-repo/blob/main/src
remoteLineSuffix: "#L"

For more information on the configuration properties, see project config.

The generated site contains JS code to provide a navigation bar. Although you can open the index.html page in your browser, the best experience is achieved by hosting the site on a web server.

This can be done using docker:

docker run -dit --name my-docs-site -p 8080:80 -v "$PWD":/usr/local/apache2/htdocs/ httpd:2.4

Or, if you already have a node-js project:

npm install http-server
npx http-server