https://github.com/liqtags/bigstepper
Big Stepper
https://github.com/liqtags/bigstepper
stepper typescript
Last synced: 30 days ago
JSON representation
Big Stepper
- Host: GitHub
- URL: https://github.com/liqtags/bigstepper
- Owner: liqtags
- Created: 2024-06-11T11:39:05.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-11T12:35:54.000Z (about 2 years ago)
- Last Synced: 2025-03-09T07:18:36.405Z (over 1 year ago)
- Topics: stepper, typescript
- Language: TypeScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Step System
This repository contains a Typescript implementation of a Step System, designed to execute a series of modules in a specified order. The system allows for defining dependencies between modules to ensure proper execution flow.
## Usage
To use the Step System, follow these steps:
1. **Define Steps**: Create individual modules (steps) to be executed. Each module should be a function returning a Promise.
2. **Create Step Definitions**: Define each step along with its dependencies, if any, using the `StepDefinition` interface.
3. **Initialize Step System**: Instantiate a `StepSystem` object with an array of step definitions.
4. **Run the Step System**: Call the `run()` method of the `StepSystem` instance to execute the defined modules sequentially.
## Example
```javascript
import { step1, step2 } from "./steps";
// Define step definitions
const steps = [
{ step: step1 },
{ step: step2, dependencies: ['data1'] } // Module 2 depends on data1 from module1
];
// Initialize StepSystem
const stepSystem = new StepSystem(steps);
// Run the step system
stepSystem.run().then((context) => {
console.log("All modules completed.");
console.log("Context:", context);
}).catch(error => {
console.error("Error:", error.message);
});