CLI to run Gleam Hex packages outside of a local Gleam package #4136
Replies: 10 comments 5 replies
-
i like this idea. would it be a separate command? eg. gpx ____ or something part of the main binary? eg. gleam x _____ also, a command i've been using to get the erlang version info is:
output: |
Beta Was this translation helpful? Give feedback.
-
It would be in the same binary. Perhaps something like |
Beta Was this translation helpful? Give feedback.
-
Personally, I think the |
Beta Was this translation helpful? Give feedback.
-
I like the idea of simply using
Coming from the JS world - mainly Deno..
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
So maybe we need some wrapper like this:
|
Beta Was this translation helpful? Give feedback.
-
related discussion: https://discord.com/channels/768594524158427167/1322141464578494496 |
Beta Was this translation helpful? Give feedback.
-
I gathered some materials on this problem: https://www.erlang.org/docs/26/man/escript and I also take a look at @lpil 's gleam add gleescript
gleam build && gleam run -m gleescript # e.g. will generate an escript `gleewhois` % in erlang shell
2> escript:extract("gleewhois",[]).
{ok,[{shebang,default},
{comment,[]},
{emu_args,"-escript main gleescript_main_shim -env GLEESCRIPT_MAIN gleewhois"},
{archive,<<80,75,3,4,20,0,0,0,8,0,124,75,35,90,165,219,
87,151,204,24,0,...>>}]} Originally, escript(s) are for small erlang code that can directly run as source code instead of having to build the BEAM code to run. So the packed escript Actually according to https://www.erlang.org/doc/apps/erts/escript_cmd.html#bundling-escripts, it says bundle escript(s) with an Erlang runtime:
But I think this "bundling" does not fix the above problem, it's just some erlang runtime selection mechansim. If the BEAM code doesn't match, I think the escript cannot run anyway. ideas
|
Beta Was this translation helpful? Give feedback.
-
or instead of managing the Erlang versions in a centralized db, just embed it into escripts’ section like the comments will probably be better |
Beta Was this translation helpful? Give feedback.
-
commit: enkerewpo/gleam-pkg@f2c358b ![]()
let output = erl_eval(
&"io:format(standard_io, \"~s~n\", [erlang:system_info(system_version)]).".to_string(),
)?;
let erlang_version = output.trim();
println!("Erlang system version: {}", erlang_version);
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Similar to npx.
We likely need to know when to recompile any Erlang bytecode as when the VM version changes the bytecode may no longer be valid. manveru on discord suggested this way of getting the Erlang version.
What should the CLI be?
Beta Was this translation helpful? Give feedback.
All reactions