Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 975 Bytes

File metadata and controls

42 lines (27 loc) · 975 Bytes

Cronbake Examples

These TypeScript scripts demonstrate common Cronbake setups. They live outside the published bundle (package.json only ships the dist/ folder), so they are safe to keep in the repo.

Prerequisites

From the project root:

bun install

Run the stateless example

bun run examples/basic.ts

This spawns two in-memory jobs and listens for Ctrl+C to stop them.

Run the persistence example

bun run examples/persistence.ts

The script writes state to ./.cronbake-state.json, demonstrating persist: true vs. persist: false jobs and await baker.ready().

Run the logging example

bun run examples/logging.ts

This demonstrates custom logger support:

  • Creating a custom logger with colored output
  • Using a global logger for all jobs via Baker
  • Overriding the logger per job
  • Error logging when jobs fail

Feel free to copy these files or adapt them into your own app bootstrap logic.