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

john

v1.1.0

Published

Make npm3's flat dependencies easier to find and sort

Downloads

17

Readme

john

Make npm3's flat dependencies easier to find and sort

npm version Build status: OS X Build status: Windows

npm3 has flat dependency trees, this is a good thing for many reasons. Unfortunately, this means your node_modules folder might contain hundreds (or thousands?) of modules and that makes it difficult to quickly debug/hack on issues with top-level dependencies.

On OS X

Puts color tags on your top-level dependencies and devDependencies, making top-level dependencies easier to find and sort in Finder.

If you often use the terminal instead of finder then you can also do ls -l | grep @ to list the folders with tags.

On Windows

Hides away non top-level dependencies and devDependencies, leaving you with just the modules that are important to you.

Note: This project is currently OS X & Windows only, but if you have ideas on how something similar could be implemented on Linux or other platforms then create an issue.

Table of Contents

CLI

$ npm install --global john

OS X

$ john --help

  Make npm3's flat dependencies easier to find and sort

  Usage
    $ john

  Options
    --clear     Clear all tags. [Default: false]
    --deps      Color for dependencies. [Default: blue]
    --dev-deps  Color for devDependencies. [Default: yellow]

  Available Colors:
    gray, green, purple, blue, yellow, red, orange, clear.

  Examples
    $ john
    Tagged 4 dependencies as blue
    Tagged 2 devDependencies as yellow

    $ john --clear
    Removed 4 tags from dependencies
    Removed 2 tags from devDependencies

    $ john --deps=purple --dev-deps=gray
    Tagged 4 dependencies as purple
    Tagged 2 devDependencies as gray

Windows

> john --help

  Make npm3's flat dependencies easier to find and sort

  Usage
    > john

  Options
    --clear     Clear all hidden dependencies. [Default: false]
    --deps      Hide dependencies. [Default: false]
    --dev-deps  Hide devDependencies. [Default: false]

  Examples
    $ john
    Hid 4 dependencies

    $ john --clear
    Unhid 4 dependencies

Using Programmatically

Install

$ npm install --save john

Usage

const john = require('john');

john('/path/to/project').then(
  (result) => console.log(result)
  // {
  //   dependencies: [
  //     { code: 0,
  //       command: 'xattr …',
  //       path: '/path/to/project/node_modules/finder-tag',
  //       tag: 'blue',
  //       module: 'finder-tag'
  //     },
  //     {…},
  //     {…}
  //   ],
  //   devDependencies: [
  //     {…},
  //     {…}
  //   ]
  // }
)

API

john(projectPath, [options])

projectPath

Type: string

The path to your project's directory (that contains package.json).

options

clear

Type: boolean
Default: false

Clear all tags / show all dependencies.


dependencyColor

Note: OSX Only

Type: string
Default: blue

Color tag to use for dependencies. See available colors.


devDependencyColor

Note: OSX Only

Type: string
Default: yellow

Color tag to use for devDependencies. See available colors.


dependencyHidden

Note: Windows only

Type: boolean
Default: false

Set to true to hide dependencies


devDependencyHidden

Note: Windows only

Type: boolean
Default: false

Set to true to hide dev dependencies


Available Colors:

Note: OSX only

  • gray
  • green
  • purple
  • blue
  • yellow
  • red
  • orange
  • clear

Why is this called John?

Asking the important questions! 'John' like 'Johnny' like 'Johnny Depp' like 'Dep[p]endency'. Pfft, mainly because it was short, simple and not already taken.

Contributors

Special thanks to @EnzoMartin for doing the Windows work.

License

MIT © DaveJ