Task orchestration with dependency resolution and topological execution
npm install @philiprehberger/task-runnerTask orchestration with dependency resolution and topological execution.
npm install @philiprehberger/task-runner
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');
createRunner(options?): RunnerCreates a new task runner.
RunnerOptionsonStart?(name) — Called when a task beginsonComplete?(name) — Called when a task finishesonError?(name, error) — Called when a task failsRunnertask(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 as string[] without executingnpm install
npm run build
npm test
If you find this project useful: