Skip to content

Instantly share code, notes, and snippets.

@noherczeg
Created January 10, 2017 00:04
Show Gist options
  • Save noherczeg/3f2e616a1c564602b7d5183ded4e55fb to your computer and use it in GitHub Desktop.
Save noherczeg/3f2e616a1c564602b7d5183ded4e55fb to your computer and use it in GitHub Desktop.
npm repository centralizer
#!/bin/bash
node_version="$(node -v)"
target=$HOME/.node_modules/$node_version
if [[ ! -d $target ]]; then
echo "Creating local central repo at: $target"
mkdir -p $target;
else
echo "Using central local repo at: $target"
fi
echo "Linking node_modules to local central repo..."
if [[ -L node_modules && -d node_modules ]]; then
echo "... already linked."
else
ln -s $target node_modules
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment