Idiomatic way to add examples to dub package

Basile B. b2.temp at gmx.com
Fri Apr 27 12:37:04 UTC 2018


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.


More information about the Digitalmars-d-learn mailing list