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

debugs

v1.0.11

Published

UI for DEBUG=debug:*

Downloads

61

Readme

debugs 🙈

npm install debugs -g

Features

  • No more remember debug scopes.
  • Choose debug scopes on debugs with keyboard.
  • Loaded from package.json and subdirectories.
  • Replace DEBUG=debug:* to DEBUG=${debugs -v}.
  • Configure bash/zsh/shell export by typing debugs init.
  • See flatten debugs options over subdirectories.

Usage

Use debug for logging.

peerDependencies debug must be installed.

// Basic use of debug package.
const debug_api = require('debug')('api')
const debug_api_cache = require('debug')('api:cache')

// outputs only if environment variable DEBUG has 'api' scope.
debug_api('api.validate %O', doSomething())
  
/* 
 * outputs only if environment variable DEBUG has 
 * 'api:cache' or 'api:*' or 'api*' 
 * scope. 
 */
debug_db('api.cache.validate %O', doSomething())

Add debug namespace items on package.json.

{
  "name": "example",
  "version": "1.0.0",
  "main": "index.js",
  "debugs": [
    "api",
    "api:cache"
  ]
}

Type debugs will show below.

? DEBUG=
❯ ◯ api
  ◯ api:cache

Press <space> to select, <a> to toggle all, <i> to inverse selection

Choose any and press enter(return).

? DEBUG=
 ◯ api
❯◉ api:cache

? DEBUG= api:cache

$ 

It's done. Apply changes by $ DEBUG=$(debugs -v) npm start or

// any-file.js

// will load package.json at project directory root.
require('debugs/init')

You may add .debugs to .gitignore.

Advanced use

Running debugs with

  • option --c, -v and value will partial output api,api:cache.
  • option --init, -i and init will full output export DEBUG=api,api:cache.

Edit start script to pre-apply debug values,

"scripts": {
  "start": "DEBUG=$(debugs -v) node index.js",
},

# DEBUG=$(debugs -v) nodemon index.js

prestart script either.

"scripts": {
  "prestart": "$(debugs init)",
  "start": "node index.js"
}

Without global install:

# shell
$ npm install --save-dev debugs

# package.json
"scripts": {
  "start": "DEBUG=$(node ./node_modules/debugs -v) node index.js",
  "debug": "node ./node_modules/debugs"
}

# shell
$ npm run debug

Include other json file or subdirectories.

{
  "name": "example",
  "version": "1.0.0",
  "main": "index.js",
  "debugs": [
    "api",
    "api:cache",
    "lib/something/package.json"
  ]
}

NEW Group all peer debugs into one state over subdirectories. (flatten)

.
├── package.json
├── peer1
│   └── package.json
└── peer2
    ├── package.json
    └── peer2a
        └── package.json

Only one .debugs root state file will be saved, and readable from any current working directory.

Authors

  • Jin Lee

License

  • MIT