2023-08-06 16:39:00 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
|
|
declare _Blue
|
|
|
|
declare _creset
|
|
|
|
|
|
|
|
themes.help(){
|
|
|
|
cat <<EOF
|
|
|
|
themes.:
|
2025-01-15 17:26:45 +01:00
|
|
|
all : test & build all themes
|
|
|
|
test : test all themes
|
|
|
|
fix : fix JS & CSS (LESS)
|
|
|
|
live : to get live builds of CSS & JS use: LIVE_THEME=simple make run
|
|
|
|
simple.: test & build simple theme ..
|
2025-01-14 15:08:05 +01:00
|
|
|
pygments: build pygment's LESS files for simple theme
|
2025-01-15 17:26:45 +01:00
|
|
|
test : test simple theme
|
|
|
|
fix : fix JS & CSS (LESS) of the simple theme
|
2023-08-06 16:39:00 +02:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
themes.all() {
|
|
|
|
( set -e
|
2025-01-15 17:26:45 +01:00
|
|
|
node.env
|
2023-08-06 16:39:00 +02:00
|
|
|
themes.simple
|
|
|
|
)
|
|
|
|
dump_return $?
|
|
|
|
}
|
|
|
|
|
2025-01-15 17:26:45 +01:00
|
|
|
themes.fix() {
|
|
|
|
( set -e
|
|
|
|
node.env
|
|
|
|
themes.simple.fix
|
|
|
|
)
|
|
|
|
dump_return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
themes.test() {
|
|
|
|
( set -e
|
|
|
|
node.env
|
|
|
|
themes.simple.test
|
|
|
|
)
|
|
|
|
dump_return $?
|
|
|
|
}
|
|
|
|
|
2023-08-06 16:39:00 +02:00
|
|
|
themes.live() {
|
|
|
|
local LIVE_THEME="${LIVE_THEME:-${1}}"
|
|
|
|
case "${LIVE_THEME}" in
|
|
|
|
simple)
|
|
|
|
theme="searx/static/themes/${LIVE_THEME}"
|
|
|
|
;;
|
|
|
|
'')
|
2025-01-15 17:26:45 +01:00
|
|
|
die 42 "missing theme argument"
|
2023-08-06 16:39:00 +02:00
|
|
|
;;
|
|
|
|
*)
|
2025-01-15 17:26:45 +01:00
|
|
|
die 42 "unknown theme '${LIVE_THEME}' // [simple]'"
|
2023-08-06 16:39:00 +02:00
|
|
|
;;
|
|
|
|
esac
|
2025-01-15 17:26:45 +01:00
|
|
|
build_msg SIMPLE "theme: $1 (live build)"
|
|
|
|
node.env
|
|
|
|
themes.simple.pygments
|
2023-08-06 16:39:00 +02:00
|
|
|
cd "${theme}"
|
|
|
|
{
|
|
|
|
npm run watch
|
2025-01-15 17:26:45 +01:00
|
|
|
} # 2>&1 \
|
|
|
|
# | prefix_stdout "${_Blue}THEME ${1} ${_creset} " \
|
|
|
|
# | grep -E --ignore-case --color 'error[s]?[:]? |warning[s]?[:]? |'
|
2023-08-06 16:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
themes.simple() {
|
|
|
|
( set -e
|
2025-01-14 15:08:05 +01:00
|
|
|
themes.simple.pygments
|
2025-01-15 17:26:45 +01:00
|
|
|
build_msg SIMPLE "theme: run build"
|
|
|
|
# "run build" includes tests from eslint and stylelint
|
|
|
|
npm --prefix searx/static/themes/simple run build
|
2023-08-06 16:39:00 +02:00
|
|
|
)
|
|
|
|
dump_return $?
|
|
|
|
}
|
|
|
|
|
2025-01-14 15:08:05 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2025-01-15 17:26:45 +01:00
|
|
|
themes.simple.fix() {
|
|
|
|
build_msg SIMPLE "theme: fix"
|
|
|
|
npm --prefix searx/static/themes/simple run fix
|
|
|
|
dump_return $?
|
|
|
|
}
|
2025-01-14 15:08:05 +01:00
|
|
|
|
2023-08-06 16:39:00 +02:00
|
|
|
themes.simple.test() {
|
2025-01-15 17:26:45 +01:00
|
|
|
build_msg SIMPLE "theme: run test"
|
2023-08-06 16:39:00 +02:00
|
|
|
npm --prefix searx/static/themes/simple run test
|
|
|
|
dump_return $?
|
|
|
|
}
|