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

observatory

v1.0.0

Published

Beautiful UI for showing tasks running on the command line.

Downloads

11,574

Readme

Observatory Build Status

Beautiful UI for showing tasks running on the command line.

Purpose

Instead of just logging long running tasks to the console, give your users a simple status dashboard.

observatory

Installation

$ npm -g install observatory

Examples

node ./examples/buzzwords.js

An example using fake data that tries to look like a real-world usage.

node ./examples/long-line.js

An example of what happens when text is so long it needs to wrap to another line.

Usage Example

var observatory = require('observatory');

//add a task to display
var task = observatory.add('Install packages...');

//while working on the task, update the status
task.running('Copying Files');

//optionally give details
task.details(percent + '% ' + filename);

//chain commands
task.status('Compressing Images')
    .details(directoryName);

//when complete
task.done('Finished!');

//or if it failed
task.fail('Ooops');

Terminology

[Test Runner] Running tests on Safari  Running Now  50%  CSS3 Tests
⇧ prefix      ⇧ description            ⇧ status     ⇧ details

API

observatory.add(description)

description string Required description.
returns a new task

Adds a task to the console. This method returns a task object, you should store it in a variable so you can use it for the methods bellow.

var copyFilesTask = observatory.add('Copy files');

Task Methods

All task methods return the task object so that you can chain functions, such as task.done().status('Installed!');.

task.status(statusLabel)

statusLabel string Set the status value.

Displays a short message to the right of the description. Use it to show users in a word or two that suggests what is happening.

Examples:

  • task.status('Downloading');
  • task.status('Running');
  • task.status('Complete');

task.details(detailsLabel)

detailsLabel string Set the details value.

Optional provide details about what's happening, such as file names, urls, tests names.

Examples:

  • task.details('Copying var/tmp/whatever to var/whater/tmp');
  • task.details('Compressing bigimage.png');
  • task.details('Testing services');

task.done(statusLabel)

statusLabel string Set the status value. Default: ✓ Done.

  • task.done();
  • task.done('Compressed!')

task.fail(statusLabel)

statusLabel string Set the status value. Default: ✗ Failed.

  • task.fail();
  • `task.fail('Disconnected');

Override Settings

observatory.settings(settingsObject)

Tweak how tasks are rendered.

settingsObject

  • width Integer, width in characters of the description and status area. This is used to right justify the status. Default is 55.
  • prefix Sting, Text to prepend each line. Default is ' ⫸ '.
  • write Function(content). Writes the content to the output. Defaults to process.stdout.write.
  • formatStatus Function(statusLabel, STATE)

returns observatory so you can use it on the require statement.

var observatory = require('observatory').settings({
  prefix: '[bower] '.white
});

observatory.STATE

A constant for the different states. Only useful if you need to change formatStatus above.

The values:

  • observatory.STATE.active Defaults to using default console color.
  • observatory.STATE.done Defaults to using green.
  • observatory.STATE.fail Defaults to using red.

Acknowledgements

Inspiration

  • My coworker Nick at Opower for inspiring the need for this library.
  • Bower, inspiring the clean layout.
  • Inqurire.js, for showing console apps can have a nice UI.

Release History

  • 15 October 2015 - 1.0.0 - Update dependencies, fix tests and bugs thanks to @rstacruz.
  • 20 October 2013 - 0.1.0 - Some cleanup thanks to @nickheiner, new write method.
  • 15 October 2013 - 0.0.1 - First version

License

Copyright (c) 2015 Dylan Greene
Licensed under the MIT license.