Previous Entry Share Next Entry
Packaging examples with dub

In my previous post Impressions of dub, I was reflecting on using dub for the first time (which happend to be for a new library). Thanks to Dicebot I have update the repository to follow the recommended approach.

The examples folder holds minature packages, each having their own package.json and source directory. Now when wanting to build the example, just navigate to the example and call dub.

|-- examples
|     |-- dump
|     |    |-- source
|     |    |    |-- app.d
|     |    |-- package.json
+-- source
|-- package.json

The package.json file for each example will then have a dependency on the main library. A relative path is provided in the dependency.

    "dependencies": {
        "libosm": {"version": "~master", "path": "../../"}

It is a ridged structure, but probably for the better, examples can get complex too.


Log in