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

@dash4/log

v0.9.3

Published

dash4 log helper

Downloads

211

Readme

NPM version License Commitizen friendly Prettier TypeScript-ready

The following documentation is just relevant for dash4 plugin development. For informations on how to use Dash4 please read this: Dash4 documentation

Table of Contents

Installation

npm i -D @dash4/log

Usage

server-side

import { log, info, success, error, warn, spinner } from '@dash4/log';

log('terminal', 'place text here');
info('readme', 'place text here');
success('npm-scripts', 'place text here');
error('dependencies', 'place text here');
warn('ui', 'place text here');

const spin = spinner('terminal', 'load config');
spin.start();
await wait(1000);
spin.type('warn');
spin.text('needs longer than usual');
await wait(1000);
spin.succeed('config loaded');

types

type TPackageName = 'server' | 'terminal-emulator' | 'cli' | string;
type TMessage = string | number | object | any[];
type TType = 'log' | 'info' | 'success' | 'error' | 'warn';

export const log = (packageName: TPackageName, message: TMessage) => void;
export const info = (packageName: TPackageName, message: TMessage) => void;
export const success = (packageName: TPackageName, message: TMessage) => void;
export const error = (packageName: TPackageName, message: TMessage) => void;
export const warn = (packageName: TPackageName, message: TMessage) => void;

export function spinner(packageName: TPackageName, message: TMessage, type?: TType): {
  start(): void;
  succeed(_message: string): void;
  fail(_message: string): void;
  warn(_message: string): void;
  info(_message: string): void;
  text(_message: string): void;
  type(_message: string): void;
  stop(): void;
  stopAndPersist(): void;
  clear: (): void;
  isSpinning: boolean;
  indent: number;
}

client-side

import { log, info, success, error, warn } from '@dash4/log/build/browser';

log('terminal', 'place some text here');
info('readme', 'place some text here');
success('npm-scripts', 'place some text here');
error('dependencies', 'place some text here');
warn('ui', 'place some text here');

types

export type TPackageName = 'client' | 'react-xterm' | 'ui' | string;
export type TMessage = string | number | object | any[];

export const log = (packageName: TPackageName, message: TMessage, ...args: TMessage[]) => void;
export const info = (packageName: TPackageName, message: TMessage, ...args: TMessage[]) => void;
export const success = (packageName: TPackageName, message: TMessage, ...args: TMessage[]) => void;
export const error = (packageName: TPackageName, message: TMessage, ...args: TMessage[]) => void;
export const warn = (packageName: TPackageName, message: TMessage, ...args: TMessage[]) => void;

License

The @dash4/log is MIT licensed