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

@radhirasho/latest

v1.0.25

Published

Checks latest version of a package

Downloads

16

Readme

@radhirasho/latest

Overview

@radhirasho/latest is a Node.js utility that checks the latest version of a given package from npm or other registries. It can be used as a CLI tool or as a library in your Node.js projects.

Installation

CLI

To install the CLI globally, use:

npm install -g @radhirasho/latest

Library

To install the library in your project, use:

npm install @radhirasho/latest

Usage

CLI

You can use the latest command to check the latest version of packages. For example:

latest <package-name>

You can also check multiple packages at once:

latest <package-name-1> <package-name-2> ...

Programmatic API

You can also use the package programmatically in your Node.js projects.

Importing

import { latest, checkUpdate } from "@radhirasho/latest";

Checking the Latest Version

To check the latest version of a package:

const { value, error } = await latest("package-name");

if (error) {
  console.error("Error fetching latest version:", error);
} else {
  console.log("Latest version:", value);
}

Checking for Updates

To check if a package needs an update:

const pkg = {
  name: "package-name",
  version: "1.0.0"
};

const result = await checkUpdate(pkg);

console.log(result);

Configuration

LatestOptions

You can pass options to the latest function to customize its behavior:

  • all: If true, fetches all version tags.
  • registry: Specifies the registry to use (e.g., npm, yarn).

Example:

const options = {
  all: true,
  registry: "yarn"
};

const { value, error } = await latest("package-name", options);

CheckUpdateOptions

You can pass options to the checkUpdate function to customize its behavior:

  • latest: Options to pass to the latest function.

Example:

const options = {
  latest: {
    all: true,
    registry: "yarn"
  }
};

const result = await checkUpdate(pkg, options);

Development

Building the Project

To build the project, run:

npm run build

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the ISC License. See the LICENSE file for details.

Author

Radhi Rasho

Inspiration

Inspired by node-latest that I ran into without realizing and noticed it was dependent on npm, which wasn't really necessary so I found a way to use fetch and have similar functionality, plus some.