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

nami-console

v2.1.2

Published

A fork of captainJS

Downloads

57

Readme

npm GitHub package.json version

Un fork de captainjs con algunas mejoras personalizadas pensadas para todo el branding de Nami al igual que con el trabajo de typescript, como lo pueden ser el uso de ecmascript y la eliminación completa de commonjs como espacio de trabajo.


¿Qué es captain.js?

Captain.js es una herramienta enfocada en brindar funcionalidades de la consola para Node.js, como lo son los colores, los prefijos, el debugger y los comandos.

Funcionalidades de consola

Formateado de la consola: Agrega formateado a la consolam dentro de las funciones de este paquete, como lo son los colores, los prefijos y el debugger.

import { Console } from 'nami-console';
console = new Console();

console.log("Esto es un log");
console.error("Esto es un error");;
console.warn("Esto es un advertencia por tu nivel de belleza");

Resultado:
[23:57:44] [Log] Esto es un log
[23:57:44] [Error] Esto es un error
[23:57:44] [Warn] Esto es una advertencia por tu nivel de belleza

Agregar configuración personalizada: Todos los parametros de la configuración son opcionales.

console = new Console({
    "use_colors": true,
    "format": "§8[§d%tiempo%§8] [%prefijo%§8] §7%mensaje%",
    prefixes: {
    "log_prefix": "§aLog",
    "warn_prefix": "§eAdvertencia",
    "error_prefix": "§cError",
    "info_prefix": "§bInformacion",
    "debug_prefix": "§bDebug"
    }
    
});

Colores

Colores en la consola directamente: Puedes usar un color especifico usando los prefixes para los colores.

import { Console } from 'nami-console';
console = new Console();

console.log("§dEsto es un texto en verde §ay verde claro");

Colores:
§0 = Black
§1 = Dark Blue
§2 = Dark Green
§3 = Dark Cyan
§4 = Dark Red
§5 = Dark Purple
§6 = Gold
§7 = Gray
§8 = Dark Gray
§9 = Blue
§a = Green
§b = Aqua
§c = Red
§d = Purple
§e = Yellow
§f = White
§r = Reset

Utilizando los colores usando los constantes: Puedes utilizar los colores usando las constantes de la clase Colors.

import { Color } from "nami-console";

console.log(Color.Red + "Hola esto es un texto rojito");

Comandos

Registra un comando: Registra un comando usando el metodo registerCommand, el cual recibe dos parametros, el primero es el nombre del comando y el segundo es la función a ejecutar cuando se ejecute el comando.

import { Commander } from 'nami-console';

const Commander = new Commander();

Commander.registerCommand("hello", (args) => {
    console.log("Hello world");
});

Commander.fetch();

Cambia la input de los comandos Cambia el texto que es mostrado al ejecutar un comando.

setPrefix("Pon un comando: ");

Organiza los comandos desconocidos: Manda un texto personalizado cuando el comando no se pueda encontrar.

Commander.onUnknownCommand((cmd) => {
    console.error("El comando que tratas de buscar no existe, comando: " + cmd);
})