Funny that you mention that, that's exactly what I've been thinking of, have a base template, and then be able to add things to it afterwards. So we would have Chestnut, the leiningen template, and Chestnut the leiningen plugin
lein new chestnut my-project
lein chestnut add reagent
I already experimented a bit with this approach a year ago based on rewrite-clj, my doodling can be found here: https://github.com/plexus/seed
rewrite-clj is great, but it's rather low level, so the idea with seed is to add semantic operations like
(add-project-dependency '[foo.bar "1.0.1"])
(append-to-method-body 'my-project.core/main '(foo 123))
It has irked me from the beginning that we have this (mostly) homoiconic language, but have to resort to text-based templating to generate code.
I'll toy with this a bit more the coming weeks. This would offer a whole new perspective since
- we can delegate feature flags to these "recipes"
- there's no added complexity to the base template, these "recipes" are completely orthogonal to the main template
- it's possible to provide transformations that work against existing projects. This will not always work, but it's still pretty cool and often requested.
- in case a recipe no longer cleanly applies, you can pretty much read it like a tutorial and apply the changes yourself.