Fork me on GitHub

What would be your wish-list for the next version of clj-new? If you're writing templates, what features do you require and what aspects of today's template-writing is bothersome? If you're a user of clj-new for creating new projects, what do you like and what bothers you?

Russell Mull05:08:57

My wish may be impossible: a way to change my mind about template options after the fact. Consider Luminus: (yes, it's a lein template) There are a bunch of choices that you have to make up front, but have no way to re-visit or re-examine later. We should be able to instantiate the basic thing, and then later add the "reagent" option (or whatever). I could imagine that this would only work if you haven't changed too much of the template, already.


That's interesting. clj-new has the idea of "generators" to modify an existing project but it isn't very well fleshed-out...


I think modifying / integrating existing code whether it came from a template or not is going to be very awkward. However I do think if it’s not already supported a way of overlaying new files into the same project may be worth while. e.g. imagine you clj-new a minimal clojure project then later decide to add in your companies default circle ci template. Providing the file additions don’t intersect with code in the repo already that would be ok.


@U06HHF230 That's good feedback. I currently have it written to not overwrite an existing project, unless you say :overwrite true but, right now, that deletes any existing target directory first. I'll create an issue to rethink that.


The "2.0" version can run as a "tool" and can find a template on the classpath (so you can point it at a directory with :local/root or a git repo since you would just use the CLI to set up the "context" when you run clojure ... -Tnew2 ... with -Sdeps or -A:aliases in there). A template is a folder with template.edn in it and folders containing the template files that are copied in phases with substitutions.


I built my template for front end apps a while ago ( and haven’t revisited clj-new itself to see if the following was actually provided, but: Request: flexible approach to naming the app/lib folder/project/files/ns. Right now, clj-new does company/project and i’ve felt that how that manifests into a folder/file/ns structure is not as flexible or intuitive as I might like. Aside from the above, I will look into my template and see if there is anything I would have liked.


The company/project approach is intended to encourage users to create namespaces that won't collide with other people's code. I created if you'd like to elaborate on what you might want? You can override substitution keys easily via the command-line, and this new version has the idea of a "top" namespace and a "main" namespace so you can do something like this:

clojure -Tdeps-new create :template app :name company/project :top ws :main cool.api
and your tree will look like this:
(! 937)-> tree project
| |
| |____.keep
| |____ws
| | |____cool
| | | |____api.clj
| |____ws
| | |____cool
| | | |____api_test.clj
So the project name is used for group/artifact and for the scm stuff in pom.xml but not for the file structure:


An approach to testing, even just a few basic utilities to spin up a repl of some kind and run some functions, testing that they don't explode would be great.


Right now I have a bash script that generates a few variants of the project and then I manually check that they do sensible things (like that (dev) works, or that a server starts)


@dominicm I'd be interested to hear more about that -- could you elaborate in for me?


@seancorfield Sure. Anything you're interested in particularly?


@seancorfield I linked my scripts and talked a little about what the difficulties I run into are. If there's more lemme know and I'll happily share.


I posted a Q in that issue and will likely continue the discussion there as needed. Thank you!