esy-peasy
- Easiest way to make native Reason programs and libraries.
- Merlin and LSP integration out of the box.
- For a project named
my-project
, produces single sharable library namedmy-project
and a single executable namedMyProject
.
Build An Example:
npm install -g esy@nextgit clone git@github.com:jordwalke/esy-peasy-starter.gitesy installesy build
Make It Your Own Package:
- Change the
name
field in thepackage.json
and rebuild.
How Are The Binary And Library Built?
- The single
.re
file inbin/
becomes theMyProject
executable. - The contents of
lib/
becomes themy-project
named library. - Your binary
.re
file can automatically see themy-project
library as theYourProjectLib
module. - Packages that depend on your package can then use your
my-project
library, which then allows them to see theYourProjectLib
module.
Testing The Binary:
Use the standard esy x any-command-here
command to run any-command-here
as
if you had installed the package. For example esy x YourPackage --args
builds
and runs your YourPackage
executable with arguments.
Customize:
- Omit the
lib/
directory if everything fits into the single file inbin/
. - You may rename the
bin/Index.re
file to bebin/YourProjectNameCamelCased.re
.
Adding New Package Dependencies:
esy add @opam/dep-name@version
automatically builds and adds a new dependency topackage.json
.- Find the name of the library inside of that new package by running
esy ls-libs
. - Add that library name to
package.json
like this:"peasyLibs": ["the-library-name"]
. - Use that library in your code and run
esy build
.
Note: After adding/building a new dependency you can use
esy ls-modules
to see which named modules become available to you by adding thepeasyLibs
entry.
npm
.
Publish Prebuilt binaries of your executables to Use esy
to make prebuilt binary releases of your program that can be installed
from plain npm
.
esy release bin
cd _release/bin-darwin
npm publish --tag darwin
Tradeoffs:
esy-peasy
is good for rapidly making new small executables/libraries. Once they
grow, you'll want to "eject out" of esy-peasy
and begin customizing using a more
advanced build system.