Skip to content

Commit 5ce8936

Browse files
committed
Update CONTRIBUTING
1 parent 0417091 commit 5ce8936

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

CONTRIBUTING.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,14 @@ bytecode to compile to JavaScript and is part of the bigger OCaml ecosystem. Bef
203203
tools (requires [`opam`](https://opam.ocaml.org/doc/Install.html) to be installed):
204204

205205
```
206+
# Create the right switch, if not created yet (first install)
207+
opam switch create 4.06.1
208+
206209
# Makes sure to be on the right switch
207210
opam switch 4.06.1
208211
eval `opam config env`
209212
210-
opam install js_of_ocaml.3.4.0
213+
opam install js_of_ocaml.3.5.1
211214
```
212215

213216
### Building the bundle
@@ -231,7 +234,18 @@ BS_PLAYGROUND=../playground node scripts/repl.js
231234
- `playground/exports.js` -> This is the BuckleScript compiler, which binds the BuckleScript API to the `window` object
232235
- `playground/stdlib/*.js` -> All the BuckleScript runtime files
233236

234-
You can now use the `exports.js` file either directly by using a `<script src="/path/to/exports.js"/>` inside a html file, or use a bundler infrastructure to optimize it.
237+
You can now use the `exports.js` file either directly by using a `<script src="/path/to/exports.js"/>` inside a html file, use a browser bundler infrastructure to optimize it, or you can even use it with `nodejs`:
238+
239+
```
240+
$ node
241+
> require("./exports.js");
242+
undefined
243+
> let compile_result = ocaml.compile(`Js.log Sys.ocaml_version`); // You can change the code here
244+
undefined
245+
> eval(compile_result);
246+
4.06.2+BS
247+
undefined
248+
```
235249

236250
### Playground JS bundle API
237251

@@ -292,9 +306,10 @@ implementation. JSOO will pick up those files to encode them into the `exports.j
292306
bundle.
293307

294308
For any other dependency needed in the playground, such as `ReasonReact`, you
295-
will be required to serialize your `.cmi` / `.cmt` files accordingly so that
296-
JSOO's `ocaml.load` function can load the data. Right now we don't provide any
297-
instructions inside here yet, but [here's how the official ReasonML playground did
309+
will be required to serialize your `.cmi` / `.cmt` files accordingly from binary
310+
to hex encoded strings so that BS Playground's `ocaml.load` function can
311+
load the data. Right now we don't provide any instructions inside here yet, but
312+
[here's how the official ReasonML playground did
298313
it](https://github.com/reasonml/reasonml.github.io/blob/source/website/setupSomeArtifacts.js#L65).
299314

300315

0 commit comments

Comments
 (0)