sports-matcher/scripts/build.py
2022-03-27 18:30:18 -05:00

18 lines
660 B
Python

#!/usr/bin/python
import os
import shutil
DEST_DIR = os.path.abspath("../server/public/")
BUILD_CMD = "react-scripts build"
os.chdir(os.path.abspath(os.path.join(__file__, "../../client")))
errorcode = os.system(BUILD_CMD)
if (errorcode):
print("There was an issue building the client via {}. See above log (exited with error code {}).".format(
BUILD_CMD, errorcode))
else:
print("Received error code of 0. Proceeding with copying files to the public server directory.")
shutil.copytree("./build/", "../server/public/.", dirs_exist_ok=True)
print("Completed copying built files to the public server directory \"{0}\".".format(
DEST_DIR))