Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rosszurowski/tandem
Parallel task runner for servers and long-running commands.
https://github.com/rosszurowski/tandem
concurrently golang make parallel watch
Last synced: 12 days ago
JSON representation
Parallel task runner for servers and long-running commands.
- Host: GitHub
- URL: https://github.com/rosszurowski/tandem
- Owner: rosszurowski
- License: mit
- Created: 2023-01-01T20:20:44.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-03T10:50:04.000Z (almost 2 years ago)
- Last Synced: 2024-11-01T15:51:45.239Z (19 days ago)
- Topics: concurrently, golang, make, parallel, watch
- Language: Go
- Homepage:
- Size: 824 KB
- Stars: 64
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
tandem is a task runner for parallel dev servers.
Small, fast, and pairs great with Makefiles!
## Features
- Small, fast, static binary.
- Shuts down each command if one fails. No more processes clinging to ports.
- Supports running npm scripts and binaries.
- Labels output for each command.## Demo
![A screencast demo of using the tandem CLI.](.github/demo.gif)
## Installation
On macOS, you can install with:
```shell
brew install rosszurowski/tap/tandem
```If you have Go installed, you can install from the source with:
```shell
go install github.com/rosszurowski/tandem@latest
```If you're using tandem from a Makefile, [this snippet](#using-in-makefiles) shows how to download a locally cached copy.
## Usage
Use tandem by passing a set of commands to run in parallel. Wrap each command in quotes, like so:
```shell
tandem 'command1 "arg"' 'command2 "arg"' 'command3 "arg"'
```### Running a front-end and a backend at once
Working on a Next.js app, you might want to run your front-end dev server alongside a backend API server with live updating changes through [nodemon](https://nodemon.io/):
```shell
$ tandem 'next dev' 'nodemon --quiet ./server.js'
next ready - started server on 0.0.0.0:3000, url: http://localhost:3000
next event - compiled client and server successfully in 15 ms (25 modules)
nodemon starting server...
nodemon listening on http://localhost:3001
```### Running npm scripts
If your scripts are defined in `package.json`, you can reference them by using `npm:` as a prefix:
```json
{
"scripts": {
"dev:php": "...",
"dev:js": "...",
"dev:css": "..."
}
}
``````shell
$ tandem 'npm:dev:php' 'npm:dev:js' 'npm:dev:css'
```Wildcard rules like `npm:dev:*` are also supported as a shortcut. This line is equivalent to the above:
```shell
$ tandem 'npm:dev:*'
```### Using in Makefiles
In a Makefile, use this snippet to fetch a local copy for your project. Change the `.cache` path as needed, and add it to your `.gitignore`.
```makefile
dev: node_modules .cache/tandem
@.cache/tandem 'command1' 'command2'
.PHONY: dev.cache/tandem:
@mkdir -p $$(dirname $@)
@curl -fsSL https://raw.githubusercontent.com/rosszurowski/tandem/main/install.sh | bash -s -- --dest="$$(dirname $@)"
```Running `make dev` will download tandem once, and then use it for every run from there on out.
## Motivation
I regularly use Makefiles to automate project commands and tools. Makefiles are mostly great! But their biggest failing (also a failing of shells generally) is that it's shockingly hard to coordinate multiple commands as one group:
tandem makes running concurrent servers easy. It takes inspiration from [concurrently](https://www.npmjs.com/package/concurrently) or [npm-run-all](https://www.npmjs.com/package/npm-run-all), but improves performance and works as a static binary.
## Acknowledgements
tandem owes a big thanks to [hivemind](https://github.com/DarthSim/hivemind), from which much of the source is drawn. `tandem` can be thought of as a fork of hivemind, but rather than defining commands in a Procfile, defining them from a list of arguments.
tandem's illustration was drawn by [Hannah Lee](https://hannahlee.ca/).