Skip to content

Instantly share code, notes, and snippets.

@timdp
Created December 23, 2015 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timdp/1ffc2af2c53ffd3591d0 to your computer and use it in GitHub Desktop.
Save timdp/1ffc2af2c53ffd3591d0 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
[[ -f package.json && -d node_modules ]] || exit 1
export PATH="/c/Program Files/Git/bin:$PATH"
linked=$(find node_modules -maxdepth 1 -type l -printf '%P\n')
echo "Linked modules:"
echo "$linked"
bak=node_modules.$(date +%s)
echo "Backing up node_modules to $bak ..."
mv node_modules $bak
for mod in $linked; do
echo "Linking $mod ..."
cmd /c "npm link $mod"
done
echo "Installing ..."
cmd /c "npm install"
for mod in $linked; do
cd node_modules/$mod
echo "Reinstalling $mod ..."
cmd /c "npm install"
cd "$OLDPWD"
done
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment