TaskFlow is a Node.js tool that allows developers to define **high-level task pipelines** using simple, readable steps, then automatically **compile and execute** them as real JavaScript code.
npm install taskflow.js.then("step description") chains
taskflow run )
bash
npm install taskflow.js
`
$3
`bash
npm install -g taskflow.js
`
---
CLI Usage
Create a JavaScript file that contains TaskFlow pipelines.
Example: userApp.js
`js
import { Task } from "taskflow.js";
const userEmail = "user@example.com";
const subject = "Welcome!";
const messageText = "Hello from TaskFlow 👋";
const emailFlow = Task("Email Notification")
.then("Create an email content using userEmail, subject, and messageText")
.then("Print the email content to the console")
.then("Print a confirmation message that the email is 'sent'");
`
$3
`bash
taskflow run userApp.js
`
#### TaskFlow will:
- Analyze the pipelines
- Generate executable JavaScript code
- Compile the file into a .compiled.js file
- Execute the compiled output
Library Usage
You can also use TaskFlow programmatically from another script.
Example: run.js
`js
import { compileAndRunPipeline } from "taskflow.js";
const result = await compileAndRunPipeline("./userApp.js");
if (!result.ok) {
console.error(result.error);
process.exit(1);
}
console.log("Compiled file:", result.data.compiledPath);
console.log(result.data.runOutput.stdout);
`
$3
`bash
node run.js
``