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

@untool/info

v2.1.3

Published

untool info mixin

Downloads

812

Readme

@untool/info

travis npm

@untool/info is a core mixin providing output for untool's command line interface. Besides that, it allows other mixins to define pre-flight checks that are run during application startup.

Installation

$ yarn add @untool/info # OR npm install @untool/info

CLI

@untool/info does not define any commands of its own, but only adds some global CLI flags to control console output. Using the flags -v/--verbose and -q/--quiet once or multiple times, you can de- and increase the log output. Default log level is info, passing a single -q will reduce it to warning while a single -v will bump it to verbose. Passing -qqq will silence all output completely.

Log Levels

{
  error: 0,
  warning: 1,
  info: 2,
  verbose: 3,
}

Additionally, you can pass --color/--no-color flags to manually enable or disable output colors, but you can usually rely on @untool/info to determine color support automatically.

$ un start -v --no-color

API

@untool/info exposes a couple of utility mixin hooks other mixins can implement.

getLogger() (callable)

This utility hook defined by @untool/info provides other mixins with a fully configured logger instance. This logger has three standard log methods (info, warning and error) that correspond to the lower three log levels described above. Additionally, it supports arbitrary log methods (e.g. request, hint, foo)

const { Mixin } = require('@untool/core');

module.exports = class FooMixin extends Mixin {
  bar() {
    if (typeof this.getLogger === 'function') {
      const logger = this.getLogger();
      logger.info('this will log an info message');
      logger.warning('this will log a warning message');
      logger.error('this will log an error message');
      logger.baz('this will log a verbose message');
      logger.qux('this will log a verbose message, too');
    }
  }
};

diagnose(doctor) (parallel)

By implementing this method, your core mixin can perform pre-flight checks during application startup and return an array of warnings. If you need to do something asynchronous at this point, just return a Promise.

const { Mixin } = require('@untool/core');

module.exports = class FooMixin extends Mixin {
  diagnose(doctor) {
    doctor.diagnoseDuplicatePackages('bar');
    if (1 + 1 !== 2) {
      return ['Math is broken.'];
    }
  }
};

Additionally, you can use the helper methods defined on our semi-private doctor object that is being passed into this hook.