https://github.com/practicalli/project-templates/ now provides a :component option to the practicalli/service template to create a Clojure web service with either :donut or :integrant to manage system components & REPL workflow.
Without :component specified on the command line, an atom is used to hold the http-server instance to manage restart in a repl workflow, with clojure.tools.namespace used to reload changed namespaces on restart.
The option implementation is very simple
• the default declarative rule set, :transform , is defined in template.edn file for the service template (atom repl workflow)
• a specific declarative rule set is defined for each of the options, used as a complete replacement for the original rule set in template.edn
• different implementation of source and configuration files are created, named with the option they are related too
• template-edn function returns the matching rule set using a cond to check for :component key and use it's value to check for donut or integrant
I assume the implementation could be optimized, although working through the variations as separate files and rule sets allowed an opportunity to improve the design of each option and align the design decisions as much as possible.
Areas to investigate include
• merging rule sets, so options only define differences
• re-writing source and config files to reduce duplication and only define changes
This sounds very cool! I'll try to take a look this weekend. There's some irony that :component doesn't have a Component option:joy: Maybe I'll take a run at that and send a PR.
😄 I've only used integrant and donut for projects, never got to use the SS Component library and Component REPL yet. I am sure there are a few other component style libraries, but a few choices should be enough initially
There are still many other templates I'd like to create.