jointly
v0.0.4
Published
Run multiple processes in parallel.
Readme
Run multiple processes from a single terminal.
Put your config in mfml.config.js (other JS and TS extensions are also supported).
import { defineConfig } from 'jointly';
export default defineConfig({
tasks: [
{
command: 'vite',
},
{
command: 'tsc',
args: ['--watch', '--preserveWatchOutput', '--pretty'],
},
],
});To start tasks run:
npx jointlyYou can explicitly specify a configuration file path:
npx jointly --config my-config.jsEnvironment variables
Specify environment variables for each task:
export default defineConfig({
tasks: [
{
command: 'printenv',
args: ['HELLO'],
env: {
HELLO: 'Hello world!',
},
},
],
});Task dependencies
Tasks can depend on each other. Here's an example where tsc type checker is started in parallel with vite build,
while docker waits for vite to emit built assets and then builds and starts the container.
export default defineConfig({
tasks: [
{
command: 'tsc',
args: ['--watch', '--preserveWatchOutput', '--pretty'],
resolveAfter: 'exit',
},
{
key: 'vite-build',
command: 'vite',
args: ['build', '--watch'],
// Receives each line vite outputs to stdout
resolveAfter: line => line.includes('built in'),
},
{
command: 'docker',
args: ['compose', 'up', '--build', '--watch'],
dependencies: ['vite-build'],
},
],
});All processes would proceed running in parallel until user prompt is closed.
Kill signal
Different processes may require different kill signals. Specify a kill signal for a task:
export default defineConfig({
tasks: [
{
command: 'ping',
args: ['google.com'],
killSignal: 'SIGTERM',
},
],
});By default, SIGINT is used, which is intended to interrupt the currently running process and return control to
the user prompt.
