Skip to content

Instantly share code, notes, and snippets.

@smithclay
Last active December 10, 2015 20:08
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 smithclay/4486483 to your computer and use it in GitHub Desktop.
Save smithclay/4486483 to your computer and use it in GitHub Desktop.
This script will prepare an package that uses grunt-0.3.x to use grunt-0.4.x. You may need to use superuser privileges to execute this script if you have grunt installed globally. Run this script in your grunt-0.3.x project directory that has been updated to use grunt-0.4.x.
#!/usr/bin/env bash
# Run this script in your grunt-0.3.x project directory that has been updated to use grunt-0.4.x
set -e
# Make sure node-0.8.x is installed
if node -v | grep ^v0.8.\* ; then
echo "You have node 0.8.x installed..."
else
echo "You need to install node-0.8 before continuing..."
read -p "Do you want want to install node using brew? " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
brew update && brew install node
else
echo "Install node-0.8.x from nodejs.com"
exit 1
fi
fi
# Cleanup node_modules directory of the project
if [ -d ./node_modules ]
then
echo "node_modules directory detected..."
npm prune
npm i
else
echo "Please run this script in a node.js project directory."
exit 1
fi
echo "Uninstalling grunt (from global)..."
npm uninstall -g grunt
echo "Installing grunt-cli (globally)..."
npm install -g grunt-cli
echo "Running grunt with default options..."
grunt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment