Good question, I'd like to hear what other people do as well. Just to add two other options to the mix:
5. Link to an example that uses the package in Ellie (https://ellie-app.com/) 6. Deploy an example to the Github project page (https://username.github.io/package/ ) 5. Is quick and painless assuming you want to use a published version of the package. 6. Is a bit of a pain to set up, but it can be scripted. I guess this is "on top of" the options you list below, since you'll still have to decide how you want to build the example. I tend towards (3), and "cheat" and access src/ , and just take care not to access internal modules, I have never found that a problem. On a somewhat related note, it would be nice to have something like bl.ocks.org for displaying examples together with code from Github gists. On Sunday, May 7, 2017 at 11:58:26 PM UTC-4, Matthieu Pizenberg wrote: > > Exploring a bit the packages repository, I've come accross the following > options: > > 1. no examples/ dir, all in readme and documentation. > (elm-array-exploration, ...) > 2. examples/ dir with nothing more than `.elm` files (elm-decode-pipeline, > elm-monocle, ...) > 3. examples/ dir with an `elm-package.json` file (elm-transducers, ...) > 4. examples/ dir with a `package.json` node builder (elm-kinto, ...) > > I personally have a mix of (2) and (3). However I feel like they all have > issues. > > 1. Sometimes, having a "ready to build" example is useful. > 2. It relies on building from the root directory of the package (where the > `elm-package.json` file lives). It also means that the example file can > "cheat" by accessing non exposed modules. > 3. If you add your `src/` dir in the json, then you can also "cheat" like > in 2. If you do not, and you use your package as if it was loaded from elm > packages, then you cannot verify that your latest modifications (not pushed > yet) are working with your examples. > 4. Well, it's a bit too heavy of a machinery most of the times. Plus it > also requires an `elm-package.json` file anyway so the same issues as (2) > and (3) apply. > > *Do you think there is a best practice? Are there alternatives to those > four?* > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
