isaacs/npm — pull request #1929 by pvorb (2011-12-23 02:22:53+00:00)
Title: Patch for Git bash on Windows issue

This is a patch for issue #1763.

This adds another shim for MSYS/Git Bash on Windows just like the cmd shims.

This is an example of the npm shim:
``` bash
#!/bin/sh

pushd "$(dirname "$0")" > /dev/null
NODE_DIR=`pwd -P`
popd > /dev/null

if [ -f "$NODE_DIR/node.exe" ]; then
"$NODE_DIR/node.exe" "$NODE_DIR/node_modules/npm/bin/npm-cli.js" $*
else
node "$NODE_DIR/node_modules/npm/bin/npm-cli.js" $*
fi
```

For the `pushd`-`popd` thing at the top see http://stackoverflow.com/questions/4774054/reliable-way-to-get-the-full-path-to-a-bash-script/4774063#4774063.

Please verify that this really writes the shim files. For some reason, I couldn't test it on my machine. When I run something like `npm build .` in my local npm folder, nothing (not even the .cmd-shims) are being rewritten.

Alternatively you could also provide me some information on how to test this.