I've created a new command to execute commands using local binaries before global ones. The command auto completes based on which binaries are available in the node_modules/.bin.
npm exec jasmine-node spec
npm exec jake build
Tested under Linux (arch) and Windows 7. I don't have an OSX machine to try it out on though.
Added exec command.
Added error output to npm exec.
Added auto completion of local bin.
Fixed for windows.
Added streaming output.
Fixed live output.
feature is totally needed
+1: This largely obliviates the need for global module installs during day-to-day development, which is a good thing.
utils/output.js has been removed. Either use console.log for "normal" output, or require("npmlog") for log output.
Synopsis should match usage string.
+1 on the feature, but the implementation is not correct here. For example, if you depend on grunt, and it's provided by a parent package's dependencies, then you won't be able to access the grunt binaries. Also, the npm config settings provided to scripts are not being set, etc.
A better approach would be to abstract out the utils/lifecycle.js module so that it was less scripts-object oriented, but used the same logic in a DRY fashion, rather than constructing a cmd string which sets a PATH environ. (The correct way to set an environment variable is via the env hash passed to child_process.spawn; lifecycle.js does this.)
Then, lifecycle.js can call the exec function with an additional environment variable specifying the scripts-specific stuff. (Ie, the npm_lifecycle_event and npm_lifecycle_script environment vars.)
+1 (If the things mentioned in #2460 (comment) are fixed, of course.)
Looked at the code, not sure if I could pull this off. Any chance of this getting implemented (properly) by the core team? :p
The issue to target for this is #3313