npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

crontab-timer-migration-kit

v0.1.0

Published

Generate systemd timer migration drafts from crontab text with diagnostics.

Downloads

120

Readme

crontab-timer-migration-kit

License: MPL-2.0 CI

Generate systemd timer migration drafts from crontab text with diagnostics.

crontab-timer-migration-kit is a clean-room TypeScript package for dry-running small cron-to-systemd migrations. It is browser-friendly, ESM-only, dependency-free, and returns generated .service / .timer text plus stable diagnostics.

Links: Demo · GitHub

Install

npm install crontab-timer-migration-kit

Quick Start

import { migrateCrontabToSystemdTimers } from "crontab-timer-migration-kit";

const result = migrateCrontabToSystemdTimers(`
PATH=/usr/local/bin:/usr/bin
30 2 * * * /usr/local/bin/backup
`);

console.log(result.jobs[0]?.serviceUnit);
console.log(result.jobs[0]?.timerUnit);
console.log(result.diagnostics);

API

migrateCrontabToSystemdTimers(input, options?)

Parses crontab text and returns:

  • captured environment variables;
  • one migration job per supported cron command;
  • generated service and timer unit names;
  • generated unit file contents;
  • stable diagnostics for ignored, risky or unsupported lines.
const result = migrateCrontabToSystemdTimers("15 1 * * * npm run cleanup", {
  unitPrefix: "nightly",
  workingDirectory: "/srv/app",
  user: "deploy",
  persistent: false
});

if (result.ok) {
  for (const job of result.jobs) {
    console.log(job.serviceUnitName, job.serviceUnit);
    console.log(job.timerUnitName, job.timerUnit);
  }
}

createCrontabTimerMigrator(defaultOptions?)

Creates a reusable wrapper with default options.

const migrator = createCrontabTimerMigrator({ unitPrefix: "cron-migration" });
const result = migrator.migrate("0 7 * * 1 /usr/bin/report");

Options

| Option | Default | Description | | --- | --- | --- | | unitPrefix | "cron-job" | Prefix for generated unit file basenames. | | descriptionPrefix | "Migrated cron job" | Prefix used in systemd Description= fields. | | workingDirectory | undefined | Optional WorkingDirectory= for each service. | | user | undefined | Optional User= for each service. | | persistent | true | Timer Persistent= value. | | maxJobs | 50 | Maximum number of jobs to migrate from one input. |

Supported MVP

The MVP converts plain five-field cron schedules where each field is either * or a number:

30 2 * * * /usr/local/bin/backup
0 7 * * 1 /usr/bin/report

It intentionally does not convert cron macros, ranges, lists, step values or named weekdays/months yet. Those lines receive error diagnostics and keep OnCalendar=UNSUPPORTED when a job record can still be produced for review.

Commands are emitted through /bin/sh -lc because many real crontabs rely on shell behavior. This package still warns when it sees obvious shell syntax so a reviewer can decide whether to split the command into a script.

Diagnostics

Diagnostics are stable strings for tests, UI hints and migration reports:

  • invalid-input
  • invalid-options
  • empty-crontab
  • line-ignored
  • environment-variable
  • unsupported-macro
  • unsupported-step
  • unsupported-list
  • unsupported-range
  • unsupported-name
  • invalid-field-value
  • invalid-field-count
  • unsafe-unit-name
  • command-needs-shell
  • cron-environment-differs
  • mailto-not-migrated

Limits

This package does not read or write files, install units, call systemctl, validate with systemd, or claim full cron compatibility. It produces reviewable migration drafts for small crontabs and makes unsupported syntax explicit.

Package quality

  • TypeScript types are generated from the source.
  • ESM-only package with no runtime dependencies.
  • Defensive API: invalid input and invalid runtime options return diagnostics instead of throwing.
  • CI runs npm ci, typecheck, build, and test.
  • Tested on Node.js 20 and 22 with GitHub Actions.

License

MPL-2.0