878429e3bf
copyright update 2020 * update template * run script: `dade-copyright-headers update .` * update script * manual adjustments * exclude frozen proto files from further header checks (by adding NO_AUTO_COPYRIGHT files) |
||
---|---|---|
.. | ||
src | ||
tests | ||
BUILD.bazel | ||
README.md |
daml2ts
This is a very early version of a code generator for a TypeScript interface to a DAML package. Its shortcomings are documented in this Github issue. It is not yet shipped with the SDK. To run it, you must execute
$ bazel run //:daml2ts
Usage: daml2ts DAR-FILE -o DIR
Generate TypeScript bindings from a DAR
somewhere in this repository. The DAR-FILE
is the DAR for which you want to
generate the TypeScript interface. daml2ts
will generate interfaces for
all DALFs in that DAR. The output will be written into the directory DIR
you specify via the -o
option.
The @digitalasset/daml-json-types
package referenced by the generated
code has not yet been published. You can find it in the
tests/ts/daml-json-types
directory.
Currently, the generated interfaces are tailored towards the
ledger.ts
module of DAVL.
How to develop daml2ts
The full test suite is started via
bazel test //language-support/ts/codegen/tests/...
Unfortunately, this is a bit slow and not suitable for repeated running during development. To make things more responsive, you can run the following trinity of shell scripts, all in parallel and each in its own terminal:
./tests/watch-damlc.sh
: Build a DAR out of the.daml
files in./tests/daml
whenever they change../tests/watch-daml2ts.sh
: Re-interpretdaml2ts
and run it on the DAR produced by./tests/watch-damlc.sh
../tests/watch-yarn
: Build all the TypeScript libraries in dependency order and run the TypeScript compiler in watch mode on the TypeScript generated by./tests/watch-daml2ts.sh
. This script does not recompile any changes made to the TypeScript librariesdaml-json-types
ordamnl-ledger-fetch
. Changes to these libraries must be manually recompiled usingyarn build
in the respective directoties. (You can also useyarn build:watch
to run the TypeScript compiler in watch mode.)
All these steps only check that everything compiles. They do not run any tests. To run the tests suite, you need to issue the command above.