"""Main file to run the application.""" import os import subprocess import shutil def build_frontend(): """Build the frontend.""" frontend_dir = "cdrm-frontend" # Check and run npm commands if needed if not os.path.exists(f"{frontend_dir}/node_modules"): subprocess.run(["npm", "install"], cwd=frontend_dir, check=False) if not os.path.exists(f"{frontend_dir}/dist"): subprocess.run(["npm", "run", "build"], cwd=frontend_dir, check=False) # Move dist to frontend-dist if os.path.exists("frontend-dist"): shutil.rmtree("frontend-dist") shutil.copytree(f"{frontend_dir}/dist", "frontend-dist") print("✅ Build complete. Run the application with 'python main.py'") if __name__ == "__main__": build_frontend()