babashka 0.3.7 Issues resolved: https://github.com/babashka/babashka/blob/master/CHANGELOG.md#037 Task changes/improvements: https://github.com/babashka/babashka/issues/778
Most notable task changes:
- Tasks now have :enter
and :leave
hook which can be set globally under :tasks
and can be overridden per task
- New current-task
function which contains :name
of the task and all of the other data of the task map from the bb.edn
file
- The above two things together can be used to log task names (at the start and/or end of a task)
- New run
function: (run 'my-task {:parallel true})
to invoke other tasks in serial, force parallel, do whatever you want.
I already kinda regret the run
name, maybe I should have chosen run-task
to not confuse it with run!
?
Anyway, naming is hard.
Maybe a nice naming convention:
clean+dev (do (run 'clean)
(run 'dev))
bb clean+dev
it's not too late to change it 🙂
Nothing is set in stone, esp with software 😉 You could accrete it, and notify deprecate the run
name, then in a few releases, remove it completely.
Well, I chose it like this since the bb run
subcommand is also called like this and this function accepts the same opts
But like with all names, I fret about those for weeks, change them, and sometimes and up reverting them to go back to the same name, so I take my regret with a grain of salt and I will listen to the feedback of users as well
Anyway, (shell "bb run --parallel ...")
is now a thing of the past:
-dev {:depends [dev-cljs dev-less]}
dev {:doc "Run app in dev mode, watch CLJS and LESS files for changes"
:task (run '-dev {:parallel true})}
I think the run
name is fine, there is the clojure run!
, but in the babashka tasks context I think run
makes sense
Thanks :)
There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors. -- Leon Bambrick
Small demo of how you can use :enter
and :leave
to print task names while they progress:
https://github.com/clj-kondo/clj-kondo.lsp/blob/e906d4fc64f070311644529430b035bf9cbb7a0d/bb.edn#L7-L12