tekir
All Packages
Decoratorsv0.1.3

@tekir/cron-decorators

Cron job decorators for scheduling methods.

Installation

$bun add @tekir/cron-decorators

Features

  • @CronJob class decorator for job registration
  • @Schedule('* * * * *') for cron expressions
  • @Every('5m') for simple interval syntax
  • Metadata collection for auto-registration

Quick Example

TypeScript
import { CronJob, Schedule, Every } from '@tekir/cron-decorators'

@CronJob
class CleanupJob {
  @Schedule('0 0 * * *')
  async daily() { /* nightly cleanup */ }

  @Every('5m')
  async heartbeat() { /* health ping */ }
}

Changelog

v0.1.3LatestSeptember 16, 2026
  • Published output now uses the shared Node-targeted ESM bundle pipeline with external dependencies and generated TypeScript declarations, while Bun consumers keep the native source export.
v0.1.2July 23, 2026
  • Package metadata now follows the shared compatible 0.1.x dependency range used by this coordinated Tekir release.
v0.1.1June 13, 2026
  • @Schedule now validates the cron pattern at decoration time, throwing a meaningful error (with the pattern) for an empty pattern or a wrong field count.
  • @Every now enforces sensible ranges (1-59 for seconds/minutes, 1-23 for hours) and rejects out-of-range or unrecognized values like 90s, 25h, or 1d instead of silently falling back.
  • @CronJob now walks the prototype chain and reads methods without triggering getters, collecting each overridden method once.
  • Found and fixed with Fable.
v0.1.0April 1, 2026
  • Initial release

Other Decorators packages