Skip to content

Commit 611134b

Browse files
committed
CONTRIBUTING: Make Reason upgrade instructions independent from Playground
1 parent 5936cd8 commit 611134b

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

CONTRIBUTING.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,14 @@ load the data. Right now we don't provide any instructions inside here yet, but
312312
[here's how the official ReasonML playground did
313313
it](https://github.com/reasonml/reasonml.github.io/blob/source/website/setupSomeArtifacts.js#L65).
314314

315-
### Upgrading the Reason version
315+
## Upgrading the Reason version within BuckleScript
316316

317-
The playground is shipping with a specific Reason syntax version, which currently needs to be updated manually once in a while.
318-
Paths to relevant files:
317+
Each BuckleScript release is coupled to a specific Reason syntax version, which currently needs to be updated manually once in a while.
319318

320-
- `jscomp/main/refmt_api.ml`: Contains the programmatic interface for the refmt syntax converter (responsible for transforming Reason string code to an OCaml AST)
321-
- `lib/4.06.1/refmt_main3.ml`: The refmt binary used within BuckleScript itself. The `3` corresponds to the corresponding major version of refmt.
319+
It's important that we need to update two specific files:
320+
321+
- `jscomp/main/refmt_api.ml`: Contains the programmatic interface for the refmt syntax converter (responsible for transforming Reason string code to an OCaml AST) -> Only used in the BuckleScript JS Playground
322+
- `lib/4.06.1/refmt_main3.ml`: The refmt binary used within BuckleScript itself. The `3` corresponds to the corresponding major version of refmt -> Used to build the vendored `refmt`, aka. `bsrefmt`
322323

323324
Both files are generated by using the `jscomp/bin/bspack.exe` binary (which is also built automatically when you build the compiler inside this repository) on the refmt parser. In more detail, `bspack.exe` resolves all dependencies of one specific `.ml` input file, puts them in the right order and copies all the source code with the target input file in one huge `.ml` bundle.
324325

@@ -332,7 +333,7 @@ git clone https://github.com/facebook/reason
332333
333334
cd reason
334335
335-
# You should already have created this switch by now, see playground build setup above
336+
# You should already have created this switch by now, see playground build setup instructions in "Contributing to the BS Playground Bundle"
336337
opam switch 4.06.1
337338
opam pin add -y reason .
338339
opam pin add -y rtop .
@@ -354,11 +355,19 @@ Now copy the files to bucklescript and do a rebuild to verify the changes:
354355
cp build/refmt_api.ml ../../bucklescript/jscomp/main/refmt_api.ml
355356
cp build/refmt_binary.ml ../../bucklescript/lib/4.06.1/refmt_main3.ml
356357
358+
# Build the whole compiler
357359
node scripts/ninja.js config && node scripts/ninja.js build
360+
361+
# Build the playground
358362
BS_PLAYGROUND=../playground node scripts/repl.js
359363
```
360364

361-
You should now have a new `playground/exports.js` with the new Reason version included.
365+
You should now have the newest `refmt` binary for the actual compiler, and for the playground, a new `playground/exports.js` file with the new Reason version included.
366+
367+
**Important:** Always verify that the updated Reason version is in sync in the
368+
`refmt.exe` and the playground bundle. Use `lib/bsrefmt --version` and for the
369+
playground API `window.reason.version` (not final) to get the bundled
370+
version.
362371

363372
## Contributing to the Documentation
364373

0 commit comments

Comments
 (0)