4 ms·
The greatest feature for this is inline deps, something very rare to have built-in (I've only found Deno to have a similar feature): https://bundler.io/guides/b
by lambdaba 2y ago
The greatest feature for this is inline deps, something very rare to have built-in (I've only found Deno to have a similar feature): https://bundler.io/guides/bundler_in_a_single_file_ruby_script.html https://bundler.io/guides/bundler_in_a_single_file_ruby_scri...
- meiraleal 2y agoAll browsers implemented it before deno with ESM and importmap.
- epage 2y agoMany languages have a third-party way of doing it and a few even have first-party support, see https://dbohdan.com/scripts-with-dependencies https://dbohdan.com/scripts-with-dependencies Since that document, Python PEP 723 was approved, see https://peps.python.org/pep-0723/ https://peps.python.org/pep-0723/ and https://packaging.python.org/en/latest/specifications/inline-script-metadata/#inline-script-metadata https://packaging.python.org/en/latest/specifications/inline... Similarly, Rust RFC 3502 was approved and an unstable implementation is available, see https://rust-lang.github.io/rfcs/3502-cargo-script.html https://rust-lang.github.io/rfcs/3502-cargo-script.html
- quechimba 2y agoDidn't know about this, very useful!
- pas 2y agofor Scala there's Ammonite which can do this https://ammonite.io/#MagicImports https://ammonite.io/#MagicImports
- corytheboyd 2y agoYay I’m glad someone else knows about this and thinks it’s awesome too :) It’s crazy I didn’t find it until I was digging through bundler docs looking for something completely unrelated
- asa400 2y agoElixir also has inline dependencies in scripts, via `Mix.install`: https://hexdocs.pm/mix/1.17.1/Mix.html#install/2 https://hexdocs.pm/mix/1.17.1/Mix.html#install/2. I've used it quite a bit, it works great.
- aendruk 2y agoAlso been loving that Nix can give you this for shell scripts, e.g.: #!/usr/bin/env nix-shell #!nix-shell -i bash -p cowsay imagemagick identify "$1" | cowsay https://nixos.wiki/wiki/Nix-shell_shebang https://nixos.wiki/wiki/Nix-shell_shebang
- lambdaba 2y agoNix fan here too. If you like nix-shell, you'll love cached-nix-shell!: https://github.com/xzfc/cached-nix-shell https://github.com/xzfc/cached-nix-shell