Reason toolchain packaged for npm.
Note, that this is beta software, and will likely break from time to time. It's great if this works for you but there are likely some systems where installations fail. Please report bugs so that we are aware of the issues.
For each version of reason-cli, there are three forms to choose from:
# Reason 1.13.5 and ocaml 4.02.3
npm install -g git://github.com/reasonml/reason-cli.git#beta-v-1.13.5-dev
npm install -g git://github.com/reasonml/reason-cli.git#beta-v-1.13.5-pack
npm install -g git://github.com/reasonml/reason-cli.git#beta--v-1.13.5-bin-darwin
-
dev: (Not yet released) Live on the bleeding edge and help us find bugs earlier. Also, allows your IDE tooling (Merlin) to explore the standard library sources. -
pack: (Not yet released) (experimental) Builds on client from packed tarball of dependencies. Suitable for offline installations, CI, isolated networks, and environments that require building on host. -
bin: Prebuilt Binaries (Experimental) (Not yet released) Platform specific releases of prebuilt binaries.
- vscode-reasonml
- vim-reason
- Someone please test on
emacsplugins so we can add them to this list.
reason-cli now supports being installed as a dev-time dependency in an npm
project. Simply omit the -g flag. The binaries will show up in your
node_modules/.bin directory.
Any time you update, make sure to first uninstall the old version, then run the
global install command for the new version you want to install. When an update
/ bug fix has been pushed to a release, you should uninstall -g and then
install that same release you just uninstalled.
npm uninstall -g reason-cli
npm install -g git://github.com/reasonml/reason-cli.git#beta-v-1.13.5-dev
Updating should be fairly fast, even in the case of builds-from-source.
- After installing
reason-cliglobally, and after installing your editor plugins, just start your editor like you normally would, and it should seeocamlmerlin, andrefmt. - The downside is that
merlindoesn't know where you have your findlib packages installed within your local project, because it is built for the global environment.
When installed with npm install -g, reason-cli places the following tools
in your path:
ocamlmerlinrefmtocamlrunocamlc/ocamloptocamlfind
See the README in releaseUtils to understand
what happens in each release. Each of the release forms may be created as
follows:
make release VERSION=beta-v-1.13.5 TYPE=dev
# Or
make release VERSION=beta-v-1.13.5 TYPE=pack
# Or
make release VERSION=beta-v-1.13.5 TYPE=binIf making a release for Github, to avoid your upload size being rejected, make
sure you install the git lfs extension brew install git-lfs and supply the
GITHUB_LFS argument such as:
make release VERSION=beta-v-1.13.5 TYPE=bin GITHUB_LFS=1git clone git@github.com:reasonml/reason-cli.git
cd reason-cli
make release VERSION=beta-v-1.13.5 TYPE=pack
tar --exclude=.git -cvzf release.tar.gz package
gunzip release.tar.gz
tar -xvf package.tar
npm install -g ./package
# You cannot move the installation once you have installed it into # a location
(global or local). To move the package, uninstall it # and reinstall it from
the new location. You can, however, install it anywhere you like.If you do not have npm installed on the destination host, then the setup is
largely the same but instead of the final npm install ./package command you
can simply extract release.tar.gz to the installation directory of your
choosing and then invoke the postinstall.sh yourself. Again, don't move the
package once it's installed.
git clone git@github.com:reasonml/reason-cli.git
cd reason-cli
make release VERSION=beta-v-1.13.5 TYPE=pack
tar --exclude=.git -cvzf release.tar.gz package
gunzip release.tar.gz
tar -xvf package.tar
npm install -g ./package
cd ./package
./postinstall.shThen you can simply invoke the binaries as part of a build script elsewhere, or
include the binary locations for refmt in your bsconfig.
/path/to/package/.bin/refmt
Alternatively, you can put something like this in your .bashrc:
export ESY_EJECT__STORE=`cat /path/to/package/records/recordedClientInstallStorePath.txt`
source /path/to/package/node_modules/.cache/_esy/build-eject/eject-env
Since these global tools use esy, globally installed tools warm the build
cache for your local projects.
- When building sandboxed projects, now those sandboxed projects build very fast because they share the same cache as the globally installed tools you've built.
- One infrastructure to manage.
We do not have good examples of creating sandboxed projects yet, so this isn't entirely useful yet.
-
For failed installs try:
npm install -g whateverReasonCliReleaseYouTried --ignore-scripts cd whereverYourGlobalNpmPackagesAreStored/reason-cli/ ./scripts/postinstall.shDoes it give any better information about what is failing?
-
Did you remember to install using
-g? -
In general, try uninstalling and then reinstalling
reason-cli. -
When updating, did you remember to uninstall the previous installation?
-
If you're experiencing permissions issues, it could be due to the linux
npminstalls global-gpackages when you usesudo. Instead of installing withsudoyou should probably set up your packages as explained in this guide: https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md- Note: We are still going to work on solving permissions issues with
installing
-gpackages withsudo, but following that guide should eliminate many issues with many different npm packages (not just reason-cli).
- Note: We are still going to work on solving permissions issues with
installing
-
If an error occurs during install, it likely tells you where the log is (not the npm log) that contains the build errors.
- If not, you can find recent build attempts here in your home dir cache at these locations:
~/.esy/_build/packageName/_esy/build.log. Find recently modified created build logs in those locations and create github gists, sharing them on the Reason Discord Chanel in the channel#packageManagementAndNativeBuildSystems.
- If not, you can find recent build attempts here in your home dir cache at these locations:
-
If nothing else works, and the error isn't clear (especially if a previous version worked), you can do:
mv ~/.esy ~/.esy-old- Uninstall then reinstall
reason-cli. - If it works when you do this, then it's a critical bug with
esyand you can help us eliminate the bug by helping us spot some differences between those two~/.esyand~/.esy-old. Are there two corresponding package directories with the same name but different contents?
-
One thing that doesn't work well yet, is when you purge the global
esycache after you installpackordevreleases, the global tools will be pointing to dangling references in the cache. We will fix this eventually by relocating artifacts from the global cache to the global installed packages. A simple uninstall and reinstall should fix that. This can be fixed by relocating all build artifacts from the cache to the installednode_modulesdirectory (at a slight install performance hit). -
We can repurpose the
releaseUtils/release.jsto allow releasing other opam packages as npm binaries.
See ORIGINS.