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

ios-workout-generator

v0.1.1

Published

Generate Apple Watch custom workout (.workout) files from plain JSON — library, CLI, and static web UI.

Readme

ios-workout-generator

Generate Apple Watch custom workout (.workout) files from plain JSON, then import them to your watch/phone. No iOS app or developer account needed to use it. Available three ways:

  • Web UI — a static page that builds the file in your browser (nothing is uploaded).
  • CLIbunx ios-workout-generator workout.json.
  • Libraryimport { encodeWorkout } from "ios-workout-generator".

It produces Apple's .workout format (a WorkoutKit WorkoutPlan). That format is undocumented; we reverse-engineered it and verified the encoder byte-for-byte against a real exported file. Full format, schema, and corroboration: findings.md.

How it works

workout JSON  →  encoder (src/encoder.js)  →  .workout file  →  Fitness → Add → Apple Watch

One dependency-free encoder powers all three faces. The Web UI uses a build-time copy at public/encoder.js.

Use as a library

import { encodeWorkout, workoutFilename } from "ios-workout-generator";

const bytes = encodeWorkout({
  name: "N2R Day 1",
  activity: "running",      // running | walking | cycling | hiking
  location: "outdoor",      // outdoor | indoor
  warmup:  { goal: "5min" },
  blocks:  [{ repeat: 6, steps: [
             { type: "work",     goal: "1min" },   // run
             { type: "recovery", goal: "2min" }] }], // walk
  cooldown: { goal: "5min" },
});                          // → Uint8Array; write it as `${workoutFilename(name)}`

Goal grammar: time (30s, 5min, 1min30s), distance (400m, 1km, 1mi, yd), or open. Ships with TypeScript types (src/encoder.d.ts).

Import paths (JSON file → watch)

  • Mac: download/generate the file, AirDrop to iPhone, tap it → Fitness → Add. (Verified.)
  • iPhone: the UI's “Share to phone…” (Web Share API), or open the file from Files → Fitness → Add. (Likely; verify on-device.)

Imported workouts appear in the Watch's Workout app under the matching activity tile (e.g. outdoor runningOutdoor Run → ••• → your workout).

Develop (bun)

bun install
bun test           # unit tests (incl. byte-identical golden-file check)
bun run verify     # extra: re-checks against a real exported .workout if present
bun run dev        # static site at http://localhost:8788  (wrangler pages dev)
bun run gen workout.json    # CLI: write a .workout from JSON
bun run deploy     # publish the static site to Cloudflare Pages

Status & caveats

  • Time goals are fully verified; alerts (HR/pace/power) and distance-goal units are inferred and not yet round-tripped — see findings.md “Open gaps.”
  • The .workout byte format is undocumented and carries no compatibility guarantee; Apple could change it in an OS update. bun run verify is the canary.