@philiprehberger/task-runner
v0.1.1
Published
Task orchestration with dependency resolution and topological execution
Readme
@philiprehberger/task-runner
Task orchestration with dependency resolution and topological execution.
Installation
npm install @philiprehberger/task-runnerUsage
import { createRunner } from '@philiprehberger/task-runner';
const runner = createRunner({
onStart: (name) => console.log(`Starting: ${name}`),
onComplete: (name) => console.log(`Done: ${name}`),
});
runner.task('compile', async () => {
await compileSource();
}, ['lint']);
runner.task('lint', async () => {
await runLinter();
});
runner.task('test', async () => {
await runTests();
}, ['compile']);
// Preview execution order
console.log(runner.dryRun('test')); // ['lint', 'compile', 'test']
// Execute with dependency resolution
await runner.run('test');API
createRunner(options?): Runner
Creates a new task runner.
RunnerOptions
onStart?(name)— Called when a task beginsonComplete?(name)— Called when a task finishesonError?(name, error)— Called when a task fails
Runner
task(name, fn, deps?)— Register a task with optional dependenciesrun(name?)— Execute a task and its dependencies, or all tasks if no name givendryRun(name?)— Return execution order asstring[]without executing
Development
npm install
npm run build
npm testLicense
MIT
