For a while (almost immediately after it was released) I’ve been using
dhall to-directory-tree for the purposes of abstracting away CI boilerplate (travis, github-actions, Dockerfile, cloudbuild, etc).
You know, stuff that’s usually copy/pasted around and modified, isn’t always trivial to get right, and is generally a pain to maintain when you have more than a handful of repositories that are all more-or-less built in the same way.
I recently went about trying to merge my own WIP github-actions schemas with https://github.com/regadas/github-actions-dhall, and hit a snag: to use
dhall-to-directory-tree, you can’t just output records, you need to output
JSON.Type. Which means you need a flurry of
*toJSON functions taking in your dhall types and generating JSON. And those can cause some unfortunate performance issues.
As I was adjusting my existing
toJSON functions to fit the different schema I decided maybe it’s just not worth the hassle at this point just so I can use
dhall to-directory-tree - it’d be easier for me to replace that, and lean on
dhall-to-json for automating the JSON creation.
So I wrote a ruby wrapper to basically take the output of
dhall-to-json for a simple schema, and do what
dhall-to-directory-tree does but with some extra bells and whistles (like installing symlinks to the generated files, and allowing executable files).
So here it is! dhall-render. It’s still a work in progress, but I’m intending to adopt it to replace my own use of
If the name
dhall-render is a bit too canonical-sounding for such a minor project I’m happy to take suggestions. Ultimately I’d quite like to see these features integrated into
dhall to-directory-tree itself, though maybe some of them are a bit too opinionated (particularly the symlink generation).