searxng/utils/lib_sxng_vite.sh
Ivan Gabaldon a947d5b3cf [mod] theme/simple: improve fmt/lint tech
This is one of various PR to refactor the simple theme internally.

Replace eslint tool with Biome. I have been using this for quite some time, and
it will help us to have more consistent and valid code without extending on
other third party plugins.

Removes unused dependencies.
2025-07-03 17:35:05 +02:00

69 lines
1.5 KiB
Bash

#!/usr/bin/env bash
# SPDX-License-Identifier: AGPL-3.0-or-later
declare _Blue
declare _creset
vite.help(){
cat <<EOF
vite.: .. to be done ..
simple.:
build: build static files of the simple theme
fix: run prettiers on simple theme
lint: run linters on simple theme
dev: start development server
EOF
}
VITE_SIMPLE_THEME="${REPO_ROOT}/client/simple"
# 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() {
( set -e
templates.simple.pygments
node.env
build_msg SIMPLE "run build of theme from: ${VITE_SIMPLE_THEME}"
pushd "${VITE_SIMPLE_THEME}"
npm install
npm run build
popd &> /dev/null
)
}
vite.simple.fix() {
( set -e
node.env
npm --prefix client/simple run fix
)
}
vite.simple.lint() {
( set -e
node.env
npm --prefix client/simple run lint
)
}
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
}