Bundle your Gleam-on-Erlang project into an escript, a single executable file! You may find this useful for writing command line programs and scripts in Gleam.
Add this package to your Gleam project and run gleam run -m gleescript
to
generate an escript.
gleam add gleescript
gleam build
gleam run -m gleescript
# Running gleescript.main
# Generated ./your_project
./your_project
# Hello from your_project!
The escript can run on any computer that has the Erlang VM installed. Older versions of the virtual machine may not support the newer bytecode contained in the escript. Typically being within a couple major versions of the version used to build the escript is safe.
See the Erlang escript documentation for more information.
By default the executable is created in the current directory. The --out
flag
can be used to write to a different directory.
gleam run -m gleescript -- --out=./some/directory
# Running gleescript.main
# Generated ./some/directory/your_project
./some/directory/your_project
# Hello from your_project!
Have fun!