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

@we-make-websites/tannoy

v1.12.0

Published

Simple terminal message outputting tool.

Downloads

74

Readme

📢 Tannoy (Tny)

Simple terminal message outputting tool.

🖨 Printing messages

Tny.message(message, options)

Prints a message to the terminal.

{Array|String} message - Message to output, each item in the array is printed on a newline.

options

  • {Boolean} after - Add empty newline after message, defaults to true
  • {Boolean} before - Add empty newline before message, defaults to false
  • {Boolean} empty - Clear terminal, defaults to false
  • {Boolean} newline - Set to false to prevent moving cursor to newline, overrides after when false

Shortcodes

These are tags which are dynamically replaced when generating the terminal message.

  • {{basis version}} - Replaced with current Basis version in its package.json
  • {{canvas version}} - Replaced with current Canvas version in its package.json
  • {{library version}} - Replaced with current Canvas Library Tools version in its package.json
  • {{storybook version}} - Replaced with current Canvas Storybook Tools version in its package.json

Tny.clear({ clear, move })

Moves the cursor and clears the terminal.

clear

  • {String} clear.direction - Direction to clear in, accepts all, before, or after.
  • {String} clear.type - Type of clear, accepts screen or line.

move

  • {String} move.direction - Direction to move, accepts up, down, right, or left.
  • {Number} move.lines - Number of lines to move.

🎨 Formatting messages

Tny.colour(colour, string)

Returns provided string with selected colour based on value of colour. Does not output the string, you must use message() or add() for this.

colour supports the following strings as values:

| Text | Text (bright) | Background | | --- | --- | --- | | black | brightBlack | bgBlack | | red | brightRed | bgRed | | green | brightGreen | bgGreen | | yellow | brightYellow | bgYellow | | blue | brightBlue | bgBlue | | magenta | brightMagenta | bgMagenta | | cyan | brightCyan | bgCyan | | white | brightWhite | bgWhite |

Note: When using background colour values the text colour is automatically set to the most contrasting (usually black).

⏳ Loading spinner

Tny.spinner.start(options)

Starts a spinner that shows each frame with a message.

options

  • {Array} frames - Each item in array is used as a frame in the animation
  • {Number} interval - Time in ms between each frame, defaults to 100
  • {String} message - Message to display after animation frame
  • {Object} states - Contains the messages for various states which are accessed by the value of state in Tny.spinner.stop(state)

Tny.spinner.stop(state)

Stops the spinner and replaces it with the message defined in states using state as the key to find it.

E.g. if states contained values for success and error then using Tny.spinner.stop('success') would display the success message.

🕑 Time

Tny.time(start, end)

Returns time taken with appropriate clock emoji where start is start time (or time taken in ms) and end is end time, both times should be ms from unix epoch.

📅 Changelog

See CHANGELOG.md for a history of changes.

🤝 Contribution

Before making any updates to Tannoy please talk to Craig Baldwin ([email protected])

Once any work is completed send a pull request to Craig for review.