See the announcement and the changelog guide.
Converting your code to to the new syntax is done by running the
upgradeSyntaxFrom2To3
converter on your project's Reason code.
Make sure that your project is syntactically valid in Reason 2.
Invalid code will fail to convert.
Do this at the root of your project:
npm install -g upgrade-reason-syntax
npm install --save-dev bs-platform@2.1.0
upgradeSyntaxFrom2To3 mySource/*
Make sure you did install bs-platform 2.1.0. Sometimes your lockfile might have locked it to 1.x.x
.
The script accepts a list of files/globs to convert. Pass as many as you want. It'll intelligently skip over any file that's not Reason.
After you're done converting your projects:
mySource/*.backup
"refmt": 3
to your bsconfig.json to make BuckleScript use the new syntax.If you're on native, this is also your workflow. (So you'll need node.js).
It's a simple node.js script that takes the old refmt
and the new refmt3
from your project's BuckleScript 2.0.0's source at node_modules/bs-platform
, and then:
refmt
refmt3
and writes them backThat's it! Enjoy =)