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

cli-ext

v1.1.0

Published

CLI extensions for a rich user interface.

Readme

cliExt

A package for cli input handling. This package simplifies the hassle to allow file input, piped input. It even supports editor inputs when no input is given.

Installation

Via npm

npm install cli-ext

Usage

import * as cliExt from 'cli-ext'

// get stdin input or if none is given open an editor
cliExt.input()
.then((contents) => console.log('stdin or editor input: ', contents))

// if the second process argument is a file it opens that file
// otherwise check stdin
// default to an editor if none of the above is set
cliExt.input(process.argv[2])
.then((contents) => console.log(contents))

// opens an editor to edit the file `config.json`
cliExt.edit('./config.json')
.then((json) => ...)

// opens an editor to edit the given text
cliExt.editContent('text to display in the editor')
.then((text) => ...)

// use a function to verify the contents of the input.
// Here we want to ensure that the content is at least 100 characters long
cliExt.input(process.argv[2], {verify: (content) => content.length > 100})
.then((text) => ...)

API

This package exports three methods:

| Method | Description| |------------------------|------------------| | .input(file, config) | Try to read the file if none is given look for stdin input. If there is no stdin input open the editor specified by the environment variable $EDITOR (default nano). Returns a promise with the resulting text. The configuration config accepts the following keys.fileType: Specify the file type for syntax highlighting in the editor. [Default: '.json'] - defaultContent: Specify the contents of the editor if it defaults to the editor. [Default: ''] - verify: A function that is used to test the input. If the test fails and the input is specified via a file or stdin, the Promise will be rejected. If the user wrote the contents in an editor .input will prompt the user to abort, or review the contents. [Default: null = constant true]. | | edit(file, verify) | Opens an editor to edit the given file. It is possible to specify a verify function that checks the user input and prompts the user to abort, or review when verify returns false. | | editContent(content, verify) | Opens an editor with the given content. It is possible to specify a verify function that checks the user input and prompts the user to abort, or review when verify returns false. |