From e4f8f0483f418da953724ddcbc3d67cfe6373ea9 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 14 Jan 2025 15:08:05 +0100 Subject: [PATCH] [mod] slightly improve `make node.clean themes.all` Signed-off-by: Markus Heiser --- docs/dev/quickstart.rst | 6 ++---- manage | 11 ----------- utils/lib_sxng_node.sh | 19 +++++++++++++++---- utils/lib_sxng_themes.sh | 26 +++++++++++++++++++------- 4 files changed, 36 insertions(+), 26 deletions(-) diff --git a/docs/dev/quickstart.rst b/docs/dev/quickstart.rst index c45c24491..917d90c12 100644 --- a/docs/dev/quickstart.rst +++ b/docs/dev/quickstart.rst @@ -39,10 +39,8 @@ to our ":ref:`how to contribute`" guideline. - :ref:`make themes` If you implement themes, you will need to setup a :ref:`Node.js environment -`: ``make node.env`` - -Before you call *make run* (2.), you need to compile the modified styles and -JavaScript: ``make themes.all`` +`. Before you call *make run* (2.), you need to compile the +modified styles and JavaScript: ``make node.clean themes.all`` Alternatively you can also compile selective the theme you have modified, e.g. the *simple* theme. diff --git a/manage b/manage index d19458c72..714f31512 100755 --- a/manage +++ b/manage @@ -94,8 +94,6 @@ pyenv.: OK : test if virtualenv is OK format.: python : format Python code source using black -pygments.: - less : build LESS files for pygments EOF go.help node.help @@ -253,15 +251,6 @@ gecko.driver() { dump_return $? } -pygments.less() { - build_msg PYGMENTS "searxng_extra/update/update_pygments.py" - if ! pyenv.cmd python searxng_extra/update/update_pygments.py; then - build_msg PYGMENTS "building LESS files for pygments failed" - return 1 - fi - return 0 -} - py.build() { build_msg BUILD "python package ${PYDIST}" pyenv.cmd python setup.py \ diff --git a/utils/lib_sxng_node.sh b/utils/lib_sxng_node.sh index eac5bb16b..0845723e0 100755 --- a/utils/lib_sxng_node.sh +++ b/utils/lib_sxng_node.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash # SPDX-License-Identifier: AGPL-3.0-or-later +declare _Blue +declare _creset + export NODE_MINIMUM_VERSION="16.13.0" node.help(){ @@ -22,7 +25,7 @@ nodejs.ensure() { node.env() { nodejs.ensure ( set -e - build_msg INSTALL "./searx/static/themes/simple/package.json" + build_msg INSTALL "[npm] ./searx/static/themes/simple/package.json" npm --prefix searx/static/themes/simple install ) dump_return $? @@ -30,7 +33,7 @@ node.env() { node.env.dev() { nodejs.ensure - build_msg INSTALL "./package.json: developer and CI tools" + build_msg INSTALL "[npm] ./package.json: developer and CI tools" npm install } @@ -41,11 +44,19 @@ node.clean() { fi build_msg CLEAN "themes -- locally installed npm dependencies" ( set -e - npm --prefix searx/static/themes/simple run clean + npm --prefix searx/static/themes/simple run clean \ + | prefix_stdout "${_Blue}CLEAN ${_creset} " + if [ "${PIPESTATUS[0]}" -ne "0" ]; then + return 1 + fi ) build_msg CLEAN "locally installed developer and CI tools" ( set -e - npm --prefix . run clean + npm --prefix . run clean \ + | prefix_stdout "${_Blue}CLEAN ${_creset} " + if [ "${PIPESTATUS[0]}" -ne "0" ]; then + return 1 + fi ) dump_return $? } diff --git a/utils/lib_sxng_themes.sh b/utils/lib_sxng_themes.sh index 8d41b6480..a276dd8c5 100755 --- a/utils/lib_sxng_themes.sh +++ b/utils/lib_sxng_themes.sh @@ -9,16 +9,14 @@ themes.help(){ themes.: all : build all themes live : to get live builds of CSS & JS use 'LIVE_THEME=simple make run' - simple.: - build : build simple theme + simple.: build simple theme test : test simple theme + pygments: build pygment's LESS files for simple theme EOF } themes.all() { ( set -e - pygments.less - node.env themes.simple ) dump_return $? @@ -50,15 +48,29 @@ themes.live() { themes.simple() { ( set -e - build_msg GRUNT "theme: simple" - npm --prefix searx/static/themes/simple run build + node.env + themes.simple.pygments ) + build_msg GRUNT "theme: simple" + npm --prefix searx/static/themes/simple run build dump_return $? } +themes.simple.pygments() { + build_msg PYGMENTS "searxng_extra/update/update_pygments.py" + pyenv.cmd python searxng_extra/update/update_pygments.py \ + | prefix_stdout "${_Blue}PYGMENTS ${_creset} " + if [ "${PIPESTATUS[0]}" -ne "0" ]; then + build_msg PYGMENTS "building LESS files for pygments failed" + return 1 + fi + return 0 +} + + themes.simple.test() { build_msg TEST "theme: simple" - nodejs.ensure + node.env npm --prefix searx/static/themes/simple install npm --prefix searx/static/themes/simple run test dump_return $?