From 662788e8ffa607ce568fabcf67caa873ca48889a Mon Sep 17 00:00:00 2001 From: Matti Airas Date: Sun, 5 May 2024 17:01:53 +0300 Subject: [PATCH] Compile css files automatically as part of "run build-frontend" Also rename underscore run commands to hyphen. --- extra_script.py | 9 +++------ run | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/extra_script.py b/extra_script.py index ddc1264e4..037501d2d 100644 --- a/extra_script.py +++ b/extra_script.py @@ -3,27 +3,24 @@ Import("env") -# install brotli if it isn't installed -#try: +# try: # import brotli -#except ImportError: +# except ImportError: # env.Execute("$PYTHONEXE -m pip install brotli") - def convert_files(root_file_path: pathlib.Path, target): scripts.convert_html.convert_files(root_file_path, target) def build_web_ui(*args, **kwargs) -> None: # install and build the web UI - env.Execute("cd web && npm install && npm run build") scripts.convert_html.convert_files( pathlib.Path("web/dist/index.html"), "src/sensesp/net/web/autogen/web_ui_files.h", "kWebUIFiles", - "/" + "/", ) diff --git a/run b/run index 90363c00b..fa18ded44 100755 --- a/run +++ b/run @@ -35,20 +35,20 @@ function all { checks } -function install_pio { +function install-pio { echo "📦 Installing PlatformIO project" pio project init } -function install_frontend { +function install-frontend { echo "📦 Installing frontend dependencies" ( cd web && npm install ) } function install { echo "📦 Installing project and dependencies" - install_pio - install_frontend + install-pio + install-frontend } function clean { @@ -57,20 +57,22 @@ function clean { rm -rf web/node_modules/ } -function build_pio { +function build-pio { echo "🏗️ Building the PlatformIO project" pio run } -function build_frontend { +function build-frontend { echo "🏗️ Building the frontend" + ( cd web && npm run css-compile ) + ( cd web && npm run build ) pio run -t webUI } function build { echo "🏗️ Building the project" - build_frontend - build_pio + build-frontend + build-pio } function upload { @@ -79,7 +81,7 @@ function upload { pio run -t upload } -function upload_monitor { +function upload-monitor { echo "🚀 🖥️ Uploading the project and opening the serial monitor" build pio run -t upload --target monitor