AnonX - Anonymous Posting
DP
Anonymous x/DevSpeak
Thread Image
A Small Exploration About Version Numbers in package.json

**A Small Exploration About Version Numbers in package.json**

Recently, while maintaining an open-source library, I ran into a not-so-big but persistent problem.

This library needs to be compatible with multiple versions of `Vue` and `React`. In the `peerDependencies` section of package.json, what should I set as the minimum version?

Behind this is actually a trade-off:

* If I set the version too recent, many projects still using older framework versions won't be able to use my library.
* If I set it too old, I worry about missing out on optimizations and features from newer versions.

`npm.com` gives me a long list of versions, but what I really want to know is: **which versions are people actually using?**

I set myself a criterion: **find a version number that, together with all versions newer than it, covers 90% of the recent downloads.** I think using this version as the minimum compatibility version for my library is a fairly prudent and data-driven choice.

Initially, I was manually checking data and calculating, which was a bit tedious. So I decided to build a small tool to automate this process.

It's quite simple - you input a package name, and it sorts all versions by download count and highlights the "90th percentile" version I mentioned above.

Now, whenever I need to make similar decisions, I use it as a reference, and it feels much more reassuring.

I've put the tool here. If you've encountered similar dilemmas, perhaps it can save you some time.

🔗 **Try it online**: [https://npm-version-stat.siaikin.website/](https://npm-version-stat.siaikin.website/) 

Replies

No replies yet. Be the first to reply!