Skip to content

Instantly share code, notes, and snippets.

@philwilliammee
Last active March 6, 2019 15:35
Show Gist options
  • Save philwilliammee/5e5e8f06c8c5cd1dc820b74ef8187b88 to your computer and use it in GitHub Desktop.
Save philwilliammee/5e5e8f06c8c5cd1dc820b74ef8187b88 to your computer and use it in GitHub Desktop.
#!/bin/bash
if type -P git > /dev/null
then
echo "installing from repo"
git clone https://github.com/philwilliammee/react-mix-starter.git
cd react-mix-starter/
echo "removing remote url"
git remote rm origin
else
echo "Error: installation failed GIT is required"
exit 0
fi
if type -P npm > /dev/null
then
echo "installing node files"
npm install
npm update
else
echo "Error: installation failed NPM is required"
exit 0
fi
CUR_VER=$(npm -v)
MIN_VER=6.0
if [ $(awk '{printf($1 >= $2) ? 1 : 0}' <<<" $CUR_VER $MIN_VER ") -eq 1 ] ;
then
echo "checking for sucurty vulnerabilities and fixing"
npm audit fix
else
echo "updating to the latest version of npm"
npm install npm@latest -g
echo "checking for sucurty vulnerabilities and fixing"
npm audit fix
fi
echo "testing build"
npm run dev
if type -P lando > /dev/null
then
read -r -p "Do you want to start lando server? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
lando start
fi
fi
echo "installation complete"
echo "you may want to run$ npm run watch "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment