dmy / elm-doc-preview

Elm offline documentation previewer
https://www.npmjs.com/package/elm-doc-preview
Other
128 stars 15 forks source link

Add a CLI option to check whether application documentation is correct #31

Closed rjdellecese closed 4 years ago

rjdellecese commented 4 years ago

I'm using elm-doc-preview to generate application documentation, and would love a way to verify that my documentation is valid in CI. Just elm make --docs (per https://github.com/dmy/elm-doc-preview/issues/23 and https://github.com/dmy/elm-doc-preview/issues/21) doesn't seem to work to verify documentation correctness (or even to generate docs at all), which I assume is expected, given that my Elm code is an app and not a package.

Also, thank you for this awesome package!

rlefevre commented 4 years ago

I guess I will add an exit status for https://github.com/dmy/elm-doc-preview/issues/30, which should solve your issue too.

rjdellecese commented 4 years ago

I think that it would! Sorry, it seems I overlooked that that issue already proposes a solution to this.

rjdellecese commented 4 years ago

I guess the only thing I'd add, then, is that it might be nice to have the option to both receive an exit code and also not generate a docs.json file. However, I think that either way, the exit code is the important bit.

rlefevre commented 4 years ago

Note that until then, you can make your own javascript script that would use elm-doc-preview API to start a server, download the docs.json from it using an HTTP client library, and exit with an error if the download failed or the docs were empty.

rlefevre commented 4 years ago

You can use elm-doc-preview --output docs.json (or edp -o docs.json) in version 4.0.0 to generate the documentation and exit with a status code.

elm-doc-preview --output /dev/null can be used to check the documentation generation without writing an actual file. This should work on all OS, even if /dev/null does not actually exist (like elm make --output /dev/null).