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

center-console

v2.2.1

Published

a tool to center console output

Readme

center console

jsx for your terminal

what

this will allow you to layout dynamic console output with an increasingly html complete api as i flesh out features

why

i wanted a simple way to control some output at work, but couldn't justify spending any real time on it.

install

yarn add center-console

jsx interface

thanks to babel and it's custom transform for jsx stuff, along with typescript support, we have been able to create a custom 'dom like' and 'react inspired' c-dom. Our render function relies on this 'createElement' function to build the children, and to use the fiber based dom processor.

import ConsoleRender from '..';
import Component from '../component';

const multiLine = `text
and
lines`;

const MultiDiv = ({ children } : {children: any}) : ConsoleDiv => <div alignContent="center" alignSelf='center' height={50}>
  {children}
</div>;

class StatefulSplash extends Component {
  interval?: NodeJS.Timer

  startTime: number

  constructor(...props) {
    super(...props);
    this.state = {
      date: 0,
    };
    this.startTime = Date.now();
    this.interval = setInterval(() => {
      this.setState({
        date: Date.now() - this.startTime,
      });
    }, 1000);
  }

  render() {
    const { date } = this.state;
    const runTime = `running for ${date}ms`;
    return <main>
      <div alignSelf='top' height={25}>
        <span alignContent="left" width={75} color='#2832c2' background='#ffff00'>logo</span>
        <span alignContent="right" width={25} background='#ffff00'>{runTime}</span>
      </div>
      <MultiDiv>{multiLine}</MultiDiv>
      <div alignSelf="bottom" height={25}>
        <span alignContent="left" width={33}>left</span>
        <span alignContent="center" width={33}>right</span>
        <span alignContent="right" width={33}>centers</span>
      </div>
    </main>;
  }
}

const someDom = new ConsoleRender();
someDom.display(<StatefulSplash />);

this will output this:

logo                                          running for 1000ms












                              text
                              and
                             lines












left                         right                      centers

babel config

to use this you gotta update your babel for use with custom jsx like this:

module.exports = {
  presets: ['@babel/env', '@babel/typescript'],
  plugins: [
    [
      '@babel/plugin-transform-react-jsx',
      {
        runtime: 'automatic',
        importSource: 'center-console/runtime',
      },
    ],
  ],
};

and make sure you make ts preserve jsx:

{
  "compilerOptions": {
    ... other options,
    "jsx": "preserve",
  }
}

jsx props

there are like 4 props we accept. please use the JSX export this package provides to see what is useable.

as of now you can basically break up the terminal into heights and widths by percent and control vertical/horizontal layouts.

color support

you can add color or background to any element and we will pass the value you supply to the chalk hex function. we support text and background colors.

old school api (still totally cool and very legal)

import

import { CenterConsole } from 'center-console';

const log = new CenterConsole();

log.render(`

hey

`);

there is a type export, refer to it cuz source code rarely gets out of sync with itself, idk about these docs.

prior art

c-dom based on a reworking for node of pombo diy react. not a whole hell of a lot of that applied, and it turns out that also having to build a dom sucked.

about the author

i like to write dev tools, this can make those tools "sparkle"

contributing

open pr, pass lint and commit style, merge