RobLoach / node-raylib

Node.js bindings for Raylib
https://robloach.github.io/node-raylib/
Other
233 stars 20 forks source link

Add API Documentation #146

Closed RobLoach closed 2 years ago

RobLoach commented 2 years ago

This adds JSDocs, along with generates markdown based on the docs: https://github.com/RobLoach/node-raylib/blob/api-docs/docs/API.md

twuky commented 2 years ago

This looks like its missing a few things. It only adds a few of the classes / struct types (only the ones used as function arguments, not any of the return types). Technically they aren't classes either - there's no way to instantiate them with new. The manually added functions for shaders don't have parameters on them either.

I think it might be more accurate if the docs were able to use the generated typescript definitons instead of new docstrings, since that file defines all the raylib structs and consts as well.

It'd also be nice to have it generate as some sort of jekyll template or website instead of a markdown file maybe? So it might be worth looking into a different utility that can generate the docs as html?

RobLoach commented 2 years ago

This looks like its missing a few things. It only adds a few of the classes / struct types (only the ones used as function arguments, not any of the return types). Technically they aren't classes either - there's no way to instantiate them with new. The manually added functions for shaders don't have parameters on them either.

Good catch. Removed the @typedef ones. Would be good to have the objects defined, but I think having the functions as a first pass is our best bet.

It'd also be nice to have it generate as some sort of jekyll template or website instead of a markdown file maybe? So it might be worth looking into a different utility that can generate the docs as html?

That would be really cool. I think GitHub Pages could help us out with that: https://robloach.github.io/node-raylib/

I think it might be more accurate if the docs were able to use the generated typescript definitons instead of new docstrings, since that file defines all the raylib structs and consts as well.

Could see having both. Not that much more code in the generator. Mostly just forming the JSDocs. The type-hinting does bring writing JavaScript more inline with what we already have with TypeScript...

Screenshot at 2022-05-11 20-30-45