#!/bin/bash

rm -r ./build

cd backend
tsc
cd ..

cd ./src
find ./ -name '*.html' -exec cp --parent \{\} ../build \; 
find ./ -name '*.html' -exec /usr/local/bin/gcp --parent \{\} ../build \;
cd ..

# if we did get the argument "test"
if [ "$1" = "test" ]; then
    webpack --config webpack.test.config.js
else
    echo "Building for production"
    webpack
fi