From 64100db9045ec712afbd8fa1becee14f7109921c Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 6 Aug 2023 16:39:00 +0200 Subject: [doc] improve documentation of make targets and ./manage script BTW force modularization of the ./mange script into sub modules: - utils/lib_sxng_data.sh - utils/lib_sxng_node.sh - utils/lib_sxng_static.sh - utils/lib_sxng_test.sh - utils/lib_sxng_themes.sh Signed-off-by: Markus Heiser --- utils/lib_sxng_static.sh | 129 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100755 utils/lib_sxng_static.sh (limited to 'utils/lib_sxng_static.sh') diff --git a/utils/lib_sxng_static.sh b/utils/lib_sxng_static.sh new file mode 100755 index 000000000..1d76bfe70 --- /dev/null +++ b/utils/lib_sxng_static.sh @@ -0,0 +1,129 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: AGPL-3.0-or-later + + +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' +) + +static.help(){ + cat </dev/null + + ( set -e + # build the themes + themes.all + + # add build files + for built_path in "${STATIC_BUILT_PATHS[@]}"; do + git add -v "${built_path}" + done + + # check if any file has been added (in case of no changes) + if [ -z "$(git diff --name-only --cached)" ]; then + build_msg STATIC "no changes applied / nothing to commit" + return 0 + fi + + # check for modified files that are not staged + if [ -n "$(git diff --name-only)" ]; then + die 42 "themes.all has created files that are not in STATIC_BUILT_PATHS" + fi + git commit -m "${STATIC_BUILD_COMMIT}" + ) +} + +static.build.restore() { + build_msg STATIC "git-restore of the built files (/static)" + git restore --staged "${STATIC_BUILT_PATHS[@]}" + git restore --worktree "${STATIC_BUILT_PATHS[@]}" +} -- cgit v1.2.3