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

squeak

v1.3.0

Published

A tiny stream log

Downloads

1,824,738

Readme

squeak Build Status

A tiny stream log

Install

$ npm install --save squeak

Usage

var Squeak = require('squeak');
var log = new Squeak()
	.type('info')
	.type('success', {color: 'green'})
	.type('warn', {color: 'yellow'})
	.type('error', {color: 'red'}, function () {
		log.end();
		process.exit(1);
	});

log.info('this is a info message');
log.success('this is a success message');
log.warn('this is a warning');
log.error(new Error('this is an error').stack);

/*
     info : this is a info message
  success : this is a success message
     warn : this is a warning
    error : this is an error
    at ChildProcess.exithandler (child_process.js:648:15)
    at ChildProcess.emit (events.js:98:17)
 */

You can also customize the different types to use a custom prefix using the prefix option:

var Squeak = require('squeak');
var log = new Squeak({separator: ' '})
	.type('success', {color: 'green', prefix: '✔'})
	.type('warn', {color: 'yellow', prefix: '⚠'});

log.success('this is a success message');
log.warn('this is a warning');

/*
  ✔ this is a success message
  ⚠ this is a warning
 */

API

new Squeak(options)

Creates a new Squeak instance.

options.align

Type: boolean
Default: true

Whether to align the prefixes or not. E.g:

     foo : hello
  foobar : world

options.indent

Type: number
Default: 2

Sets the indentation.

options.separator

Type: string
Default: :

Customize the separator between the prefix and the message.

options.stream

Type: stream
Default: process.stderr

Which stream to write to.

.write(args)

Type: string

Writes to options.stream, using process.stderr by default.

.writeln(args)

Type: string

Same as .write() but with a new line.

.writelpad(args)

Type: string

Same as .write() but with padding.

.type(type, options, callback)

Adds a type.

type

Type: string

The name of the type. Will be used as prefix by default.

options.color

Type: string

Sets the prefix color. Supported colors can be found here.

options.prefix

Type: string

Sets the type prefix. Uses type by default.

callback

Type: function

An optional callback to be called when the type is called.

.emit(event, data)

Emits an event.

.end(callback)

Type: function

Writes a newline and executes an optional callback function.

License

MIT © Kevin Mårtensson