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

reactty

v0.0.17

Published

reactive mustache-like templating for a tty world

Downloads

25

Readme

reactty

have YOU ever wanted to make a cli app that looks and feels kinda maybe like a desktop or webapp? is ncurses too rich for your blood? have you had to settle for spamming console.logs like a peasant? have I got a thing for YOU!

introducing (for the first time ever) reactive mustache-like templating for TTY!!!

just follow the steps:

  1. create a template (any mustache template will do, i'm using handlebars under the hood)
  2. create a view with that template
  3. just update the context object and...
  4. voilà, shit just rendered the change itself!

usage

npm install --save reactty

for now, check out ./test/basic.js for features

things to note:

  • if the output is too big, scroll around with the arrow keys (issue #2) or the mouse wheel (issue #12). if excess data exists above or below, indicator arrows will appear (issue #4)
  • the display seen when resizing the window is a little bit broken (due to how node triggers its resize event, it will always be one step late)
  • templates now support color and styles. the (tentative) syntax is available in test/styles-template.hbs (issue #8)
  • display will only re-render if its contents have changed (issue #10)
  • on a safe (code 0) exit from the program, the full output, as defined in the template, will be printed for easy copy/paste of the output (issue #6)
var reactty = require('reactty');

/*
 * new reactty.View(TEMPLATE_SOURCE_STRING)
 *
 * Create a view that will clear and replace stdout with your template.
 * Any updates to the view's data will immediately reflect in the
 * rendered text, without needs for manually notifying the view of
 * changes. Neato!
 *
 * It'll throw an error if the terminal running the program does not
 * support TTY, and will tell you to fallback to peasant logging schemes
 * for output.
 */
var view = new reactty.View('Hi, my name is {{name}}');

// update the context and the view will update accordingly
setTimeout(function() {
	view.data.name = 'tangmi';
}, 1000);

// TODO:
//   * talk about color helpers `test/styles.js`
//   * talk about .stop() and .start() `test/exit.js`