On Saturday, 28 April 2018 at 15:11:31 UTC, FreeSlave wrote:
On Friday, 27 April 2018 at 12:37:04 UTC, Basile B. wrote:
On Thursday, 26 April 2018 at 18:16:01 UTC, FreeSlave wrote:
Most dub packages are libraries and should provide runnable
examples.
What's the current idiomatic way to add examples?
IMO the most simple way (and the best too) is to put single
file packages in the example folder, so that an example can
just be run with DUB like that:
`dub example1.d`.
Other good point is that you can specify that the dependency
to the main package is local, like here:
https://github.com/BBasile/kheops/blob/master/runnable/actions_window.d#L5.
And finally the example folder is neither polluted with
sub-folders nor with sub.selection JSON, FTW.
That's probably the best option. No need for using subPackages,
nor for creating dub.json per every example. And no --root
option is needed.
The difference is however with most vibe.d examples, they're each
separate applications.