Merge branch 'main' into develop-frontend
This commit is contained in:
commit
d5ca543d9c
@ -5,7 +5,8 @@ import frappe
|
|||||||
from custom_ui.utils import create_module
|
from custom_ui.utils import create_module
|
||||||
|
|
||||||
@click.command("build-frontend")
|
@click.command("build-frontend")
|
||||||
def build_frontend():
|
@click.option("--site", default=None, help="Site to build frontend for")
|
||||||
|
def build_frontend(site):
|
||||||
app_package_path = frappe.get_app_path("custom_ui")
|
app_package_path = frappe.get_app_path("custom_ui")
|
||||||
app_root = os.path.dirname(app_package_path)
|
app_root = os.path.dirname(app_package_path)
|
||||||
|
|
||||||
@ -31,6 +32,23 @@ def build_frontend():
|
|||||||
else:
|
else:
|
||||||
frappe.log_error(message="No frontend directory found for custom_ui", title="Frontend Build Skipped")
|
frappe.log_error(message="No frontend directory found for custom_ui", title="Frontend Build Skipped")
|
||||||
click.echo(f"\n⚠️ Frontend directory does not exist. Skipping build. Path was {frontend_path}\n")
|
click.echo(f"\n⚠️ Frontend directory does not exist. Skipping build. Path was {frontend_path}\n")
|
||||||
|
if not site:
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
print(f"\n🧹 Clearing cache for site {site}...\n")
|
||||||
|
subprocess.check_call(["bench", "--site", site, "clear-cache"])
|
||||||
|
subprocess.check_call(["bench", "--site", site, "clear-website-cache"])
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
frappe.log_error(message=str(e), title="Clear Cache Failed")
|
||||||
|
print(f"\n❌ Clearing cache failed: {e}\n")
|
||||||
|
|
||||||
|
# Restart bench
|
||||||
|
try:
|
||||||
|
print("\n🔄 Restarting bench...\n")
|
||||||
|
subprocess.check_call(["bench", "restart"])
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
frappe.log_error(message=str(e), title="Bench Restart Failed")
|
||||||
|
print(f"\n❌ Bench restart failed: {e}\n")
|
||||||
|
|
||||||
@click.command("create-module")
|
@click.command("create-module")
|
||||||
def create_module_command():
|
def create_module_command():
|
||||||
|
|||||||
@ -31,9 +31,6 @@ def build_frontend():
|
|||||||
|
|
||||||
dist_path = os.path.join(app_root, "custom_ui", "public", "dist")
|
dist_path = os.path.join(app_root, "custom_ui", "public", "dist")
|
||||||
should_build = True
|
should_build = True
|
||||||
if os.path.exists(dist_path) and os.listdir(dist_path):
|
|
||||||
print("ℹ️ Frontend already built. Skipping rebuild.")
|
|
||||||
should_build = False
|
|
||||||
|
|
||||||
if should_build:
|
if should_build:
|
||||||
print("\n📦 Building frontend for custom_ui...\n")
|
print("\n📦 Building frontend for custom_ui...\n")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user