This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-06
Channels
- # aleph (1)
- # announcements (2)
- # beginners (109)
- # calva (48)
- # cider (25)
- # clj-kondo (38)
- # cljdoc (13)
- # clojure (203)
- # clojure-europe (23)
- # clojure-gamedev (3)
- # clojure-nl (3)
- # clojure-uk (7)
- # conjure (2)
- # data-science (1)
- # datalog (2)
- # datomic (7)
- # deps-new (16)
- # depstar (2)
- # docker (2)
- # fulcro (67)
- # graalvm (58)
- # honeysql (16)
- # java (2)
- # jobs (2)
- # jobs-discuss (2)
- # kaocha (4)
- # lsp (82)
- # malli (23)
- # off-topic (35)
- # polylith (18)
- # practicalli (5)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (15)
- # sql (17)
- # timbre (1)
- # tools-deps (24)
- # vim (20)
- # xtdb (9)
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?
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 (https://github.com/athomasoriginal/create-reagent-app) 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 https://github.com/seancorfield/deps-new/issues/2 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
project
|____.gitignore
|____CHANGELOG.md
|____deps.edn
|____doc
| |____intro.md
|____LICENSE
|____pom.xml
|____README.md
|____resources
| |____.keep
|____src
| |____ws
| | |____cool
| | | |____api.clj
|____test
| |____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:
<groupId>net.clojars.company</groupId>
<artifactId>project</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>company/project</name>
...
<scm>
<url></url>
<connection>scm:git:</connection>
<developerConnection>scm:git:</developerConnection>
<tag>v0.1.0-SNAPSHOT</tag>
</scm>
Will do
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 https://github.com/seancorfield/deps-new/issues/3 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!