justfiles are part of the golden three
just
solves a set of complex problems:
I want a single command to give me a CLI menu, where ever I am
I’m tired, and forgetful, and I just want this repository to build or test or deploy, and I don’t want to remember all the specifics, I just want to get things done and move on.
When you have multiple repositories you create scripts + tools for
- CI operations
- Development
- Testing
- All kinds of other tasks
You want to organise these commands, so you put them in a Make
file or some custom CLI thing.
But:
- the custom thing isn’t easily transferrable to other projects/repositories
Make
is very specific, and has a bunch of ugly workarounds for doing simple things (e.g..PHONY
)
so you and up with a bunch of kludge.
Enter just
.
just
is exactly what I needed:
- simple well formatted commands in any language
- introspection
- the utilities you need when munging strings/paths etc
Now ALL my projects have a justfile
in the root
I expect the following:
- Most common commands FIRST (ie. NOT alphabetical order)
dev
,test
,deploy
/publish
- Commands check for dependencies and libraries/modules at runtime, and automatically install if needed
- Don’t make me write commands for no reason, there’s no reason to not automatically install e.g. npm modules if they are missing.
- List various links e.g. to the github repo, to the published URL endpoint, to the docs
I alias just
to j
so that I am just j
'ing everywhere. It’s short, fast, and gets me reliably building/publishing even if I have forgotten all the details of the commands.
Sharing
just
on it’s own doesn’t solve the problem of sharing complex commands. That’s where deno
comes in. It’s a single binary, running Typescript. I know Typescript is not everyone’s cup of tea, but it’s typed, gets the job done, and the URL imports make sharing between repositories MUCH easier.
Basically before URL imports, I struggled with how to share complex build/publish/deploy scripts.
Just Words of Wisdom (To Myself) about just
etiquette
Always include the full path of commands
If you document something with what <command> you should run, e.g.
# And then you type: 'just <command>'
but you are </over/here>
but you have to be </somewhere/else>
then please include the full path so there is never any doubt and you don’t have to go fd
'ing: '</be/specific> just <command>'
. It doesn’t have to be this exact formula, but try to remove this kind of friction.
Include links to important locations
See the links at the bottom, they are a click away