isaacs/npm — pull request #3375 by samshull (2013-04-25 17:34:11+00:00)
Title: Add npm-exec(1) as command for executing dependency executables

There is always the chance that this functionality already exists in npm, if so, just close this and point me to it, thanks. This is intended to reproduce the basic functionality of `bundle exec` in npm.

There is a very good chance this is incomplete or incorrect in some way or another, but it works for the specific use case that it was written for: `npm exec mocha -- --colors test/file.test.js`.

There is also the question of how this should be handled from an API perspective. Should npm.exec use the directory of the package that it is referenced from or the package that it is referenced in? i.e.: I use npm.exec to execute an executable in my node_modules directory and the executable that is being executed wants to use npm.exec to execute an executable in it's own node_modules folder.

Hopefully, this commit will get the ball rolling on this discussion.

references #1543