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

terminal-kit-plugins

v1.1.0

Published

Plugin features for terminal-kit

Downloads

50

Readme

TerminalKit Plugins

Build Status

Useful additional tools for TerminalKit.

Installation

Install the NPM library:

npm install terminal-kit-plugins

Add the tools to TerminalKit using the plugin method:

var term = require('terminal-kit').terminal;
require('terminal-kit-plugins').plugin(term);

Examples

Examples are available in /tests/sample and can be executed on the CLI as a node script.

Elements

Message

Prints a simple styles messages to the terminal.

term.Message("Oh no!", "error");

Ideal for styling all the CLI messages in your application the same way, depending on message type.

MessageBox

Prints a positioned stylised message alert box on the terminal.

term.MessageBox({
    message: "Alert!",
    style: term.brightYellow.bgRed, 
    x: 'middle',
    y: 'middle',
    xPadding: 2,
    yPadding: 1,
    border: 1, // Border style
})
.show();

Nice for CLI GUI-esq notices.

Confirm

Basic yes/no confirm prompt using promises

const likesCheese = await term.Confirm().confirm("Do you like cheese?");

Text Prompt

Basic input text prompt using promises

const cheeseKg = await term.TextPrompt().ask("How many kilograms of cheese would you like?", "50");

Header Bar

Stylised header menu which can receive button presses and execute actions.

const bar = term.HeaderBar({
    x: 0,
    y:0,
    width: null, // full width
    style: term.bgBrightYellow.black,
    divider: "|",
    dividerStyle: term.bgBrightYellow.brightRed,
    padding: 4,
    get: "label",
    getKey: "key",
})
    .add({ label: "Alpha", key: "F1", action: () => { console.log('A'); } })
    .add({ label: "Bravo", key: "F2", action: () => { console.log('B'); } })
    .on('selected', (item) => {
        item.action();
    })
    .redraw();

Handy as a shortcut menu throughout your application.

Action List

List of actions which accepts keyboard navigation input

term.ActionList({
    x: 0,
    y: 2,
    width: 40,
    style: term.brightYellow.bgBlack,
    selectedStyle: term.black.bgBrightYellow,
})
    .add("Alpha", () => { console.log('A') })
    .add("Bravo", () => { console.log('B') })
    .add("Randomly show", () => {}, () => { return (Math.random() > 0.5); })
    .show();

Simple way to scroll through some action options.

Data Table

Displays a table of data which can contain more items than the current screen height supports. Provides type-to-search, scrolling, and extensive style options.

const table = term.DataTable({
    x: 0,
    y: 5,
    width: null, // Full width
    height: 5, // 5 items high
    style: term.brightWhite.bgBlack,
    selectedStyle: term.bgBrightWhite.black,
    scrollPadding: 3, // Page starts scrolling when cursor gets those close to the edge
    padding: 1, // Padding between cells
    filterTextSize: 16, // Size of type-to-search filter
    columns: [
        {
            get: 'name',
            width: 20,
        },
        {
            get: (item) => (item.online ? "Online" : "Offline"),
            width: 10,
            style: (item) => (item.online ? term.brightGreen : term.brightRed),
        },
    ]
});

table.setData([
    { name: "Primary service", online: false },
    { name: "Backup system", online: true },
    { name: "Something else", online: true },
]);

table.promise.then((item) => {
    console.log("Selected: " + item.name);
});

Good for extensive or unbound lists which you might want to search.