-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReScriptify user-facing Js / Belt modules and API doc generation #5459
Comments
This is mentioned in the changelog for 10.0.0-beta.3; has this already been completed? |
No, the doc headers have been synced up, but there's still no rescriptified files yet. I got this as a pending local change, but still need to finalize it. |
Alright, due to time constraints I am not able to follow up on this in a timely manner, so I talked to @cristianoc to write down what's needed to make this work. Step 1 (ReScriptify JS/Belt with our new doc header syntax):First we need to actually convert the relevant belt / js files. You can find the script here: Generally the script actually works. One needs to make sure to build the latest Main work here is to run the script (maybe start with a single file and comment out everything else), and see if the conversion looks good (the code should look fine, and especially the new ReScript doc headers should be correctly placed with Step 2 - The Doc Extraction Script:I've got a working branch on the syntax repo called experimental-docgen, that contains a simple OCaml program to extract The script should generate a pretty complete JSON file that contains all the doc header / function and value signatures needed to generate proper markdown files for our website. Step 3 - Generate the API docs for rescript-lang.orgNow that we are able to generate JSON files for each relevant JS / Belt interface file, we should now have a look at the rescript-lang api docs structure (as listed here https://github.com/rescript-association/rescript-lang.org/tree/master/pages/docs/manual/latest/api) and try to replicate the markdown output with our new JSON input. Depending on how well this works, we may not even need to generate sidebar tocs, since we currently generate the TOCs from our markdown structures. Step 4 - AutomateEverything put together, we should create a script that will automatically generate our api markdown files by pointing it to a specific rescript installation. That way it should be a matter of pressing a button to release new API docs. |
I did the conversion of external length: 'a t -> int = "%array_length"
(** return the size of the array
```res example
// Returns 1
Belt.Array.length(["test"])
```
*) /** return the size of the array
```res example
// Returns 1
Belt.Array.length([\"test\"])
```
*/
external length: t<'a> => int = "%array_length" |
To test this. First make sure the libs are up to date in the local compiler build:
Then install the locally built compiler into a project:
Then open up the editor and see how the hover looks like. |
For generated files, will probably need to change the generator so it works with |
I'm using the master branch build.
|
Need to replace |
Try: |
I dit it. |
Almost done, only js.ml and js_math.ml remaining in .ml syntax now because of some unexpected changes to release.ninja when converting those. |
@ryyppy @cristianoc Anything still open here? |
As a follow up to #5361, we want to convert all
ml[i]
files to `res[i].Master already comes with the new
/** */
sugar, so we won't make any trade-offs in readability.There are some files that can't be converted right away (see #5458), but we'll just tackle this in a separate task.
The text was updated successfully, but these errors were encountered: