Fork me on GitHub
#deps-new
<
2022-03-08
>
Ben Sless06:03:57

Is it possible to create a new template which slightly modifies an existing template? Let's say I just want to make a few tweaks to the lib template. What's the best way to go about it?

seancorfield17:03:52

@ben.sless I think you could have a template.edn that specified relative paths to folders that match the built-in lib template (since it would be on the classpath) and you could specify one or both of the two transformation functions that made the tweaks you need? Depends on what those tweaks are, I guess.

Ben Sless17:03:49

Thank you. What I want to do is override a few fields by default in the pom, add another file, add add some text in the README. I think the data-fn lets me handle the first, not sure about the rest

seancorfield18:03:23

In theory, the template-fn would let you read some existing files, write modified versions to a temporary location, and return an updated template.edn data structure that would point to those new temporary files. I don't know that anyone has actually tried that yet... but if you run into limitations/bugs trying to do it, create issues and I'll address them because that is supposed to work.

seancorfield18:03:07

(side note: if you do that in the next two weeks, don't expect quick responses -- I'll be traveling and mostly off the grid, but will address them when I return... just to set expectations)

Ben Sless18:03:14

no problem. I think a slightly more general feature which could be cool is "derivative templates"

Ben Sless18:03:18

Instead of writing a template from scratch or doing back flips with temporary files, to be able to define a template as a variation on another template, sort of like immutable hash maps

seancorfield18:03:17

Yup. That does sound like a nice enhancement. No idea how that might work (given the infrastructure on which deps-new is built) but feel free to create an issue with some brainstorming ideas if you have them...

👍 1
Ben Sless05:02:47

Hey Sean, checking in if there's been any progress on this front

seancorfield05:02:37

Nope. Waiting for folks to propose something since this isn't a problem I have so I don't know what a solution should look like.

👍 2