Skip to content

davej/john

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

john

Make npm'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 (OS X only)

Type: string
Default: blue

Color tag to use for dependencies. See available colors.

devDependencyColor (OS X only)

Type: string
Default: yellow

Color tag to use for devDependencies. See available colors.

dependencyHidden (Windows only)

Type: boolean
Default: false

Set to true to hide dependencies

devDependencyHidden (Windows only)

Type: boolean
Default: false

Set to true to hide dev dependencies


Available Colors (OS X only):

  • gray
  • green
  • purple
  • blue
  • yellow
  • red
  • orange
  • clear (This will remove all tags)

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

About

Make npm's flat dependencies easier to find and sort

Resources

License

Stars

Watchers

Forks

Packages

No packages published