64 points · by jstrieb · 2y ago · 25 comments
When I first learned about Just, I realized that parsing arguments and running commands is exactly what shell scripts do, and there probably isn't much Just does that sh doesn't. This project proves that hypothesis by compiling Justfiles to portable (POSIX-compatible) shell scripts.
just.sh is particularly useful for running Justfiles in esoteric environments where Just may not be straightforward to install, such as some CI/CD pipeline environments.
Why do this you might ask? My rationale here was that I use `pipx` to install some python CLIs, and it was nice to be able to lump `just` in with that, as well as to be able to declare it as a "dependency" and pin specific versions for distribution.
Great idea, and I am wondering if there are more utilities I could/should wrap in a similar fashion. A cross platform brew.
I put together a cruft template (https://github.com/justin-yan/templates-cruft/tree/main/pack...) since I had the exact same thought as you once I got it working - why not do this with a bunch of different tools? I did it with a couple of my favorites (just, lazydocker) but haven't gone back to clean things up/make things a bit more systematic. So it's a pretty messy weekend project (caveat emptor) but hopefully it's a helpful starting point if you want to try it!
https://github.com/casey/just/issues/429
I really wish just was included as a package in distributions.
Also, I was considering adding the same feature (generating the equivalent shell script) to my tool, but after doing some analysis decided not to pursue this idea for the following reasons: https://github.com/xonixx/makesure/issues/83#issuecomment-98....
https://wiki.debian.org/DebianMentorsFaq#How_do_I_add_a_new_...
Mhm basically only Arch Linux, Chocolatey, FreeBSD, Gentoo and Homebrew. All others are outdated or nonexistent.
Also, the trade-off here (in my mind, at least) is that you could maintain higher-level Justfiles, but distribute releases containing the portable-shell-script artifacts of said compilation — so that anyone using your package doesn't need just, only a POSIX environment.
This is a really clever solution to that problem!
Yeah, Just is pretty awesome! Its biggest drawback over Make is that you can often assume Make is installed, whereas it's not always clear that Just needs to be installed if you've never heard of Justfiles before, let alone how to install it.
There are a few design decisions where I think Just missed an opportunity to improve on Make, but they're all pretty minor.
https://github.com/tdenniston/bish
(Just fyi. I've been collecting links to similar things because of Reasons).
I'm only a few weeks in, and just has its own learning curve, but I'm very pleased overall. Cognitive load is down, usability is up, robustness is up. ("After many years with make and plain shell ... for scripting, just is better enough, and the goal of clean consolidated efficient project automation is so valuable, that I am relying on it even though it's not installed by default.")
I love Just. Corrects many of Makes hindsight-mistakes, and centralizes all of your project tasks for an easy to browse summary. Even if each task is essentially `bash scripts/dothing.sh`, the single source is nice.
In response to "Why just not make" or "why just not bash script", I'd say "UX improvements for next to no effort".. or perhaps a conventional entry point for what tasks to run.
Having a transpiled bash script from a justfile has the benefit of not needing just installed.