logoalt Hacker News

Use Task Runners for Common Coding Tasks

47 pointsby speckxtoday at 4:51 PM16 commentsview on HN

Comments

pragma_xtoday at 8:38 PM

> A small drawback is that just isn’t readily available on developer’s machines (unlike bash and make)

Looking back, this was usually a substantial stumbling block for adoption of new tooling. Things have changed. All one has to do is look at what JS programmers will go through to scratch build entire toolchains on the back of npm. IMO, the bar has been moved up to allow _some_ installation friction rather than none.

IMO, if the tool is a solid improvement and installation is a one-liner, use it and promote it loudly so it continues to get support.

TekWizelytoday at 8:55 PM

I made a task runner inspired by make's simplicity but purpose-built for running tasks:

Run: Task runner that helps you easily manage and invoke small scripts and wrappers.

https://github.com/TekWizely/run

Do you find yourself using tools like make to manage non-build-related scripts?

Build tools are great, but they are not optimized for general script management.

Run aims to be better at managing small scripts and wrappers, while incorporating a familiar make-like syntax.

betreetoday at 7:51 PM

Historically, I did it the other way around: have some autogenerated shell commands (dev, test, pull...etc) on my local machine that detect which language the project in the current folder is using, and calls commands accordingly. I did it this way because, in my case, it was challenging to consolidate multiple projects across multiple organizations under a single tool.

It's public, but I realize I haven't pushed my local updates for a while now. https://github.com/Betree/dev-commander

yolkedgeektoday at 8:49 PM

Let me also recommend babashka and it's task runner too!

If my tasks are simple enough, bash or make will do but for serious projects, specially lispy ones, babashka is amazing.

danofsteel32today at 8:43 PM

I use the shell script pattern. In bash the case statement at the bottom of your example can be replaced with this though:

  “${@:-default}” || usage
stackghosttoday at 7:40 PM

I do this with plain ol' makefiles.

Even for projects where Make isn't part of the build pipeline, like Rails or C++, I have a standardized makefile I put in the project root, using includes for "secrets.mk", so I can do things like "make deploy" and it Just Works(tm).

Sometimes the old ways are best!

show 1 reply
jtwalesontoday at 6:58 PM

I've been using Taskfile. Are just / mise much better?

show 2 replies
Onavotoday at 6:52 PM

I wish mise has better secrets management or allows for split config e.g. a repo wide config that's to be shared and a personal config that can override whatever's necessary. It's difficult to commit mise.toml because the [env] section almost always contains sensitive variables.

show 4 replies