Gleescript – 将 Gleam-on-Erlang 项目打包成可执行文件
Gleescript – Bundle Gleam-on-Erlang project into an executable file

原始链接: https://github.com/lpil/gleescript

## Gleescript:将 Gleam 项目打包为可执行文件 Gleescript 允许你将 Gleam (基于 Erlang) 项目打包成独立的 `.escript` 可执行文件,非常适合命令行工具和脚本。 只需将 `gleescript` 包添加到你的 Gleam 项目,构建它,然后运行 `gleam run -m gleescript` 来生成可执行文件。 这会创建一个可以在安装了 Erlang VM 的任何系统上运行的单个文件。 默认情况下,生成的可执行文件位于当前目录中,但你可以使用 `--out` 标志指定不同的输出目录(例如,`gleam run -m gleescript -- --out=./some/directory`)。 请记住,兼容性取决于 Erlang VM 的版本;使用与构建环境相差几个主要版本的 VM 通常是安全的。 请参阅 Erlang 的 escript 文档以获取详细信息。

Hacker News 新闻 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Gleescript – 将 Gleam-on-Erlang 项目打包成可执行文件 (github.com/lpil) 16 分,TheWiggles 1 天前 | 隐藏 | 过去 | 收藏 | 1 条评论 marmalade2413 1 天前 [–] 我最近开始使用 Gleam 进行一个小型医学影像项目,说实话,我从未在任何语言中使用中感到如此有趣。文档很棒,而且整个语言足够小,可以在大约一个小时内学会。回复 考虑申请 YC 2026 冬季批次!申请截止日期为 11 月 10 日 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

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.

Package Version Hex Docs

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!

联系我们 contact @ memedata.com