-
-
Save AmrAbdulrahman/7c24ec3afb1319a3e782 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# NOTE: You need to set NPM_REMOTE_USER and NPM_REMOTE before running this script | |
# execute <npm command args..> on remote server | |
ssh "$NPM_REMOTE_USER"@"$NPM_REMOTE" ./npm.sh "$1" "$2" "$3" "$4" | |
# if command is [install, i, uninstall, un or prune] then sync node_modules and package.json | |
if [ "$1" == 'i' ] || [ "$1" == 'install' ] || [ "$1" == 'un' ] || [ "$1" == 'uninstall' ] || [ "$1" == 'prune' ] | |
then | |
# sync node_modules/ | |
rsync -r "$NPM_REMOTE_USER"@"$NPM_REMOTE":~/remote-node-modules/node_modules/ node_modules | |
# sync package.json | |
rsync "$NPM_REMOTE_USER"@"$NPM_REMOTE":~/remote-node-modules/package.json package.json | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment