Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Bash-based Make alternative.

License

Notifications You must be signed in to change notification settings

hyperupcall/bake

Bake

A Bash-based Make alternative

Why?

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
 -> fail

To sum it up, it just works

Features

  • Generates a ./bake file, for use in CI, etc.
  • Sensible set, shopt, and LANG defaults
  • Set variables à la Make: bake CC=clang build
  • Automatically cd's to directory contaning Bakefile
  • Pass -f to manually specify Bakefile
  • Dead-simple, miniscule function API (see api.md for details)
  • Built-in support for watchexec

Installation

Brew

Coming soon...

Manual

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

Basalt

Not recommended, as Basalt is still Beta-quality

Use Basalt, a Bash package manager, to install this project globally

basalt global add hyperupcall/bake

About

A Bash-based Make alternative.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /