Created
February 5, 2024 14:49
-
-
Save kbakdev/ea6f497f3ce6c1abe7d5d9a7fcbb7669 to your computer and use it in GitHub Desktop.
node_modules sync
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 | |
REMOTE_USER=$1 | |
REMOTE_HOST=$2 | |
REMOTE_PATH="/home/$REMOTE_USER" | |
LOCAL_PATH=$(pwd) | |
echo "Zipping node_modules..." | |
zip -r -q ../node_modules.zip node_modules/* | |
echo "Copying node_modules.zip from $REMOTE_HOST..." | |
scp $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH/node_modules.zip $LOCAL_PATH | |
echo "Removing existing node_modules directory..." | |
sudo rm -rf node_modules | |
echo "Unzipping node_modules.zip..." | |
unzip -q node_modules.zip | |
echo "Cleaning up..." | |
rm -rf node_modules.zip | |
echo "Process completed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment