bin-dir
Find the folder of a global command (installed via npm or not)
This is essentially a cross-os command for which
+ realpath
+ dirname
plus special support for npm modules.
"Special support" means that bin-dir eslint
won't open the directory .../eslint/bin
but .../eslint
Install
npm install --global bin-dir
CLI
$ bin-dir npm/usr/local/lib/node_modules/npm $ bin-dir wget/usr/local/Cellar/wget/1.18/bin $ bin-dir unicorns// no output
API
const binDir = ; === '/usr/local/lib/node_modules/xo'; === '/usr/local/bin'; === undefined;
License
MIT © Federico Brigante