Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support loading template files through multiple deps #34

Closed
rads opened this issue Aug 9, 2022 · 3 comments
Closed

Support loading template files through multiple deps #34

rads opened this issue Aug 9, 2022 · 3 comments

Comments

@rads
Copy link

rads commented Aug 9, 2022

I ran into an issue when trying to add deps-new to Kit. The idea is to share the same base files so we can support both deps-new and clj-new with minimal duplication. I started off planning to do this:

  • base-template: shared template files
  • deps-template: new deps-new implementation
  • lein-template: existing clj-new implementation

In this scenario the base-template would be shared by both deps-template and lein-template. The deps-template would just have a template.edn file and the processing functions to implement the logic on top of the base files.

However, when I tried to implement this, I ran into a limitation with deps-new: it only supports one root directory per template, so any dependencies were not being included as part of the template, even with the same resource path (resources/io/github/kit_clj/kit). For now I'm just going to have lein-template depend directly on deps-template since clj-new doesn't have the same restriction.

Would it make sense to support multiple roots for a single template? Is there a better workaround I'm not thinking of? Maybe this is too specific to Kit and not worth supporting in general?

(This is kind of related to #27 but I think this problem is more narrow in scope. For splitting templates into multiple libraries, simply merging the roots together could be an option without having composition of templates.)

@rads rads changed the title Support loading template files through deps Support loading template files through multiple deps Aug 9, 2022
@seancorfield
Copy link
Owner

root is only special in that it's a default location that is copied to the "root" of the new project. You can specify any number of additional folders and also have them copy to that project "root" if that's what you need.

As for sharing a template between deps-new and lein-template -- someone has already done that... I can't remember who right now or for which project but I'll try to dig up that conversation.

@seancorfield
Copy link
Owner

@rads
Copy link
Author

rads commented Aug 9, 2022

Cool, thanks! I'll take a look at that example. Feel free to close this issue in the mean time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants