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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sp-packages/printer

v2.12.1

Published

A lightweight CLI tool and Node.js module for formatted console output.

Readme

Printer

✨ Features

  • 🎨 Rich formatting for messages (success, error, warning, info, headers)
  • 🔄 Verbose mode for detailed logging
  • 🧩 Minimal mode for clean, essential-only outputs
  • 🔇 Quiet mode to suppress non-essential output
  • 🌀 Spinner for showing progress during async operations
  • 🚀 Usable via CLI or programmatically in Node.js
  • 📜 Structured output for better readability
  • 🛠 Ideal for CI/CD, automation scripts, and development tools

📦 Installation

Global Installation (For system-wide CLI use)

npm install -g @sp-packages/printer

This allows you to use printer globally in your terminal.

Local Installation (For project-specific use)

npm install @sp-packages/printer --save-dev

Then, run it via:

npx printer success "Setup completed!"

🚀 CLI Usage

Basic Usage

printer <type> <message>

Message Types:

  • success - Green message for success output
  • error - Red message for errors (supports error objects)
  • warning - Yellow message for warnings
  • info - Blue message for general information
  • 📝 message - Plain text message (no formatting)

Examples:

printer success "Operation completed successfully!"
printer error "Something went wrong"
printer warning "This is a warning message"
printer info "Starting process..."
printer message "Simple message without formatting"

📜 Programmatic Usage (Inside Node.js)

You can also use printer inside your JavaScript/TypeScript projects.

Import and Use in Your Project

import { Printer } from '@sp-packages/printer';

Printer.success('Setup completed successfully!');
Printer.error('An error occurred', new Error('Database connection failed'));
Printer.warning('This is a warning message');
Printer.info('Fetching data...');
Printer.message('Regular message');

Using Spinner

The spinner feature is perfect for displaying progress during asynchronous operations. It shows an animated loading indicator that can be updated with success or error states.

import { Printer } from '@sp-packages/printer';

const spinner = Printer.spinner('Loading data...');

// During async operations
try {
  await someAsyncOperation();
  spinner.succeed('Data loaded successfully!');
} catch (error) {
  spinner.fail('Failed to load data!');
}

Spinner Methods:

  • spinner.start() - Start or restart the spinner
  • spinner.stop() - Stop and clear the spinner
  • spinner.succeed(text?) - Stop the spinner and show success state
  • spinner.fail(text?) - Stop the spinner and show failure state
  • spinner.warn(text?) - Stop the spinner and show warning state
  • spinner.info(text?) - Stop the spinner and show info state

Minimal Mode (Programmatic)

Minimal mode can be enabled programmatically to handle essential outputs

Enable Minimal Mode:

Printer.enableMinimal();
Printer.success('Minimal output');

Disable Minimal Mode:

Printer.disableMinimal();

Example (Minimal Mode ON):

Printer.enableMinimal();
Printer.success('Process completed');
Printer.log('Detailed execution log...');

Output:

✅ [SUCCESS] Process completed

Verbose Mode

Verbose mode provides detailed logging, which can be extremely helpful for debugging and development purposes. When enabled, it outputs additional information that can help you trace the execution flow and identify issues more easily.

Enable Verbose Mode:

Printer.enableVerbose();
Printer.log('This will display only in verbose mode.');

Disable Verbose Mode:

Printer.disableVerbose();

Example (Verbose Mode ON):

Printer.enableVerbose();
Printer.success('Process completed');
Printer.log('Detailed execution log...');

Output:

✅ [SUCCESS] Process completed
Detailed execution log...

Example (Verbose Mode OFF):

Printer.disableVerbose();
Printer.success('Process completed');
Printer.log('Detailed execution log...');

Output:

✅ [SUCCESS] Process completed

Benefits of Verbose Mode in npm Modules:

  • Enhanced Debugging: Verbose mode provides more context and detailed logs, making it easier to pinpoint where things might be going wrong in your code.
  • Better Traceability: With more information being logged, you can trace the execution path and understand the sequence of operations.
  • Improved Development Experience: Developers can get insights into the internal workings of the module, which can be particularly useful during development and testing phases.
  • Efficient Troubleshooting: Detailed logs can help in quickly identifying and resolving issues, reducing the time spent on debugging.
  • Single Control Point: Verbose mode can be enabled or disabled with a single flag, providing a centralized way to control the verbosity of logs.

Verbose mode is particularly useful in CI/CD pipelines, automation scripts, and during the development of complex Node.js applications where understanding the flow of execution is crucial.

Quiet Mode

Quiet mode suppresses all output, including errors. This can be useful when you need to ensure that no messages clutter the console output in production or automated environments.

Enable Quiet Mode:

Printer.enableQuiet();

Disable Quiet Mode:

Printer.disableQuiet();

Example (Quiet Mode ON):

Printer.enableQuiet();
Printer.success('Process completed');
Printer.warning('This warning will NOT be displayed');
Printer.error('Critical error!');

Output:

Note: When quiet mode is enabled, no messages will be printed, including errors.

Example (Quiet Mode OFF):

Printer.disableQuiet();
Printer.success('Process completed');
Printer.warning('This warning WILL be displayed');

Output:

✅ [SUCCESS] Process completed
⚠ [WARNING] This warning WILL be displayed

🎯 Example Outputs

✅ [SUCCESS] Operation completed successfully!
❌ [ERROR] An error occurred: Database connection failed
⚠ [WARNING] Be cautious! Proceeding with default values.
ℹ [INFO] Fetching data...
📝 [MESSAGE] Process initiated.

💡 Use Cases

  • CI/CD Pipelines – Enhance logs in automation scripts
  • Node.js CLI Tools – Format console outputs for better readability
  • Development Debugging – Enable verbose mode for debugging
  • Project Setup Scripts – Display status messages during installations
  • Minimal Output Needs – Use minimal mode for clean, script-friendly output

🤝 Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.


📜 License

This project is licensed under the MIT License. See the LICENSE file for details.