Use Task Runners for Common Coding Tasks
4 hours ago
- The author frequently switches between code repositories with different tech stacks and wants to run common tasks like installing dependencies, building, linting, formatting, and testing without remembering varying commands.
- To achieve consistency, they create convenience tooling such as bash scripts, Makefiles, justfiles, or mise.toml files that allow using the same command (e.g., run build or make test) across projects.
- A simple bash script can wrap common commands with functions for install, build, test, format, etc., offering flexibility but with sometimes awkward syntax.
- Make is a classic, widely available tool; it uses a Makefile with targets and requires .PHONY declarations to avoid file conflicts, and some shells provide tab completion for its targets.
- just is a newer, simpler task runner inspired by Make, with a straightforward justfile syntax, but it must be installed separately.
- mise is a modern developer tool that can manage tools, environment variables, and run tasks via a mise.toml file, and tasks can be extracted into separate files if needed.
- Implementing any of these approaches is a small quality-of-life improvement that is easy to set up and can save time across multiple repositories.