#!/usr/bin/env bash

MAIN_PROJECT_DIR="../CloudUser/web/views/@default"
npm install
npm run build
if [ -d "${MAIN_PROJECT_DIR}" ]; then
	rm -rf "${MAIN_PROJECT_DIR:?}"/*
else
	echo "'${MAIN_PROJECT_DIR}' not exists"
fi

npm run build
cp  -r -f "./dist/views/"* "${MAIN_PROJECT_DIR}/"

if [ -d "${MAIN_PROJECT_DIR}" ]; then
	echo "*" > "${MAIN_PROJECT_DIR}/.gitignore"
fi

rm -rf "./dist/views"

echo "[done]"
