From 2bf77f5d2db2a33828beff402f7f18443204595d Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 5 Feb 2025 16:49:06 +0100 Subject: [web-client] integrate the migrated theme in the development workflows Signed-off-by: Markus Heiser --- utils/lib_sxng_data.sh | 12 -------- utils/lib_sxng_node.sh | 6 ++-- utils/lib_sxng_static.sh | 9 ++---- utils/lib_sxng_themes.sh | 78 +++++------------------------------------------- utils/lib_sxng_vite.sh | 49 ++++++++++++++++++++---------- 5 files changed, 46 insertions(+), 108 deletions(-) (limited to 'utils') diff --git a/utils/lib_sxng_data.sh b/utils/lib_sxng_data.sh index 50a932f6d..ab1204de6 100755 --- a/utils/lib_sxng_data.sh +++ b/utils/lib_sxng_data.sh @@ -59,15 +59,3 @@ data.locales() { ) dump_return $? } - -docs.prebuild() { - build_msg DOCS "build ${DOCS_BUILD}/includes" - ( - set -e - [ "$VERBOSE" = "1" ] && set -x - mkdir -p "${DOCS_BUILD}/includes" - ./utils/searxng.sh searxng.doc.rst > "${DOCS_BUILD}/includes/searxng.rst" - pyenv.cmd searxng_extra/docs_prebuild - ) - dump_return $? -} diff --git a/utils/lib_sxng_node.sh b/utils/lib_sxng_node.sh index 0845723e0..27a69a62a 100755 --- a/utils/lib_sxng_node.sh +++ b/utils/lib_sxng_node.sh @@ -25,8 +25,8 @@ nodejs.ensure() { node.env() { nodejs.ensure ( set -e - build_msg INSTALL "[npm] ./searx/static/themes/simple/package.json" - npm --prefix searx/static/themes/simple install + build_msg INSTALL "[npm] ./client/simple/package.json" + npm --prefix client/simple install ) dump_return $? } @@ -44,7 +44,7 @@ node.clean() { fi build_msg CLEAN "themes -- locally installed npm dependencies" ( set -e - npm --prefix searx/static/themes/simple run clean \ + npm --prefix client/simple run clean \ | prefix_stdout "${_Blue}CLEAN ${_creset} " if [ "${PIPESTATUS[0]}" -ne "0" ]; then return 1 diff --git a/utils/lib_sxng_static.sh b/utils/lib_sxng_static.sh index d991d4b89..9c9ea085c 100755 --- a/utils/lib_sxng_static.sh +++ b/utils/lib_sxng_static.sh @@ -4,12 +4,7 @@ STATIC_BUILD_COMMIT="[build] /static" STATIC_BUILT_PATHS=( - 'searx/static/themes/simple/css' - 'searx/static/themes/simple/js' - 'searx/static/themes/simple/src/generated/pygments.less' - 'searx/static/themes/simple/img' - 'searx/templates/simple/searxng-wordmark.min.svg' - 'searx/templates/simple/icons.html' + 'searx/static/themes/simple' ) static.help(){ @@ -101,7 +96,7 @@ static.build.commit() { ( set -e # fix & build the themes - themes.fix + themes.fix themes.all # add build files diff --git a/utils/lib_sxng_themes.sh b/utils/lib_sxng_themes.sh index 059f9c86f..23faf0e4b 100755 --- a/utils/lib_sxng_themes.sh +++ b/utils/lib_sxng_themes.sh @@ -1,100 +1,36 @@ #!/usr/bin/env bash # SPDX-License-Identifier: AGPL-3.0-or-later -declare _Blue -declare _creset - themes.help(){ cat <&1 \ - # | prefix_stdout "${_Blue}THEME ${1} ${_creset} " \ - # | grep -E --ignore-case --color 'error[s]?[:]? |warning[s]?[:]? |' -} - -themes.simple() { - ( set -e - themes.simple.pygments - build_msg SIMPLE "theme: run build" - # "run build" includes tests from eslint and stylelint - npm --prefix searx/static/themes/simple run build + # we run a build to test (in CI) + build_msg SIMPLE "theme: run build (to test)" + vite.simple.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.fix() { - build_msg SIMPLE "theme: fix" - npm --prefix searx/static/themes/simple run fix - dump_return $? -} - -themes.simple.test() { - build_msg SIMPLE "theme: run test" - npm --prefix searx/static/themes/simple run test - dump_return $? -} diff --git a/utils/lib_sxng_vite.sh b/utils/lib_sxng_vite.sh index d188fe503..7eb670fba 100644 --- a/utils/lib_sxng_vite.sh +++ b/utils/lib_sxng_vite.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash # SPDX-License-Identifier: AGPL-3.0-or-later +declare _Blue +declare _creset vite.help(){ cat < /dev/null - ) - -} +# ToDo: vite server is not implemented yet / will be done in a follow up PR +# +# vite.simple.dev() { +# ( set -e +# build_msg SIMPLE "start server for FE development of: ${VITE_SIMPLE_THEME}" +# pushd "${VITE_SIMPLE_THEME}" +# npm install +# npm exec -- vite +# popd &> /dev/null +# ) +# } vite.simple.build() { - - # build static files of the simple theme - ( set -e + templates.simple.pygments + + node.env build_msg SIMPLE "run build of theme from: ${VITE_SIMPLE_THEME}" pushd "${VITE_SIMPLE_THEME}" @@ -38,6 +39,24 @@ vite.simple.build() { npm run fix npm run icons.html npm run build + popd &> /dev/null + ) +} +vite.simple.fix() { + ( set -e + node.env + npm --prefix client/simple run fix ) } + +templates.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 +} -- cgit v1.2.3