amio/npm-why

Tweak output – don’t display “undefined”?

lydell opened this issue · 3 comments

First off, thanks for making this tool! I’ve been missing yarn why in projects that use npm. I like it!

In all projects that aren’t to-be-published npm packages, I keep my package.json as minimalistic as possible: No name, version, license fields etc. – just private: true and dependencies (see lydell/blog#1).

This seems to cause npm-why to print undefined in a few places:

# The setup:
~/stuff/npm-why  
❯ cat package.json 
{
  "private": true,
  "dependencies": {
    "npm-why": "1.1.0"
  }
}

# Perhaps we could show the directory name for package.json instead of undefined?
~/stuff/npm-why  
❯ ./node_modules/.bin/npm-why chalk

  Who required chalk:

  undefined > npm-why > chalk@2.4.1

# Here’s some more undefined, but I’m not sure what it even means running without arguments.
~/stuff/npm-why  
❯ ./node_modules/.bin/npm-why

  Who required undefined:

  undefined@undefined

In summary, this doesn’t matter much (the tool works just fine anyway), but it’d be a nice little tweak to the output, don’t you think?

amio commented

Good catch 👍
This should get fixed.

amio commented

1.1.2 is released 😉

Nice! 🎉