#!/bin/bash

if [ $# -ne 1 ]; then
  echo "./build.sh [stage|prod]"
  exit 1
fi

ENV=$1

set -x
rm -rf build
mkdir -p build
cat index.${ENV}.html | sed "s/GIT_HASH/`git rev-parse --short HEAD`/g" >  build/index.html
./node_modules/webpack/bin/webpack.js -p --config webpack.stage-prod.config.js

#!/bin/bash

if [ $# -ne 1 ]; then
  echo "./build.sh [stage|prod]"
  exit 1
fi

ENV=$1

set -x

if [ -d ".git" ]; then
  VER=`git rev-parse --short HEAD`
else
  VER=`date +%s`
fi

rm -rf build
mkdir -p build
cat index.${ENV}.html | sed "s/GIT_HASH/$VER/g" >  build/index.html
./node_modules/webpack/bin/webpack.js -p --config webpack.stage-prod.config.js

Add timestamp to the app.js version if there is no git enviroment
Add timestamp to the app.js version if there is no git enviroment
