A Bash-based Make alternative
Make is not meant to be used as a task runner. Just and scripts-to-rule-them-all help, but I wanted a simpler, more portable, and streamlined solution
It's simple: write a Bakefile.sh script:
#!/usr/bin/env bash task.lint() { prettier "**/*.{js,css}" eslint '.' stylelint "**/*.css" } task.deploy() { yarn build git commit -m v0.1.0 ... && git tag v0.1.0 ... gh release ... } task.fail() { printf '%s\n' "1ドル" false } task.succeed() { printf '%s\n' 'Success!' }
In the same (or any child) directory:
$ bake deploy
-> RUNNING TASK 'deploy' =================================
yarn run v1.22.17
...
<- DONE ==================================================When there is a failure...
$ bake fail 'WOOF' -> RUNNING TASK 'docs' =================================== WOOF <- ERROR ================================================= Error (bake): Your 'Bakefile.sh' did not exit successfully Stacktrace: -> Bakefile.sh:235 task.fail() -> bake:244 __bake_main() $ echo $? 1
Prettified output is sent to standard error, so pipines works
$ bake succeed 2>/dev/null | cat
Success!If you don't remember the tasks...
$ bake
Error (bake) No task supplied
Tasks:
-> lint
-> deploy
-> failTo sum it up, it just works
- Generates a
./bakefile, for use in CI, etc. - Sensible
set,shopt, andLANGdefaults - Set variables à la Make:
bake CC=clang build - Automatically
cd's to directory contaning Bakefile - Pass
-fto manually specify Bakefile - Dead-simple, miniscule function API (see api.md for details)
- Built-in support for watchexec
Coming soon...
WARNING: Manual is ONLY available on main branch and is NOT RELEASE-READY!
git clone 'https://github.com/hyperupcall/bake' ~/.bake printf '%s\n' 'PATH="$HOME/.bake/bin:$PATH"' >> ~/.bashrc
Not recommended, as Basalt is still Beta-quality
Use Basalt, a Bash package manager, to install this project globally
basalt global add hyperupcall/bake