During combined UI and DAML model development I often have to recompile DAML, regenerate the Typescript libraries and restart the sandbox. By far the most time is spent compiling the 20-odd Typescript projects generated from the codegen. Is there any trick or setting in tsconfig.json that I can use to speed up things? Maybe disabling some optimization or similar. The whole cycle is around 3mins long, which is not optimal for rapid development.
For everyone’s benefit, here is my handy Makefile, which at least makes invoking the cycle just a make:
The problem seems to be that the tsconfig.json is generated as well, so it would need to be an option during code generation. @shaynefletcher maybe you have a view if that would yield a benefit. The other option would be not to regenerate the dependencies that didn’t change, such that if I change my own model only that would be regenerated. This would considerably improve the workflow.
Making daml codegen js only regenerate the packages that have changed is definitely something that we want to do! I don’t have a great solution in the meantime sadly.
After you’ve run yarn workspaces run build once, you’ll only need to recompile the one project that contains the generated code from your own DAML models. This is my new Makefile which works nicely:
You’ll need to rerun yarn workspaces run build only when you upgrade the SDK version as then the generated packages for the standard libraries will be different.
I believe this approach no longer works in the release candidate for 1.0 since daml2ts now produces JavaScript + TypeScript typings which means that it takes care of the compilation as part of running daml codegen ts.
I couldn’t accept the fact that I’ve crushed your dreams so I’ve merged a PR yesterday that speeds up the JS codegen significantly (it now takes ~0.5s on the GSG as opposed to > 20s)
Exactly we generate JS + typescript typings so from a user perspective you get the same output but we don’t have to run the typescript compiler which is super slow.