build_option=${1:-1}
gesso_version="8.x-3.2"
git clone "https://github.com/forumone/gesso" "gesso"
cd gesso
git checkout $gesso_version

ln -s "../source" "source"

cd ..

if [ -f "gulpfile.js" ]; then
  cp gulpfile.js gesso
fi

if [ -f "package.json" ]; then
  cp package.json gesso
fi

echo "Removing Gesso files"
rm gesso.layouts.yml
rm gesso.info.yml
rm gesso.libraries.yml
rm gesso.breakpoints.yml
rm Dockerfile
rm screenshot.png
rm -rf templates
echo "Done removing gesso theme files."

echo "Running npm install ..."
cd gesso
npm install
echo "Done npm install."

echo "Removing style lint config and replacing with UW config ..."
rm .stylelintrc.yml
cp ../.stylelintrc.yml .
echo "Done removing style lint config and replacing with UW config"

echo "Running gulp build ..."
gulp build
echo "Done running gulp build."