I've always wondered how to publish a package on npm. It seemed like one of those things “real devs” did — and I wasn’t sure where to start. But this week, I finally did it! I created and published my very first npm package: how-much-time-ago — a tiny utility that converts dates or timestamps into human-readable relative time strings like: just now 2 minutes ago 3 days ago 1 year ago In this post, I’ll walk you through how I built and published it — step by step — so if you’ve ever been curious about sharing your own code on npm, this is for you.

Apr 25, 2025 - 07:39
 0

npmI've always wondered how to publish a package on npm.

It seemed like one of those things “real devs” did — and I wasn’t sure where to start. But this week, I finally did it! I created and published my very first npm package: how-much-time-ago — a tiny utility that converts dates or timestamps into human-readable relative time strings like:

  • just now
  • 2 minutes ago
  • 3 days ago
  • 1 year ago

In this post, I’ll walk you through how I built and published it — step by step — so if you’ve ever been curious about sharing your own code on npm, this is for you.