@omerdev/cron-pilot
v1.0.0
Published
Human-friendly, lightweight, zero-dependency cron and task scheduler with natural expressions, retries, and overlap prevention
Maintainers
Readme
⏱ @omerdev/cron-pilot
Human-friendly, lightweight, zero-dependency cron and task scheduler with natural expressions, retries, and overlap prevention.
🚀 Features
- Human Expressions: No more memorizing
*/15 * * * *! Write"every 5 minutes","daily at 14:00","every Monday at 09:30". - Overlap Prevention: Prevents long-running async tasks from piling up and executing concurrently.
- Automatic Retry with Backoff: Automatically retry failed jobs before logging errors.
- Job Observability: Track
runCount,errorCount,lastRunAt,lastError. - Zero Dependencies: Pure lightweight modern TypeScript (< 2KB).
📦 Installation
npm install @omerdev/cron-pilot
# or
pnpm add @omerdev/cron-pilot
# or
bun add @omerdev/cron-pilot💡 Quick Start
import { schedule } from "@omerdev/cron-pilot";
// 1. Periodic intervals
schedule("every 30 seconds", async () => {
console.log("Checking for new notifications...");
});
// 2. Specific time of day
schedule("daily at 03:00", async () => {
console.log("Running nightly database backup...");
});
// 3. Weekly recurring task with retries
schedule("every Monday at 09:00", async () => {
await generateWeeklyReport();
}, {
preventOverlap: true,
retry: {
attempts: 3,
delayMs: 2000
}
});👤 Author
omerdev
📄 License
MIT
