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

simple-js-term

v2.0.2

Published

Simple web terminal written in js

Readme

simple-js-term

Simple web terminal written in ts

Setup

To setup a terminal, create a div element and initialize it using:

let terminal_div = document.getElementById('console');
let terminal = new shell.create_terminal(terminal_div);

make sure you have simple-js-term imported.

Commands

You can easily add commands using create_command. Note that new commands for the terminal are always available for all terminals in the window (if you would have multiple terminals initialised). And example is found below:

shell.create_command('spam', (process, args, kwargs) => {
    let count = parseInt(args[0]);
    let message = args[1];
    for (let i = 0; i < count; i++) {
        process.log(message);
    }
});

This command will print the text of the second argument, a number of times equal to the first argument, e.g.

spam 12 message

Arguments

Commands can make use of args and kwargs. Parsing is done using shell-quote. Determining args and kwargs is done using minimist.

Terminal

Commands can interact with the terminal using the process.

  • Read: var input = await process.input()
  • Write: process.log(message)
  • Exit: process.exit(exit_code)
  • Running other commands: process.call(command_string)

Examples

These are example commands that are available in the terminal.

create_command("read", async (process, args, kwargs) => {
    await process.input();
});
create_command("echo", async (process, args, kwargs) => {
    process.log(args.join(" "));
});
create_command("exit", async (process, args, kwargs) => {
    process.exit();
});

Styling

This library allows to color your text, add bold, underline, strikethrough and italic.

Styling is done using & followed by a letter, number or # for custom colors. The default, built-in formatting codes are inspired by minecraft and listed below. When you add a color formatting code, the other formatting (bold, italic ...) will reset.

| formatting code | color or format | |-----------------|-----------------| | "0" | "#000000" | | "1" | "#0000aa" | | "2" | "#00aa00" | | "3" | "#00aaaa" | | "4" | "#aa0000" | | "5" | "#aa00aa" | | "6" | "#ffaa00" | | "7" | "#aaaaaa" | | "8" | "#555555" | | "9" | "#5555ff" | | "a" | "#55ff55" | | "b" | "#55ffff" | | "c" | "#ff5555" | | "d" | "#ff55ff" | | "e" | "#ffff55" | | "f" | "#ffffff" | | "l" | bold | | "m" | line-through | | "n" | underline | | "o" | italic | | "r" | reset |

Examples are given below:

create_command("morning", async (process, args, kwargs) => {
    process.call("echo 'The following text will be aqua: &bGood morning!'");
});
create_command("pink", async (process, args, kwargs) => {
    process.call("echo '&#ffb6c1This will be pink'");
});

Contributing

If you want to contribute to this project, feel free to open an issue or a pull request on github. Contributions are always welcome!

License

This project is licensed under the MIT License.