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 🙏

© 2024 – Pkg Stats / Ryan Hefner

sh-semver

v1.1.0

Published

The semantic versioner for bash

Downloads

6

Readme

sh-semver

NPM Version Build

The semantic versioner for Bourne Shell.

CLI

semver.sh [-r <rule>] [<version>... ]

Given a rule and one or many versions, it will return all of the provided versions that satisfy the rule, in sorted order, one per line.

If versions are omitted from the command line, it will read them from STDIN.

If the rule is omitted from the command line, it will simply sort all the provided versions.

Ranges

Every version range contains one or more sets of comparators. To satisfy version range version must satisfies all comparators from at least one set. Sets are separated with two vertical bars ||. Rules in each set are separated with whitespaces. Empty set are treated as wildcard comparator *.

Basic comparators

There are five basic comparators:

  • Equal to =A.B.C (= operator is optional, it may be provided but usually it isn't).
  • Less than <A.B.C
  • Greater than >A.B.C
  • Less than or equal to <=A.B.C
  • Greater than or equal to >=A.B.C

Advanced comparators

Wildcards * *.* *.*.*

Wildcard comparators can be satisfied by any version, even prerelease one.

Instead of * character can be used x or X.

Wildcard ranges A.*.* A.B.*

Wildcard ranges can be satisfied when only part of version is matching. In contrast to wildcards, wildcard ranges cannot be satisfied by prerelease versions.

  • A.*.* is satisfied when majors are the same,
  • A.B.* is satisfied when majors and minors are the same.

The special character (*, x or X) is optional.

Examples
  • 1.2 := >=1.2.0 <1.3.0
  • 5.*.* := >=5.0.0 <6.0.0
Caret ranges ^A.B.C

Matches to compatible versions.

Examples
  • ^1.2.3 := >=1.2.3 <2.0.0
  • ^0.1.2 := >=0.1.2 <0.2.0
  • ^0.0.1 := >=0.0.1 <0.0.2
Tilde ranges ~A.B.C ~A.B ~A

If patch version is specified tilde ranges matches to all greater or equal versions with the same minor version. Otherwise is equivalent of A.B.* when minor version is specified or A.*.* when not.

Hyphen ranges A.B.C - X.Y.Z

Hyphen range A.B.C - X.Y.Z equivalent of >=A.B.C <=X.Y.Z.

Prerelease versions

Prerelease versions can satisfy comparators set only when have the same minor major and patch numbers as at least one of comparators.