Refactor npm-global.sh