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

@futils/commandline

v1.0.0

Published

A simple utility for using the commandline

Downloads

2

Readme

commandline

A simple utility for using the commandline

Issues and Pull Requests

colors

This object contains a list of colorcodes for ansi 256 terminals

color

type Color =
    | {
          space: 'fg' | 'bg';
          color:
              | 'black'
              | 'blue'
              | 'cyan'
              | 'gray'
              | 'green'
              | 'magenta'
              | 'red'
              | 'white'
              | 'yellow';
      }
    | {
          space: 'fgBright' | 'bgBright';
          color:
              | 'black'
              | 'blue'
              | 'cyan'
              | 'green'
              | 'magenta'
              | 'red'
              | 'white'
              | 'yellow';
      }
    | {
          space: 'reset';
          color:
              | 'all'
              | 'underline'
              | 'bold'
              | 'strikethrough'
              | 'italic'
              | 'bg'
              | 'fg'
              | 'colorAll'
              | 'style';
      }
    | {
          space: 'style';
          color: 'italic' | 'strikethrough' | 'underline' | 'bold';
      };
function color(text: string, color: Color): string;

Color a text

getInput

function getInput(question: string): Promise<string>;

Gets input from the user over stdin

removeTerminalColors

function removeTerminalColors(text: string): string;

Removes terminal (ansi) colorcodes from a string

removeAnsiColors

function removeAnsiColors(text: string): string;

Removes ansi colorcodes from a string

createTextbox

function createTextbox(title: string | undefined, contents: string): string;

Creates a textbox

createTable

function createTable<T extends string>(
    header: string,
    keys: T[],
    data: { [Key in T]: string | number | boolean | { type: 'delimiter' } }[],
    differentiateLines: boolean | undefined = false
): string

Creates a table. Specify all the keys in the keys array. The header is the title. Specify the data into data. The data can be a delimiter by setting the current data value to { type: 'delimiter' }.

applyPadding

export interface PaddingOptions {
    top?: number;
    left?: number;
    right?: number;
    bottom?: number;
}
function applyPadding(str: string, padding?: PaddingOptions);

Applies padding (uses spaces ( ) and newlines (\n))

TextboxBuilder

Creates a textbox

setTitle

function setTitle(title: string): TextboxBuilder;

sets the title

setFooter

function setFooter(footer: string): TextboxBuilder;

sets the footer

paddingLeft

function paddingLeft(padding: number): TextboxBuilder;

Sets the padding to the left

paddingRight

function paddingRight(padding: number): TextboxBuilder;

Sets the padding to the right

padding

function padding(padding: { left: number; right: number; }): TextboxBuilder;

Sets the padding

getPaddingLeft

function getPaddingLeft(): number;

Gets the left-padding

getPaddingRight

function getPaddingRight(): number;

Gets the right-padding

getPadding

function getPadding(): { left: number; right: number; };

Gets the padding

getFooter

function getFooter(): string;

Gets the footer

addLine

function addLine(line: string): TextboxBuilder;

Adds a line to the textbox

addLines

function addLines(lines: string|string[]): TextboxBuilder;

Adds 1 or more lines to the textbox

setMinLength

function setMinLength(length: number): TextboxBuilder;

Sets the minimum length of the textbox

getMinLength

function getMinLength(): number;

Gets the minimum length

addDivider

function addDivider(): TextboxBuilder

Adds a divider between lines

getLines

function getLines(): (string|{ type: 'divider' })[];

Gets the lines

getTitle

function getTitle(): string;

Gets the title

removeLine

function removeLine(last?: boolean): TextboxBuilder

Removes the last or first line. Defaults to firstline

build

function build(): string;

Builds the textbox

log

function log(loggingFunction?: (text: string) => void): void;

Logs the textbox, defaults to console.log