krzysztofzablocki / Sourcery

Meta-programming for Swift, stop writing boilerplate code.
http://merowing.info
MIT License
7.59k stars 605 forks source link

How should we approach sharing generic templates with the community? #10

Closed ilyapuchka closed 7 years ago

ilyapuchka commented 7 years ago

We can expect more useful templates to pop up in future and we even might to create few to drive and test some new features in generator or even just for documentation purposes. It would be cool if there will be a way to share these templates in some known place.

So what then will be the strategy to distribute and share such templates? Subfolder in root of this repo? Or maybe through separate repository? Via subspec (I don't remember accurately if CocoaPods supports repos without targets)? Any other options?

krzysztofzablocki commented 7 years ago

Was about to write about this, you beat me to the punch. I think a reasonable approach would be to:

Makes sense?

krzysztofzablocki commented 7 years ago

I updated our readme and introduced some example templates which we might tweak, once we approach 1.0 release we can embeed those that are the most generic, take a look at #123

bejar37 commented 7 years ago

I think it would be really interesting to have a project that people can pull in as a dependency (like SwiftGen, via Cocoapods or Carthage) which provides some basic templates for protocols like AutoEquatable or AutoHashable. Do you think this is feasible? Another future direction for that would be providing a way for each user of that repository to add their own templates that are less widely applicable (maybe JSON parsing, lenses, etc.).

Basically, I think it would be cool for the example templates in #123 to be usable for an end-user. I'm not sure if that belongs in Sourcery itself, or in a project which has Sourcery as a dependency.

krzysztofzablocki commented 7 years ago

@bejar37 that's the idea, I made those files separate so we can bring them in as embedded templates later on, I didn't bundle them yet because we are far from 1.0 and a lot of changes are happening

bejar37 commented 7 years ago

Oops, I see that I hadn't read your previous comment throughly @krzysztofzablocki . Sorry!

krzysztofzablocki commented 7 years ago

Actually, lets embeed them in binary distrubtion, people can choose to use them or not :)