ocamlreasonbucklescript

Documentation generation for BuckleScript project


Is there any way to generate code documentation for BuckleScript or Reason? I've tried using ocamldoc, but I don't know how to include node package dependencies automatically.


Solution

  • There isn't an automatic resolution yet for node packages. You can manually specify each dependent package in the ocamldoc command, e.g.:

    ocamldoc -html -d doc -I node_modules/bs-webapi/lib/ocaml -I node_modules/bs-fetch/lib/ocaml -I node_modules/bs-platform/lib/ocaml src/YourModule.re
    

    The directory includes are fairly predictable, you just have to point at the lib/ocaml directories in each package, ocamldoc will find their compiled .cmi files and pull in the required type information from there.

    This also means that you'll first need to have done bsb -make-world, to compile all those .cmis.