From cc3b37db1db8a782b6c85cc64f38e86709a0ef91 Mon Sep 17 00:00:00 2001 From: voldemort <5692900+yell0wsuit@users.noreply.github.com> Date: Wed, 23 Jul 2025 18:04:19 +0700 Subject: [PATCH] Add frontend build check in precheck module to ensure the frontend is built before running prechecks --- custom_functions/prechecks/precheck.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/custom_functions/prechecks/precheck.py b/custom_functions/prechecks/precheck.py index f05e23e..8710ec2 100644 --- a/custom_functions/prechecks/precheck.py +++ b/custom_functions/prechecks/precheck.py @@ -1,13 +1,28 @@ """Module to run the prechecks.""" +import os +import subprocess + from custom_functions.prechecks.folder_checks import folder_checks from custom_functions.prechecks.config_file_checks import check_for_config_file from custom_functions.prechecks.database_checks import check_for_sql_database from custom_functions.prechecks.cdm_checks import check_for_cdms +def check_frontend_built(): + """Check if the frontend is built; if not, run build.py.""" + frontend_dist = os.path.join(os.getcwd(), "frontend-dist") + frontend_dist = os.path.abspath(frontend_dist) + if not os.path.exists(frontend_dist) or not os.listdir(frontend_dist): + print("Frontend has not been built. Running build.py...") + subprocess.run(["python", "build.py"], check=True) + else: + print("Frontend build found.") + + def run_precheck(): """Run the prechecks.""" + check_frontend_built() folder_checks() check_for_config_file() check_for_cdms()